debug_mode 改为按钮

This commit is contained in:
ali
2026-07-29 15:11:40 +08:00
parent 9ebcabc3c1
commit 4f9e962e6b
+48 -18
View File
@@ -165,15 +165,28 @@
};
panel.innerHTML = `
<style>
.ms-switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.ms-switch input { opacity: 0; width: 0; height: 0; margin: 0; }
.ms-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.ms-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.ms-switch input:checked + .ms-slider { background-color: #1890ff; }
.ms-switch input:checked + .ms-slider:before { transform: translateX(14px); }
.ms-icon-btn { position: relative; }
.ms-icon-btn:hover::after { content: attr(data-tooltip); position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background-color: rgba(0,0,0,0.8); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 1000; pointer-events: none; }
.ms-icon-btn:hover::before { content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); border-width: 4px; border-style: solid; border-color: rgba(0,0,0,0.8) transparent transparent transparent; z-index: 1000; }
</style>
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px; display:flex; justify-content:space-between; align-items:center;">
<span>高级筛选配置</span>
<button id="ms-extract-options-btn" title="从当前页面获取筛选项目并更新到脚本配置中" style="background:none; border:none; cursor:pointer; color:#1890ff; padding:2px; display:flex; align-items:center; justify-content:center; border-radius:4px; outline:none;">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
<polyline points="23 4 23 10 17 10"></polyline>
<polyline points="1 20 1 14 7 14"></polyline>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
</svg>
</button>
<div style="display:flex; align-items:center; gap:8px;">
<span>高级筛选配置</span>
<button id="ms-extract-options-btn" class="ms-icon-btn" data-tooltip="从当前页面获取筛选项目并更新到脚本配置中" style="background:none; border:none; cursor:pointer; color:#1890ff; padding:2px; display:flex; align-items:center; justify-content:center; border-radius:4px; outline:none;">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
<polyline points="23 4 23 10 17 10"></polyline>
<polyline points="1 20 1 14 7 14"></polyline>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
</svg>
</button>
</div>
</div>
<div style="margin-bottom:12px;">
<div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:8px;">类别:</div>
@@ -203,19 +216,18 @@
</div>
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px; margin-top:15px; display:flex; justify-content:space-between; align-items:center;">
<span>开发者选项</span>
<label style="display:flex; align-items:center; cursor:pointer;">
<input type="checkbox" id="ms-dev-mode-switch" ${savedFilters.devMode ? 'checked' : ''} style="margin:0;">
<label class="ms-switch">
<input type="checkbox" id="ms-dev-mode-switch" ${savedFilters.devMode ? 'checked' : ''}>
<span class="ms-slider"></span>
</label>
</div>
<div id="ms-dev-options-container" style="display:${savedFilters.devMode ? 'block' : 'none'}; margin-bottom:12px;">
<div style="display:flex; justify-content:space-between; align-items:center;">
<label style="display:flex; align-items:center; font-size:13px; cursor:pointer; color:#ff4d4f; font-weight:bold;">
<input type="checkbox" id="ms-debug-mode" style="margin-right:4px;" ${savedFilters.debugMode ? 'checked' : ''}> DEBUG_MODE
</label>
<div>
<button id="ms-extract-options-btn" title="从当前页面获取筛选项目并更新到脚本配置中" style="background:#52c41a; color:#fff; border:none; padding:4px 8px; border-radius:4px; font-size:12px; cursor:pointer; font-weight:bold; outline:none; margin-right:6px;">SYNC</button>
<button id="ms-reset-options-btn" title="恢复出厂设置并清除所有缓存数据" style="background:#ff4d4f; color:#fff; border:none; padding:4px 8px; border-radius:4px; font-size:12px; cursor:pointer; font-weight:bold; outline:none;">RESET</button>
</div>
<div style="display:flex; justify-content:flex-start; align-items:center; gap:10px;">
<input type="checkbox" id="ms-debug-mode" style="display:none;" ${savedFilters.debugMode ? 'checked' : ''}>
<button id="ms-debug-mode-btn" style="background:${savedFilters.debugMode ? '#ff4d4f' : '#f5f5f5'}; color:${savedFilters.debugMode ? '#fff' : '#999'}; border:1px solid ${savedFilters.debugMode ? '#ff4d4f' : '#d9d9d9'}; padding:4px 8px; border-radius:4px; font-size:12px; cursor:pointer; font-weight:bold; outline:none; transition:.3s;">
DEBUG_MODE ${savedFilters.debugMode ? 'ON' : 'OFF'}
</button>
<button id="ms-reset-options-btn" title="恢复出厂设置并清除所有缓存数据" style="background:#ff4d4f; color:#fff; border:none; padding:4px 8px; border-radius:4px; font-size:12px; cursor:pointer; font-weight:bold; outline:none;">RESET</button>
</div>
</div>
@@ -261,6 +273,24 @@
devContainer.style.display = e.target.checked ? 'block' : 'none';
});
// 绑定 DEBUG_MODE 按钮切换事件
document.getElementById('ms-debug-mode-btn').addEventListener('click', (e) => {
const checkbox = document.getElementById('ms-debug-mode');
checkbox.checked = !checkbox.checked;
const btn = e.target;
if (checkbox.checked) {
btn.style.background = '#ff4d4f';
btn.style.color = '#fff';
btn.style.borderColor = '#ff4d4f';
btn.innerText = 'DEBUG_MODE ON';
} else {
btn.style.background = '#f5f5f5';
btn.style.color = '#999';
btn.style.borderColor = '#d9d9d9';
btn.innerText = 'DEBUG_MODE OFF';
}
});
// 绑定更新筛选项目按钮事件
document.getElementById('ms-extract-options-btn').addEventListener('click', () => {
const getList = (num) => {