添加重置按钮
This commit is contained in:
+26
-8
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
// 预设筛选常量
|
// 预设筛选常量
|
||||||
let FILTER_OPTIONS = {
|
let FILTER_OPTIONS = {
|
||||||
names: ['盘螺', '螺纹钢', '高线', '测试'],
|
names: ["盘螺", "螺纹钢", "高线"],
|
||||||
specs: ['Φ6', 'Φ8', 'Φ8-10', 'Φ10', 'Φ12', 'Φ14', 'Φ16', 'Φ18', 'Φ20', 'Φ22', 'Φ25', 'Φ28', 'Φ32', 'Φ36', 'Φ36-40', 'Φ40'],
|
specs: ["Φ6", "Φ8-10", "Φ8", "Φ10", "Φ12", "Φ14", "Φ16", "Φ18", "Φ20", "Φ22", "Φ25", "Φ28", "Φ32", "Φ36-40", "Φ36", "Φ40"],
|
||||||
materials: ['HPB300', 'HRB400', 'HRB400E', 'HRB500E']
|
materials: ["HPB300", "HRB400", "HRB400E", "HRB500E"]
|
||||||
};
|
};
|
||||||
|
|
||||||
// 尝试加载本地存储的动态筛选项目
|
// 尝试加载本地存储的动态筛选项目
|
||||||
@@ -164,7 +164,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
panel.innerHTML = `
|
panel.innerHTML = `
|
||||||
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px;">高级筛选配置</div>
|
<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>
|
||||||
<div style="margin-bottom:12px;">
|
<div style="margin-bottom:12px;">
|
||||||
<div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:8px;">类别:</div>
|
<div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:8px;">类别:</div>
|
||||||
<div id="ms-names-container" style="display:grid; grid-template-columns:repeat(5, 1fr); gap:8px 4px;">${buildCheckboxes('names', FILTER_OPTIONS.names)}</div>
|
<div id="ms-names-container" style="display:grid; grid-template-columns:repeat(5, 1fr); gap:8px 4px;">${buildCheckboxes('names', FILTER_OPTIONS.names)}</div>
|
||||||
@@ -192,14 +201,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px; margin-top:15px;">开发者选项</div>
|
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px; margin-top:15px;">开发者选项</div>
|
||||||
<div style="margin-bottom:12px;">
|
<div style="margin-bottom:12px; 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;">
|
<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
|
<input type="checkbox" id="ms-debug-mode" style="margin-right:4px;" ${savedFilters.debugMode ? 'checked' : ''}> DEBUG_MODE
|
||||||
</label>
|
</label>
|
||||||
|
<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>
|
||||||
<div style="margin-bottom:15px;">
|
|
||||||
<button id="ms-extract-options-btn" style="width:100%; padding:6px; background:#fff; color:#ff4d4f; border:1px solid #ff4d4f; border-radius:4px; cursor:pointer; font-weight:bold; font-size:12px;">更新/提取页面筛选项目</button>
|
|
||||||
</div>
|
|
||||||
<button id="ms-close-panel-btn" style="width:100%; padding:8px; background:#1890ff; color:#fff; border:none; border-radius:4px; cursor:pointer; font-weight:bold;">保存并关闭</button>
|
<button id="ms-close-panel-btn" style="width:100%; padding:8px; background:#1890ff; color:#fff; border:none; border-radius:4px; cursor:pointer; font-weight:bold;">保存并关闭</button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -289,6 +297,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 绑定恢复出厂设置按钮事件
|
||||||
|
document.getElementById('ms-reset-options-btn').addEventListener('click', () => {
|
||||||
|
if (confirm('确定要恢复出厂设置吗?\n这将清除所有保存的配置和提取的筛选参数。')) {
|
||||||
|
localStorage.removeItem('mysteel_filters');
|
||||||
|
localStorage.removeItem('mysteel_dynamic_options');
|
||||||
|
showToast('恢复出厂设置成功!即将刷新页面...', 'success');
|
||||||
|
setTimeout(() => window.location.reload(), 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 绑定保存关闭按钮事件
|
// 绑定保存关闭按钮事件
|
||||||
document.getElementById('ms-close-panel-btn').addEventListener('click', () => {
|
document.getElementById('ms-close-panel-btn').addEventListener('click', () => {
|
||||||
const active = getCurrentFilters();
|
const active = getCurrentFilters();
|
||||||
|
|||||||
Reference in New Issue
Block a user