CI / build (push) Successful in 31s
頁面引用共用按鈕樣式表 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
94 lines
5.5 KiB
HTML
94 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-Hant">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>MoonShine LeadBoard · 我的範圍</title>
|
||
<link rel="icon" href="/2022_Moonshine_Logo_MS_logo_w_EN.png">
|
||
<script>
|
||
// 日間/夜間:和主看板共用同一個設定(pmb-theme);沒選過就跟著系統。
|
||
(function () {
|
||
var theme = null;
|
||
try { theme = localStorage.getItem('pmb-theme'); } catch (e) {}
|
||
if (theme !== 'light' && theme !== 'dark') theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||
document.documentElement.setAttribute('data-theme', theme);
|
||
})();
|
||
</script>
|
||
<script src="/i18n.js"></script>
|
||
<style>
|
||
:root { color-scheme: light; --bg:#f6f4ef; --card:#ffffff; --text:#1f2328; --muted:#5f6670; --line:#e4e0d8; --accent:#4f6bed; --warn:#b4540a; --good:#2f7d4f; }
|
||
:root[data-theme="dark"] { color-scheme: dark; --bg:#16181c; --card:#1f2228; --text:#eceef1; --muted:#a3a9b3; --line:#30343c; --accent:#8fa2ff; --warn:#f0a35a; --good:#6fcf97; }
|
||
:root { --sx-card:var(--card); --sx-text:var(--text); --sx-muted:var(--muted); --sx-line:var(--line); --sx-accent:var(--accent); --sx-warn:var(--warn); --sx-good:var(--good); --sx-input:var(--bg); --sx-up:var(--accent); --sx-down:var(--warn); }
|
||
:root[data-theme="dark"] { --sx-on-accent:#16181c;
|
||
--sx-tint-coda:#1d252e; --sx-tint-coda-border:#2c3a47; --sx-dot-coda:#7fa7c4;
|
||
--sx-tint-inv:#2a2420; --sx-tint-inv-border:#45372a; --sx-dot-inv:#e0a15a; --sx-tint-inv2:#24201d;
|
||
--sx-tint-group:#20251f; --sx-tint-group-border:#33402f; --sx-dot-group:#9bb38d;
|
||
--sx-tint-sim:rgba(255,255,255,.03); --sx-sim-bar:#a9c23a; --sx-kpi-bg:rgba(255,255,255,.04); --sx-strong:rgba(255,255,255,.05); }
|
||
* { box-sizing: border-box; }
|
||
body { margin:0; background:var(--bg); color:var(--text); font:15px/1.55 -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
|
||
main { max-width:1100px; margin:0 auto; padding:24px 16px 64px; }
|
||
header { display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:12px; margin-bottom:20px; }
|
||
h1 { font-size:1.5rem; margin:0; }
|
||
.sub { color:var(--muted); font-size:.85rem; }
|
||
.bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
|
||
.theme { display:inline-flex; border:1px solid var(--line); border-radius:99px; padding:2px; background:var(--card); }
|
||
.theme button { font:inherit; font-size:.8rem; border:0; background:transparent; color:var(--muted); border-radius:99px; padding:4px 12px; cursor:pointer; }
|
||
.theme button[aria-pressed="true"] { background:var(--text); color:var(--bg); }
|
||
.logout { margin:0; }
|
||
.logout button { font:inherit; font-size:.8rem; border:1px solid var(--line); background:var(--card); color:var(--text); border-radius:99px; padding:5px 14px; cursor:pointer; }
|
||
.logout button:hover { border-color:var(--muted); }
|
||
button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
||
@media (max-width: 600px) { .bar { justify-content:flex-start; } #year { text-align:left !important; } }
|
||
</style>
|
||
<link rel="stylesheet" href="/buttons.css">
|
||
</head>
|
||
<body>
|
||
<main>
|
||
<header>
|
||
<div>
|
||
<h1>我的範圍</h1>
|
||
<div class="sub" id="who">讀取中…</div>
|
||
</div>
|
||
<div>
|
||
<div class="bar">
|
||
<div class="theme" role="group" aria-label="配色">
|
||
<button type="button" data-theme-set="light">日間</button>
|
||
<button type="button" data-theme-set="dark">夜間</button>
|
||
</div>
|
||
<div data-pmb-switches="theme" style="display:contents;"></div>
|
||
<form class="logout" method="post" action="/api/auth/company-logout">
|
||
<button type="submit" title="同時登出 MoonShine 公司帳號">登出</button>
|
||
</form>
|
||
</div>
|
||
<div class="sub" id="year" style="text-align:right;margin-top:6px;"></div>
|
||
</div>
|
||
</header>
|
||
<div id="content" aria-live="polite"></div>
|
||
<p class="sub">實際 CODA:即時計算,資料一變就跟著變,定價看「平均日 CODA」。定錨 CODA:半年的目標(1 月、7 月定錨),半年內只增不減。所有數字都由伺服器計算。</p>
|
||
</main>
|
||
<script src="/scope-ui.js"></script>
|
||
<script>
|
||
function syncTheme() {
|
||
const theme = document.documentElement.getAttribute('data-theme');
|
||
document.querySelectorAll('[data-theme-set]').forEach(b => b.setAttribute('aria-pressed', String(b.dataset.themeSet === theme)));
|
||
}
|
||
document.querySelectorAll('[data-theme-set]').forEach(b => b.addEventListener('click', () => {
|
||
document.documentElement.setAttribute('data-theme', b.dataset.themeSet);
|
||
try { localStorage.setItem('pmb-theme', b.dataset.themeSet); } catch (e) {}
|
||
syncTheme();
|
||
}));
|
||
syncTheme();
|
||
let myName = '';
|
||
fetch('/api/auth/me', { cache: 'no-store' }).then(r => (r.ok ? r.json() : null)).then(me => {
|
||
if (me?.name) { myName = me.name; const who = document.getElementById('who'); if (!who.textContent.startsWith(myName)) who.textContent = `${myName} ${who.textContent}`; }
|
||
}).catch(() => {});
|
||
PMScope.mount(document.getElementById('content'), { mode: 'page', onMeta(data, error) {
|
||
const prefix = myName ? `${myName} ` : '';
|
||
if (!data) { document.getElementById('who').textContent = prefix + (error?.employeeNumber ? `工號 ${error.employeeNumber}` : ''); return; }
|
||
document.getElementById('who').textContent = `${prefix}工號 ${data.me.employeeNumber} 權限來源:${data.me.sources.join(';') || '—'}`;
|
||
document.getElementById('year').textContent = `${data.year} 年${data.anchor ? ` 目前 ${data.anchor.half} 定錨` : ' 尚未定錨'}`;
|
||
} });
|
||
</script>
|
||
</body>
|
||
</html>
|