chore(HTML): 添加 desktop-clock

This commit is contained in:
2026-08-03 23:55:21 +08:00
parent fff1186534
commit 0738fd7487
9 changed files with 1426 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
(function () {
"use strict";
var layout = document.querySelector("[data-scale-layout]");
if (!layout) return;
var mode = layout.dataset.scaleLayout;
var baseWidth = Number(layout.dataset.baseWidth);
var baseHeight = Number(layout.dataset.baseHeight || 0);
function resizeLayout() {
var scale;
if (mode === "fit") {
scale = Math.min(window.innerWidth / baseWidth, window.innerHeight / baseHeight, 1.35);
} else {
scale = Math.min(window.innerWidth / baseWidth, 1.35);
}
scale = Math.max(scale, 0.1);
layout.style.setProperty("--page-scale", scale);
if (mode === "width") {
document.body.style.height = Math.max(window.innerHeight, layout.scrollHeight * scale) + "px";
}
}
window.addEventListener("resize", resizeLayout);
if (window.ResizeObserver && mode === "width") {
new ResizeObserver(resizeLayout).observe(layout);
}
resizeLayout();
}());