总览北京时间改为更易读的纯文本样式,日期格式与拉取时间一致。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+32
-16
@@ -101,32 +101,48 @@ body.page-login .main {
|
||||
.overview-bj-clock {
|
||||
margin-left: auto;
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(56, 189, 248, 0.22);
|
||||
background: rgba(8, 14, 24, 0.72);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
.overview-bj-label {
|
||||
font-size: 0.72rem;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
font-size: 0.82rem;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: none;
|
||||
color: var(--muted);
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.overview-bj-label::after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
height: 12px;
|
||||
margin-left: 10px;
|
||||
vertical-align: -1px;
|
||||
background: rgba(56, 189, 248, 0.35);
|
||||
}
|
||||
.overview-bj-time {
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.95rem;
|
||||
font-family: var(--font);
|
||||
font-size: 1.05rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--text);
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.page-head { flex-wrap: wrap; }
|
||||
.overview-bj-clock { margin-left: 0; order: 3; width: 100%; justify-content: center; }
|
||||
.overview-bj-clock {
|
||||
margin-left: 0;
|
||||
order: 3;
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
padding-top: 2px;
|
||||
}
|
||||
}
|
||||
.muted { color: var(--muted); font-size: 0.9rem; }
|
||||
.flash {
|
||||
|
||||
+26
-5
@@ -333,7 +333,7 @@
|
||||
|
||||
function formatBeijingNow() {
|
||||
try {
|
||||
return new Intl.DateTimeFormat("zh-CN", {
|
||||
const parts = new Intl.DateTimeFormat("en-CA", {
|
||||
timeZone: "Asia/Shanghai",
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
@@ -342,7 +342,26 @@
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
hour12: false,
|
||||
}).format(new Date());
|
||||
}).formatToParts(new Date());
|
||||
const get = function (type) {
|
||||
const hit = parts.find(function (p) {
|
||||
return p.type === type;
|
||||
});
|
||||
return hit ? hit.value : "";
|
||||
};
|
||||
return (
|
||||
get("year") +
|
||||
"-" +
|
||||
get("month") +
|
||||
"-" +
|
||||
get("day") +
|
||||
" " +
|
||||
get("hour") +
|
||||
":" +
|
||||
get("minute") +
|
||||
":" +
|
||||
get("second")
|
||||
);
|
||||
} catch (e) {
|
||||
const d = new Date();
|
||||
const utc = d.getTime() + d.getTimezoneOffset() * 60000;
|
||||
@@ -352,9 +371,9 @@
|
||||
};
|
||||
return (
|
||||
bj.getFullYear() +
|
||||
"/" +
|
||||
"-" +
|
||||
p(bj.getMonth() + 1) +
|
||||
"/" +
|
||||
"-" +
|
||||
p(bj.getDate()) +
|
||||
" " +
|
||||
p(bj.getHours()) +
|
||||
@@ -369,7 +388,9 @@
|
||||
function tickBeijingClock() {
|
||||
const el = document.getElementById("overview-bj-time");
|
||||
if (!el) return;
|
||||
el.textContent = formatBeijingNow();
|
||||
const text = formatBeijingNow();
|
||||
el.textContent = text;
|
||||
el.setAttribute("datetime", text.replace(" ", "T") + "+08:00");
|
||||
}
|
||||
|
||||
function boot() {
|
||||
|
||||
Reference in New Issue
Block a user