精修 WebUI 第二十轮:Favicon + 长按连发 + 刷新反馈
- 添加内联 SVG favicon(与 brandMark 同款:紫色渐变圆角方框 + 播放三角 + 圆点),data URL 不增加请求 - number stepper 长按连发:pointerdown 后 500ms 进入 80ms/次的连发;pointerleave/up/cancel/blur 全部取消 - btnRefresh 加 isBusy 状态 + spinner;完成后 toast 反馈"已刷新 · N 台在线"或"无在线设备"或失败提示 - cache-bust v22 → v23
This commit is contained in:
1 parent
cea5f1df45
commit
df96f25eba
2 files changed
+36
-5
No files matched your search
+33
-3
@@ -893,8 +893,27 @@ function attachNumberSteppers() {
|
||||
input.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
input.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
};
|
||||
up.addEventListener("click", (e) => { e.preventDefault(); fire(1); });
|
||||
down.addEventListener("click", (e) => { e.preventDefault(); fire(-1); });
|
||||
const bindHold = (btn, dir) => {
|
||||
let holdTimer, repeatTimer;
|
||||
const cancel = () => {
|
||||
if (holdTimer) { clearTimeout(holdTimer); holdTimer = null; }
|
||||
if (repeatTimer) { clearInterval(repeatTimer); repeatTimer = null; }
|
||||
};
|
||||
btn.addEventListener("pointerdown", (e) => {
|
||||
if (e.button !== 0) return;
|
||||
e.preventDefault();
|
||||
fire(dir);
|
||||
holdTimer = setTimeout(() => {
|
||||
repeatTimer = setInterval(() => fire(dir), 80);
|
||||
}, 500);
|
||||
});
|
||||
btn.addEventListener("pointerup", cancel);
|
||||
btn.addEventListener("pointerleave", cancel);
|
||||
btn.addEventListener("pointercancel", cancel);
|
||||
btn.addEventListener("blur", cancel);
|
||||
};
|
||||
bindHold(up, 1);
|
||||
bindHold(down, -1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2329,7 +2348,18 @@ window.addEventListener("DOMContentLoaded", async () => {
|
||||
document.querySelectorAll(".stat .statValue").forEach((el) => {
|
||||
if ((el.textContent || "").trim() === "-") el.classList.add("skeleton");
|
||||
});
|
||||
$("btnRefresh").addEventListener("click", refreshDevices);
|
||||
$("btnRefresh").addEventListener("click", async () => {
|
||||
setButtonBusy("btnRefresh", true);
|
||||
try {
|
||||
await refreshDevices();
|
||||
const n = (deviceOverviewState.devices || []).length;
|
||||
toast(n > 0 ? `已刷新 · ${n} 台在线` : "已刷新 · 无在线设备", n > 0 ? "success" : "warn");
|
||||
} catch (e) {
|
||||
toast("刷新失败:" + (e?.message || e), "error", { duration: 4000 });
|
||||
} finally {
|
||||
setButtonBusy("btnRefresh", false);
|
||||
}
|
||||
});
|
||||
$("btnLoad").addEventListener("click", async () => { await loadConfig(); });
|
||||
$("btnSave").addEventListener("click", async () => { await saveConfig(); });
|
||||
$("btnStart").addEventListener("click", async () => { await startRun(); });
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>抖音挂机 - Web GUI</title>
|
||||
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0%25' stop-color='%238b95ff'/><stop offset='100%25' stop-color='%235e6ad2'/></linearGradient></defs><rect width='32' height='32' rx='7' fill='url(%23g)'/><path d='M13 10.5v11l9-5.5z' fill='white'/><circle cx='22' cy='10' r='2' fill='white'/></svg>" />
|
||||
<script>
|
||||
(function(){
|
||||
try {
|
||||
@@ -15,7 +16,7 @@
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
<link rel="stylesheet" href="styles.css?v=console-20260520-theme-v22" />
|
||||
<link rel="stylesheet" href="styles.css?v=console-20260520-theme-v23" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
@@ -1259,6 +1260,6 @@
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>
|
||||
</button>
|
||||
|
||||
<script src="app.js?v=console-20260520-theme-v22"></script>
|
||||
<script src="app.js?v=console-20260520-theme-v23"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user