@youtyan/code-viewer 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/app.js +1 -28
- package/web/index.html +0 -1
- package/web/style.css +0 -22
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -241,7 +241,6 @@
|
|
|
241
241
|
collapsed: false,
|
|
242
242
|
files: [],
|
|
243
243
|
activeFile: null,
|
|
244
|
-
autoReload: localStorage.getItem("gdp:auto-reload") !== "0",
|
|
245
244
|
hideTests: localStorage.getItem("gdp:hide-tests") === "1",
|
|
246
245
|
syntaxHighlight: localStorage.getItem("gdp:syntax-highlight") !== "0",
|
|
247
246
|
viewedFiles: new Set(JSON.parse(localStorage.getItem("gdp:viewed-files") || "[]")),
|
|
@@ -2677,7 +2676,7 @@
|
|
|
2677
2676
|
syncHeaderMenu();
|
|
2678
2677
|
}).catch(() => setStatus("error"));
|
|
2679
2678
|
}
|
|
2680
|
-
function load(
|
|
2679
|
+
function load() {
|
|
2681
2680
|
if (STATE.route.screen === "repo")
|
|
2682
2681
|
return loadRepo();
|
|
2683
2682
|
setStatus("refreshing");
|
|
@@ -2688,8 +2687,6 @@
|
|
|
2688
2687
|
params.set("from", STATE.from);
|
|
2689
2688
|
if (STATE.to)
|
|
2690
2689
|
params.set("to", STATE.to);
|
|
2691
|
-
if (opts && opts.nocache)
|
|
2692
|
-
params.set("nocache", "1");
|
|
2693
2690
|
const url = "/diff.json" + (params.toString() ? "?" + params.toString() : "");
|
|
2694
2691
|
return trackLoad(fetch(url).then((r) => r.json())).then((data) => {
|
|
2695
2692
|
renderShell(data);
|
|
@@ -2978,31 +2975,7 @@
|
|
|
2978
2975
|
setTimeout(() => btn.classList.remove("spinning"), 200);
|
|
2979
2976
|
});
|
|
2980
2977
|
});
|
|
2981
|
-
const AUTO_RELOAD_MS = 3000;
|
|
2982
|
-
let autoTimer = null;
|
|
2983
|
-
function setAutoReload(on) {
|
|
2984
|
-
STATE.autoReload = on;
|
|
2985
|
-
localStorage.setItem("gdp:auto-reload", on ? "1" : "0");
|
|
2986
|
-
const btn = $("#auto-reload");
|
|
2987
|
-
if (btn) {
|
|
2988
|
-
btn.classList.toggle("active", on);
|
|
2989
|
-
btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
2990
|
-
}
|
|
2991
|
-
if (autoTimer) {
|
|
2992
|
-
clearInterval(autoTimer);
|
|
2993
|
-
autoTimer = null;
|
|
2994
|
-
}
|
|
2995
|
-
if (on)
|
|
2996
|
-
autoTimer = setInterval(() => {
|
|
2997
|
-
if (!document.hidden)
|
|
2998
|
-
load({ nocache: true });
|
|
2999
|
-
}, AUTO_RELOAD_MS);
|
|
3000
|
-
}
|
|
3001
|
-
setAutoReload(STATE.autoReload);
|
|
3002
|
-
$("#auto-reload").addEventListener("click", () => setAutoReload(!STATE.autoReload));
|
|
3003
2978
|
window.addEventListener("storage", (e) => {
|
|
3004
|
-
if (e.key === "gdp:auto-reload")
|
|
3005
|
-
setAutoReload(e.newValue !== "0");
|
|
3006
2979
|
if (e.key === "gdp:syntax-highlight")
|
|
3007
2980
|
setSyntaxHighlight(e.newValue !== "0");
|
|
3008
2981
|
});
|
package/web/index.html
CHANGED
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
<input class="ref-input" id="ref-to" placeholder="to…" autocomplete="off" readonly />
|
|
41
41
|
<button id="ref-reset" title="reset to HEAD .. worktree">×</button>
|
|
42
42
|
<button id="reload-prom" title="reload diff (R)">↻</button>
|
|
43
|
-
<button id="auto-reload" title="auto refresh every 3s">auto</button>
|
|
44
43
|
</div>
|
|
45
44
|
<div class="spacer"></div>
|
|
46
45
|
<div class="controls">
|
package/web/style.css
CHANGED
|
@@ -310,28 +310,6 @@ html, body {
|
|
|
310
310
|
#reload-prom:hover { background: var(--accent-emph); border-color: var(--accent-emph); }
|
|
311
311
|
#reload-prom.spinning { animation: gdp-spin 0.7s linear infinite; }
|
|
312
312
|
@keyframes gdp-spin { to { transform: rotate(360deg); } }
|
|
313
|
-
#auto-reload {
|
|
314
|
-
height: 26px; padding: 0 8px;
|
|
315
|
-
font-size: 11px; font-weight: 600;
|
|
316
|
-
letter-spacing: 0.04em;
|
|
317
|
-
width: auto;
|
|
318
|
-
border: 1px solid var(--border);
|
|
319
|
-
background: var(--bg);
|
|
320
|
-
color: var(--fg-muted);
|
|
321
|
-
border-radius: 6px;
|
|
322
|
-
cursor: pointer;
|
|
323
|
-
}
|
|
324
|
-
#auto-reload:hover { background: var(--bg-soft); color: var(--fg); }
|
|
325
|
-
#auto-reload.active {
|
|
326
|
-
background: #2da44e;
|
|
327
|
-
color: #fff;
|
|
328
|
-
border-color: #2da44e;
|
|
329
|
-
animation: gdp-auto-pulse 2.4s ease-in-out infinite;
|
|
330
|
-
}
|
|
331
|
-
@keyframes gdp-auto-pulse {
|
|
332
|
-
0%, 100% { box-shadow: 0 0 0 0 rgba(46, 164, 78, 0.45); }
|
|
333
|
-
50% { box-shadow: 0 0 0 4px rgba(46, 164, 78, 0); }
|
|
334
|
-
}
|
|
335
313
|
#hide-tests {
|
|
336
314
|
width: auto !important;
|
|
337
315
|
padding: 0 8px;
|