diff --git a/static/hub.css b/static/hub.css index 13c78e8..59c3e52 100644 --- a/static/hub.css +++ b/static/hub.css @@ -153,7 +153,13 @@ body.page-login .main { background: rgba(56, 189, 248, 0.35); } .overview-bj-weekday { - color: var(--text); + font-weight: 650; +} +.overview-bj-weekday.is-weekday { + color: var(--ok); +} +.overview-bj-weekday.is-weekend { + color: var(--bad); } .overview-bj-lunar { color: var(--muted); diff --git a/static/hub.js b/static/hub.js index a0372bd..6cc7b66 100644 --- a/static/hub.js +++ b/static/hub.js @@ -628,6 +628,7 @@ const y = Number(get("year")); const m = Number(get("month")); const d = Number(get("day")); + const weekdayIndex = new Date(Date.UTC(y, m - 1, d)).getUTCDay(); return { time: get("year") + @@ -641,7 +642,8 @@ get("minute") + ":" + get("second"), - weekday: WEEKDAYS[new Date(Date.UTC(y, m - 1, d)).getUTCDay()] || "", + weekdayIndex: weekdayIndex, + weekday: WEEKDAYS[weekdayIndex] || "", lunar: solarToLunarText(y, m, d), }; } catch (e) { @@ -667,6 +669,7 @@ p(bj.getMinutes()) + ":" + p(bj.getSeconds()), + weekdayIndex: bj.getDay(), weekday: WEEKDAYS[bj.getDay()] || "", lunar: solarToLunarText(y, m, d), }; @@ -681,12 +684,13 @@ el.setAttribute("datetime", parts.time.replace(" ", "T") + "+08:00"); const meta = document.getElementById("overview-bj-meta"); if (meta) { - const bits = [parts.weekday, parts.lunar].filter(Boolean); + const weekend = parts.weekdayIndex === 0 || parts.weekdayIndex === 6; + const wdClass = weekend ? "is-weekend" : "is-weekday"; meta.innerHTML = - '' + - bits[0] + - "" + - (bits[1] ? '' + bits[1] + "" : ""); + (parts.weekday + ? '' + parts.weekday + "" + : "") + + (parts.lunar ? '' + parts.lunar + "" : ""); } } diff --git a/templates/base.html b/templates/base.html index 7a3ca24..87076bb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -4,7 +4,7 @@