upload to gitea
No files matched your search
@@ -0,0 +1,672 @@
|
||||
// My INMU 前端:純 JS,沒有框架
|
||||
const LANGS = ["zh-TW", "zh-CN", "ja", "ko", "en"];
|
||||
const HTML_LANG = { "zh-TW": "zh-Hant-TW", "zh-CN": "zh-Hans-CN", ja: "ja", ko: "ko", en: "en" };
|
||||
const DEFAULT_AVATAR = "/assets/avatar.svg";
|
||||
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const SITE_TITLE = document.title; // 伺服器會依 BETA 開關加上 (Beta)
|
||||
// 伺服器填入的檔案版本,語言檔網址也帶上,改版後不會拿到快取的舊檔
|
||||
const ASSET_V = document.querySelector('meta[name="asset-version"]')?.content || "";
|
||||
const FACE = [0, 1].map((n) => `/assets/media/checkin-${n}.webp?v=${ASSET_V}`);
|
||||
const SFX_MAX_MS = 1600; // 音效約 1.5 秒;ended 沒觸發(例如播放失敗)時的保險時間
|
||||
const SUBMIT_MAX_BYTES = 5 * 1024 * 1024;
|
||||
|
||||
const state = {
|
||||
lang: "zh-TW",
|
||||
dict: {},
|
||||
me: null,
|
||||
today: null,
|
||||
email: "",
|
||||
cardBust: Date.now(),
|
||||
resendTimer: null,
|
||||
resetTimer: null,
|
||||
};
|
||||
|
||||
// ---------- i18n ----------
|
||||
|
||||
function detectLang() {
|
||||
const saved = localStorage.getItem("lang");
|
||||
if (LANGS.includes(saved)) return saved;
|
||||
for (const raw of navigator.languages || [navigator.language || ""]) {
|
||||
const l = raw.toLowerCase();
|
||||
if (/^zh-(tw|hk|mo|hant)/.test(l)) return "zh-TW";
|
||||
if (l.startsWith("zh")) return "zh-CN";
|
||||
if (l.startsWith("ja")) return "ja";
|
||||
if (l.startsWith("ko")) return "ko";
|
||||
if (l.startsWith("en")) return "en";
|
||||
}
|
||||
return "en";
|
||||
}
|
||||
|
||||
async function loadLang(lang) {
|
||||
const res = await fetch(`/assets/i18n/${lang}.json?v=${ASSET_V}`);
|
||||
state.dict = await res.json();
|
||||
state.lang = lang;
|
||||
localStorage.setItem("lang", lang);
|
||||
document.documentElement.lang = HTML_LANG[lang];
|
||||
$("lang").value = lang;
|
||||
document.querySelectorAll("[data-i18n]").forEach((el) => { el.textContent = t(el.dataset.i18n); });
|
||||
document.querySelectorAll("[data-i18n-aria]").forEach((el) => {
|
||||
el.setAttribute("aria-label", t(el.dataset.i18nAria));
|
||||
});
|
||||
}
|
||||
|
||||
function t(key, vars = {}) {
|
||||
let s = state.dict[key] ?? key;
|
||||
for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, v);
|
||||
return s;
|
||||
}
|
||||
|
||||
// ---------- API ----------
|
||||
|
||||
class ApiError extends Error {
|
||||
constructor(code, status) { super(code); this.code = code; this.status = status; }
|
||||
}
|
||||
|
||||
async function api(method, path, body) {
|
||||
const opt = { method, headers: { "X-INMU": "1" }, credentials: "same-origin" };
|
||||
if (body instanceof FormData) {
|
||||
opt.body = body;
|
||||
} else if (body !== undefined) {
|
||||
opt.headers["Content-Type"] = "application/json";
|
||||
opt.body = JSON.stringify(body);
|
||||
}
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(path, opt);
|
||||
} catch {
|
||||
throw new ApiError("network", 0);
|
||||
}
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new ApiError(typeof data.detail === "string" ? data.detail : "unknown", res.status);
|
||||
return data;
|
||||
}
|
||||
|
||||
function errText(e) {
|
||||
const key = `err.${e?.code || "unknown"}`;
|
||||
return key in state.dict ? t(key) : t("err.unknown");
|
||||
}
|
||||
|
||||
function showError(el, e) {
|
||||
if (e) { el.textContent = errText(e); el.hidden = false; } else { el.hidden = true; }
|
||||
}
|
||||
|
||||
function toast(msg) {
|
||||
const el = $("toast");
|
||||
el.textContent = msg;
|
||||
el.hidden = false;
|
||||
clearTimeout(toast.timer);
|
||||
toast.timer = setTimeout(() => { el.hidden = true; }, 2500);
|
||||
}
|
||||
|
||||
// ---------- 側邊欄:登入 / 個人資訊 ----------
|
||||
|
||||
// 特殊序號(管理員、含 114514 / 1919810)用背景色標示,顏色在 style.css 的 .uid.tier-*
|
||||
function showUid(el, user) {
|
||||
el.textContent = `UID ${user.uid_str}`;
|
||||
el.className = user.uid_tier ? `uid tier-${user.uid_tier}` : "uid";
|
||||
}
|
||||
|
||||
function renderSidebar() {
|
||||
const me = state.me;
|
||||
$("auth-box").hidden = !!me;
|
||||
$("me-box").hidden = !me;
|
||||
if (!me) return;
|
||||
$("me-avatar").src = me.avatar_url || DEFAULT_AVATAR;
|
||||
$("me-name").textContent = me.display_name;
|
||||
showUid($("me-uid"), me);
|
||||
$("me-link").href = `/u/${me.uid_str}`;
|
||||
$("review-link").hidden = !me.is_admin;
|
||||
if (me.is_admin) $("review-link").textContent = t("nav.review", { n: me.pending_reviews ?? 0 });
|
||||
}
|
||||
|
||||
function showCodeStep(show) {
|
||||
$("email-form").hidden = show;
|
||||
$("code-form").hidden = !show;
|
||||
showError($("auth-error"), null);
|
||||
if (show) {
|
||||
$("code-sent-msg").textContent = t("auth.sent", { email: state.email });
|
||||
$("code").value = "";
|
||||
$("code").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function startResendCountdown(seconds) {
|
||||
clearInterval(state.resendTimer);
|
||||
const btn = $("resend");
|
||||
let left = seconds;
|
||||
const tick = () => {
|
||||
btn.disabled = left > 0;
|
||||
btn.textContent = left > 0 ? t("auth.resend_wait", { s: left }) : t("auth.resend");
|
||||
if (left-- <= 0) clearInterval(state.resendTimer);
|
||||
};
|
||||
tick();
|
||||
state.resendTimer = setInterval(tick, 1000);
|
||||
}
|
||||
|
||||
async function sendCode() {
|
||||
const r = await api("POST", "/api/auth/request-code", { email: state.email, lang: state.lang });
|
||||
showCodeStep(true);
|
||||
startResendCountdown(r.resend_in);
|
||||
}
|
||||
|
||||
async function withBusy(button, fn) {
|
||||
button.disabled = true;
|
||||
try { await fn(); } finally { button.disabled = false; }
|
||||
}
|
||||
|
||||
function bindAuth() {
|
||||
$("email-form").addEventListener("submit", (ev) => {
|
||||
ev.preventDefault();
|
||||
state.email = $("email").value.trim();
|
||||
withBusy(ev.submitter || $("email-form").querySelector("button"), async () => {
|
||||
try { await sendCode(); } catch (e) { showError($("auth-error"), e); }
|
||||
});
|
||||
});
|
||||
|
||||
$("code-form").addEventListener("submit", (ev) => {
|
||||
ev.preventDefault();
|
||||
const code = $("code").value.replace(/\D/g, "");
|
||||
withBusy(ev.submitter || $("code-form").querySelector("button[type=submit]"), async () => {
|
||||
try {
|
||||
const r = await api("POST", "/api/auth/verify", { email: state.email, code, lang: state.lang });
|
||||
state.me = r.user;
|
||||
clearInterval(state.resendTimer);
|
||||
showCodeStep(false);
|
||||
$("email").value = "";
|
||||
if (r.user.lang !== state.lang) await loadLang(r.user.lang);
|
||||
renderSidebar();
|
||||
closeMenu();
|
||||
await route();
|
||||
} catch (e) {
|
||||
showError($("auth-error"), e);
|
||||
if (e.code === "expired" || e.code === "not_requested") $("code").value = "";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("resend").addEventListener("click", async () => {
|
||||
try { await sendCode(); } catch (e) { showError($("auth-error"), e); }
|
||||
});
|
||||
|
||||
$("change-email").addEventListener("click", () => {
|
||||
clearInterval(state.resendTimer);
|
||||
showCodeStep(false);
|
||||
$("email").focus();
|
||||
});
|
||||
|
||||
$("logout").addEventListener("click", async () => {
|
||||
try { await api("POST", "/api/auth/logout"); } catch { /* 已經登出也沒關係 */ }
|
||||
state.me = null;
|
||||
state.today = null;
|
||||
renderSidebar();
|
||||
await route();
|
||||
});
|
||||
|
||||
$("guest-login").addEventListener("click", () => {
|
||||
openMenu();
|
||||
$("email").focus();
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 簽到 ----------
|
||||
|
||||
function showCheckinPart(part) {
|
||||
for (const id of ["checkin-guest", "checkin-ready", "checkin-done"]) $(id).hidden = id !== part;
|
||||
}
|
||||
|
||||
function statsText(d) {
|
||||
return `${t("checkin.total", { n: d.total_days })} · ${t("checkin.streak", { n: d.streak })}`;
|
||||
}
|
||||
|
||||
function renderToday(justChecked) {
|
||||
const d = state.today;
|
||||
if (!d.checked_in) {
|
||||
$("checkin-face").src = FACE[0];
|
||||
$("checkin-btn").classList.remove("pressed");
|
||||
showCheckinPart("checkin-ready");
|
||||
$("ready-stats").textContent = d.total_days ? statsText(d) : "";
|
||||
} else {
|
||||
showCheckinPart("checkin-done");
|
||||
$("checkin-msg").textContent = justChecked ? t("checkin.success") : t("checkin.done_today");
|
||||
const src = `${d.card_url}?v=${state.cardBust}`;
|
||||
if ($("card-img").getAttribute("src") !== src) $("card-img").src = src;
|
||||
$("download-btn").href = src;
|
||||
$("download-btn").setAttribute("download", `inmu-${d.day}.png`);
|
||||
$("done-stats").textContent = statsText(d);
|
||||
}
|
||||
startResetCountdown();
|
||||
}
|
||||
|
||||
function fmtDuration(ms) {
|
||||
const s = Math.max(0, Math.floor(ms / 1000));
|
||||
const pad = (n) => String(n).padStart(2, "0");
|
||||
return `${pad(Math.floor(s / 3600))}:${pad(Math.floor((s % 3600) / 60))}:${pad(s % 60)}`;
|
||||
}
|
||||
|
||||
function startResetCountdown() {
|
||||
clearInterval(state.resetTimer);
|
||||
const el = $("next-reset");
|
||||
if (!state.today) { el.hidden = true; return; }
|
||||
const target = Date.parse(state.today.next_reset);
|
||||
// 伺服器以台灣時間 04:00 換日,這裡換算成裝置的當地時間顯示
|
||||
const when = new Intl.DateTimeFormat(HTML_LANG[state.lang], {
|
||||
month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", hourCycle: "h23",
|
||||
}).format(new Date(target));
|
||||
el.hidden = false;
|
||||
const tick = async () => {
|
||||
const left = target - Date.now();
|
||||
el.textContent = t("checkin.next", { time: when, t: fmtDuration(left) });
|
||||
if (left <= 0) {
|
||||
clearInterval(state.resetTimer);
|
||||
await refreshToday(); // 換日了
|
||||
}
|
||||
};
|
||||
tick();
|
||||
state.resetTimer = setInterval(tick, 1000);
|
||||
}
|
||||
|
||||
async function refreshToday() {
|
||||
try {
|
||||
state.today = await api("GET", "/api/checkin/today");
|
||||
renderToday(false);
|
||||
} catch (e) {
|
||||
if (e.status === 401) { state.me = null; renderSidebar(); showGuest(); } else toast(errText(e));
|
||||
}
|
||||
}
|
||||
|
||||
function showGuest() {
|
||||
clearInterval(state.resetTimer);
|
||||
$("next-reset").hidden = true;
|
||||
showCheckinPart("checkin-guest");
|
||||
}
|
||||
|
||||
async function showCheckin() {
|
||||
showView("view-checkin");
|
||||
if (!state.me) return showGuest();
|
||||
await refreshToday();
|
||||
}
|
||||
|
||||
async function shareCard() {
|
||||
const d = state.today;
|
||||
const text = `${d.share_text} ${d.share_url}`;
|
||||
try {
|
||||
const blob = await fetch($("card-img").src).then((r) => r.blob());
|
||||
const file = new File([blob], `inmu-${d.day}.png`, { type: "image/png" });
|
||||
if (navigator.canShare && navigator.canShare({ files: [file] })) {
|
||||
await navigator.share({ files: [file], text });
|
||||
return;
|
||||
}
|
||||
if (navigator.share) {
|
||||
await navigator.share({ text: d.share_text, url: d.share_url });
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.name === "AbortError") return; // 使用者自己取消
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
toast(t("share.copied"));
|
||||
} catch {
|
||||
window.prompt("", text);
|
||||
}
|
||||
}
|
||||
|
||||
// 按下簽到時從按鈕中心噴出粒子(顏色對應主色與 UID 的三種顏色,夾幾個「1」呼應 0 → 1)
|
||||
function burst(el) {
|
||||
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
||||
const r = el.getBoundingClientRect();
|
||||
const cx = r.left + r.width / 2;
|
||||
const cy = r.top + r.height / 2;
|
||||
const colors = ["#f0a43a", "#f5c518", "#2f7beb", "#f07c2a", "#ffffff"];
|
||||
const count = 28;
|
||||
for (let i = 0; i < count; i++) {
|
||||
const p = document.createElement("span");
|
||||
const digit = i % 6 === 0;
|
||||
p.className = digit ? "particle digit" : "particle";
|
||||
if (digit) p.textContent = "1";
|
||||
const angle = (i / count) * Math.PI * 2 + Math.random() * 0.5;
|
||||
const dist = r.width * 0.55 + Math.random() * r.width * 0.7;
|
||||
const size = digit ? 18 + Math.random() * 14 : 6 + Math.random() * 8;
|
||||
p.style.cssText = [
|
||||
`--x:${cx}px`, `--y:${cy}px`,
|
||||
`--dx:${(Math.cos(angle) * dist).toFixed(1)}px`, `--dy:${(Math.sin(angle) * dist).toFixed(1)}px`,
|
||||
`--s:${size.toFixed(1)}px`, `--c:${colors[i % colors.length]}`,
|
||||
`--r:${Math.round(Math.random() * 360 - 180)}deg`, `--d:${(0.7 + Math.random() * 0.4).toFixed(2)}s`,
|
||||
].join(";");
|
||||
p.addEventListener("animationend", () => p.remove());
|
||||
document.body.appendChild(p);
|
||||
}
|
||||
}
|
||||
|
||||
// 等音效播完(或保險時間到)
|
||||
function waitSfx(sfx) {
|
||||
return new Promise((resolve) => {
|
||||
const done = () => { clearTimeout(timer); sfx.removeEventListener("ended", done); resolve(); };
|
||||
const timer = setTimeout(done, SFX_MAX_MS);
|
||||
sfx.addEventListener("ended", done);
|
||||
});
|
||||
}
|
||||
|
||||
// 先把小卡下載好,切換畫面時才不會看到空白
|
||||
function preloadImage(src, maxMs = 6000) {
|
||||
return new Promise((resolve) => {
|
||||
const img = new Image();
|
||||
const timer = setTimeout(resolve, maxMs);
|
||||
img.onload = img.onerror = () => { clearTimeout(timer); resolve(); };
|
||||
img.src = src;
|
||||
});
|
||||
}
|
||||
|
||||
function bindCheckin() {
|
||||
const btn = $("checkin-btn");
|
||||
const sfx = $("checkin-sfx");
|
||||
btn.addEventListener("click", () => withBusy(btn, async () => {
|
||||
// 0 → 1、播音效、噴粒子,同時送出簽到;音效播完而且小卡下載好才亮出小卡,並關掉音效
|
||||
$("checkin-face").src = FACE[1];
|
||||
btn.classList.remove("pressed");
|
||||
void btn.offsetWidth; // 重新觸發動畫
|
||||
btn.classList.add("pressed");
|
||||
sfx.currentTime = 0;
|
||||
sfx.play().catch(() => { /* 不能播就算了 */ });
|
||||
burst(btn);
|
||||
const sfxDone = waitSfx(sfx);
|
||||
try {
|
||||
const today = await api("POST", "/api/checkin");
|
||||
await Promise.all([sfxDone, today.card_url ? preloadImage(`${today.card_url}?v=${state.cardBust}`) : null]);
|
||||
sfx.pause();
|
||||
state.today = today;
|
||||
renderToday(!today.already);
|
||||
loadMe(); // 更新側欄的天數
|
||||
} catch (e) {
|
||||
sfx.pause();
|
||||
$("checkin-face").src = FACE[0];
|
||||
btn.classList.remove("pressed");
|
||||
toast(errText(e));
|
||||
}
|
||||
}));
|
||||
$("share-btn").addEventListener("click", shareCard);
|
||||
}
|
||||
|
||||
// ---------- 畫面切換 ----------
|
||||
|
||||
function showView(id) {
|
||||
for (const v of ["view-checkin", "view-user", "view-upload", "view-review"]) $(v).hidden = v !== id;
|
||||
if (id !== "view-checkin") clearInterval(state.resetTimer);
|
||||
}
|
||||
|
||||
// ---------- 投稿迷因圖 ----------
|
||||
|
||||
function renderUploads(r) {
|
||||
$("upload-quota").textContent = t("upload.remaining", { n: r.remaining, max: r.limit });
|
||||
$("upload-pick").classList.toggle("busy", r.remaining <= 0);
|
||||
const list = $("upload-list");
|
||||
list.replaceChildren();
|
||||
$("upload-empty").hidden = r.items.length > 0;
|
||||
for (const it of r.items) {
|
||||
const box = document.createElement("div");
|
||||
box.className = "sub-item";
|
||||
if (it.image_url) {
|
||||
const img = document.createElement("img");
|
||||
img.src = it.image_url;
|
||||
img.alt = "";
|
||||
img.loading = "lazy";
|
||||
box.append(img);
|
||||
}
|
||||
const badge = document.createElement("span");
|
||||
badge.className = `sub-status ${it.status}`;
|
||||
badge.textContent = t(`upload.status.${it.status}`);
|
||||
box.append(badge);
|
||||
list.append(box);
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshUploads() {
|
||||
try {
|
||||
renderUploads(await api("GET", "/api/submissions"));
|
||||
} catch (e) {
|
||||
showError($("upload-error"), e);
|
||||
$("upload-pick").classList.remove("busy");
|
||||
}
|
||||
}
|
||||
|
||||
async function showUpload() {
|
||||
showView("view-upload");
|
||||
document.title = `${t("nav.upload")} · ${SITE_TITLE}`;
|
||||
showError($("upload-error"), null);
|
||||
if (!state.me) { location.replace("/"); return; }
|
||||
await refreshUploads();
|
||||
}
|
||||
|
||||
function bindUpload() {
|
||||
$("upload-file").addEventListener("change", async (ev) => {
|
||||
const files = [...ev.target.files];
|
||||
ev.target.value = "";
|
||||
if (!files.length) return;
|
||||
$("upload-pick").classList.add("busy");
|
||||
showError($("upload-error"), null);
|
||||
let ok = 0;
|
||||
for (const file of files) { // 一張一張傳,額度用完就停
|
||||
if (file.size > SUBMIT_MAX_BYTES) { showError($("upload-error"), { code: "file_too_large" }); continue; }
|
||||
const fd = new FormData();
|
||||
fd.append("file", file);
|
||||
try {
|
||||
await api("POST", "/api/submissions", fd);
|
||||
ok++;
|
||||
} catch (e) {
|
||||
showError($("upload-error"), e);
|
||||
if (e.code === "quota_exceeded") break;
|
||||
}
|
||||
}
|
||||
if (ok) toast(t("upload.done", { n: ok }));
|
||||
await refreshUploads();
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 管理員審核(一張一張) ----------
|
||||
|
||||
async function loadReview() {
|
||||
try {
|
||||
const r = await api("GET", "/api/admin/submissions");
|
||||
$("review-left").textContent = t("review.left", { n: r.pending });
|
||||
state.me.pending_reviews = r.pending;
|
||||
renderSidebar();
|
||||
const it = r.item;
|
||||
$("review-item").hidden = !it;
|
||||
$("review-empty").hidden = !!it;
|
||||
if (!it) return;
|
||||
$("review-item").dataset.id = it.id;
|
||||
$("review-img").src = it.image_url;
|
||||
$("review-name").textContent = it.uploader.display_name;
|
||||
$("review-name").href = `/u/${it.uploader.uid_str}`;
|
||||
showUid($("review-uid"), it.uploader);
|
||||
$("review-time").textContent = new Date(it.created_at).toLocaleString(HTML_LANG[state.lang]);
|
||||
} catch (e) {
|
||||
if (e.status === 401 || e.status === 403) { location.replace("/"); return; }
|
||||
toast(errText(e));
|
||||
}
|
||||
}
|
||||
|
||||
async function showReview() {
|
||||
showView("view-review");
|
||||
document.title = `${t("review.heading")} · ${SITE_TITLE}`;
|
||||
if (!state.me?.is_admin) { location.replace("/"); return; }
|
||||
await loadReview();
|
||||
}
|
||||
|
||||
function bindReview() {
|
||||
const buttons = [$("review-approve"), $("review-reject")];
|
||||
const decide = async (action) => {
|
||||
const sid = $("review-item").dataset.id;
|
||||
buttons.forEach((b) => { b.disabled = true; });
|
||||
try {
|
||||
await api("POST", `/api/admin/submissions/${sid}/${action}`);
|
||||
toast(t(`review.${action}d`));
|
||||
} catch (e) {
|
||||
// 已經審過(例如另一個分頁)就直接跳下一張
|
||||
if (e.code !== "already_reviewed" && e.code !== "not_found") toast(errText(e));
|
||||
} finally {
|
||||
buttons.forEach((b) => { b.disabled = false; });
|
||||
}
|
||||
await loadReview();
|
||||
};
|
||||
$("review-approve").addEventListener("click", () => decide("approve"));
|
||||
$("review-reject").addEventListener("click", () => decide("reject"));
|
||||
}
|
||||
|
||||
// ---------- 個人頁 ----------
|
||||
|
||||
async function showUser(uid) {
|
||||
showView("view-user");
|
||||
try {
|
||||
const u = await api("GET", `/api/users/${uid}?lang=${state.lang}`);
|
||||
$("user-card").hidden = false;
|
||||
$("user-missing").hidden = true;
|
||||
$("user-avatar").src = u.avatar_url || DEFAULT_AVATAR;
|
||||
$("user-name").textContent = u.display_name;
|
||||
showUid($("user-uid"), u);
|
||||
$("user-stats").textContent = statsText(u);
|
||||
const bio = $("user-bio");
|
||||
if (u.bio_md.trim()) {
|
||||
bio.innerHTML = u.bio_html; // 伺服器端已關閉原始 HTML
|
||||
bio.classList.remove("empty");
|
||||
} else {
|
||||
bio.textContent = t("user.no_bio");
|
||||
bio.classList.add("empty");
|
||||
}
|
||||
const joined = new Date(u.created_at).toLocaleDateString(HTML_LANG[state.lang]);
|
||||
$("user-joined").textContent = t("user.joined", { d: joined });
|
||||
document.title = `${u.display_name} · ${SITE_TITLE}`;
|
||||
} catch {
|
||||
$("user-card").hidden = true;
|
||||
$("user-missing").hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 編輯個人資料 ----------
|
||||
|
||||
function bindProfile() {
|
||||
const dialog = $("profile-dialog");
|
||||
|
||||
$("edit-profile").addEventListener("click", () => {
|
||||
const me = state.me;
|
||||
$("edit-avatar").src = me.avatar_url || DEFAULT_AVATAR;
|
||||
$("edit-name").value = me.display_name;
|
||||
$("edit-bio").value = me.bio_md;
|
||||
setPreview(false);
|
||||
showError($("profile-error"), null);
|
||||
closeMenu();
|
||||
dialog.showModal();
|
||||
});
|
||||
|
||||
$("profile-cancel").addEventListener("click", () => dialog.close());
|
||||
|
||||
$("avatar-file").addEventListener("change", async (ev) => {
|
||||
const file = ev.target.files[0];
|
||||
ev.target.value = "";
|
||||
if (!file) return;
|
||||
if (file.size > 5 * 1024 * 1024) return showError($("profile-error"), { code: "file_too_large" });
|
||||
const fd = new FormData();
|
||||
fd.append("file", file);
|
||||
try {
|
||||
state.me = await api("PUT", "/api/me/avatar", fd);
|
||||
state.cardBust = Date.now();
|
||||
$("edit-avatar").src = state.me.avatar_url;
|
||||
showError($("profile-error"), null);
|
||||
renderSidebar();
|
||||
} catch (e) {
|
||||
showError($("profile-error"), e);
|
||||
}
|
||||
});
|
||||
|
||||
$("preview-toggle").addEventListener("click", async () => {
|
||||
if (!$("edit-preview").hidden) return setPreview(false);
|
||||
try {
|
||||
const r = await api("POST", "/api/markdown", { md: $("edit-bio").value });
|
||||
$("edit-preview").innerHTML = r.html;
|
||||
setPreview(true);
|
||||
} catch (e) {
|
||||
showError($("profile-error"), e);
|
||||
}
|
||||
});
|
||||
|
||||
$("profile-form").addEventListener("submit", (ev) => {
|
||||
ev.preventDefault();
|
||||
withBusy($("profile-save"), async () => {
|
||||
try {
|
||||
state.me = await api("PATCH", "/api/me", {
|
||||
display_name: $("edit-name").value,
|
||||
bio_md: $("edit-bio").value,
|
||||
});
|
||||
state.cardBust = Date.now();
|
||||
dialog.close();
|
||||
toast(t("profile.saved"));
|
||||
renderSidebar();
|
||||
await route();
|
||||
} catch (e) {
|
||||
showError($("profile-error"), e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setPreview(on) {
|
||||
$("edit-preview").hidden = !on;
|
||||
$("edit-bio").hidden = on;
|
||||
$("preview-toggle").textContent = on ? t("profile.edit_back") : t("profile.preview");
|
||||
}
|
||||
|
||||
// ---------- 手機選單 ----------
|
||||
|
||||
function openMenu() { $("sidebar").classList.add("open"); }
|
||||
function closeMenu() { $("sidebar").classList.remove("open"); }
|
||||
|
||||
// ---------- 啟動 ----------
|
||||
|
||||
async function loadMe() {
|
||||
try {
|
||||
state.me = await api("GET", "/api/me");
|
||||
} catch {
|
||||
state.me = null;
|
||||
}
|
||||
renderSidebar();
|
||||
}
|
||||
|
||||
async function route() {
|
||||
document.title = SITE_TITLE;
|
||||
const m = location.pathname.match(/^\/u\/(\d+)$/);
|
||||
if (m) return showUser(m[1]);
|
||||
if (location.pathname === "/upload") return showUpload();
|
||||
if (location.pathname === "/review") return showReview();
|
||||
return showCheckin();
|
||||
}
|
||||
|
||||
async function init() {
|
||||
await loadLang(detectLang());
|
||||
bindAuth();
|
||||
bindCheckin();
|
||||
bindProfile();
|
||||
bindUpload();
|
||||
bindReview();
|
||||
|
||||
$("menu-toggle").addEventListener("click", () => $("sidebar").classList.toggle("open"));
|
||||
|
||||
$("lang").addEventListener("change", async (ev) => {
|
||||
await loadLang(ev.target.value);
|
||||
if (state.me) {
|
||||
try {
|
||||
// 語言也會用在信件、小卡與分享文字,所以同步到伺服器
|
||||
state.me = await api("PATCH", "/api/me", { lang: state.lang });
|
||||
state.cardBust = Date.now();
|
||||
} catch { /* 介面已經切換,伺服器同步失敗就算了 */ }
|
||||
}
|
||||
renderSidebar();
|
||||
if (!$("code-form").hidden) $("code-sent-msg").textContent = t("auth.sent", { email: state.email });
|
||||
await route();
|
||||
});
|
||||
|
||||
await loadMe();
|
||||
await route();
|
||||
}
|
||||
|
||||
init();
|
||||
|
After Width: | Height: | Size: 40 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="#3a3448"/><circle cx="32" cy="25" r="12" fill="#8a82a0"/><path d="M10 60c2-13 11-20 22-20s20 7 22 20z" fill="#8a82a0"/></svg>
|
||||
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"lang.label": "Language",
|
||||
"menu": "Menu",
|
||||
"auth.heading": "Log in / Sign up",
|
||||
"auth.hint": "We'll email you a code. Your account is created the first time you log in.",
|
||||
"auth.email": "Email",
|
||||
"auth.send": "Send code",
|
||||
"auth.sent": "We sent a code to {email}. It expires in 5 minutes.",
|
||||
"auth.code": "6-digit code",
|
||||
"auth.verify": "Log in",
|
||||
"auth.resend": "Resend",
|
||||
"auth.resend_wait": "Resend in {s}s",
|
||||
"auth.change_email": "Use a different email",
|
||||
"auth.logout": "Log out",
|
||||
"profile.view": "My profile",
|
||||
"profile.edit": "Edit profile",
|
||||
"profile.avatar": "Avatar",
|
||||
"profile.avatar_hint": "Cropped to a 1024×1024 square, up to 5 MB",
|
||||
"profile.avatar_change": "Change avatar",
|
||||
"profile.name": "Name",
|
||||
"profile.bio": "About me (Markdown supported)",
|
||||
"profile.preview": "Preview",
|
||||
"profile.edit_back": "Keep editing",
|
||||
"profile.save": "Save",
|
||||
"profile.cancel": "Cancel",
|
||||
"profile.saved": "Saved",
|
||||
"checkin.button": "Check in",
|
||||
"checkin.login_first": "Log in to check in once a day and get an INMU card.",
|
||||
"checkin.ready": "You haven't checked in today",
|
||||
"checkin.success": "Checked in!",
|
||||
"checkin.done_today": "You've already checked in today",
|
||||
"checkin.total": "{n} days total",
|
||||
"checkin.streak": "{n}-day streak",
|
||||
"checkin.next": "Next check-in: {time} (in {t})",
|
||||
"share.button": "Share",
|
||||
"share.download": "Download image",
|
||||
"share.copied": "Copied the share text and link",
|
||||
"user.joined": "Joined {d}",
|
||||
"user.not_found": "User not found",
|
||||
"user.back": "Back to home",
|
||||
"user.no_bio": "No bio yet.",
|
||||
"err.invalid_email": "That email address doesn't look right",
|
||||
"err.too_many_requests": "Too many requests. Please try again later",
|
||||
"err.send_failed": "Couldn't send the email. Please try again later",
|
||||
"err.not_requested": "Send a code first",
|
||||
"err.expired": "This code has expired. Send a new one",
|
||||
"err.wrong_code": "Wrong code",
|
||||
"err.unauthorized": "Please log in",
|
||||
"err.name_invalid": "Names must be 1–32 characters",
|
||||
"err.bio_too_long": "Your bio can be up to 2000 characters",
|
||||
"err.file_too_large": "File too large (5 MB max)",
|
||||
"err.invalid_image": "Couldn't read that image",
|
||||
"err.network": "Connection failed",
|
||||
"err.unknown": "Something went wrong",
|
||||
"err.code_used": "This code has already been used. Please get a new code in a moment",
|
||||
"nav.upload": "Submit images",
|
||||
"nav.review": "Review submissions ({n})",
|
||||
"upload.heading": "Submit images",
|
||||
"upload.hint": "Upload images you think belong on an INMU card. Approved images join the draw. Up to 5 per day (resets at 04:00 Taiwan time), 5MB each.",
|
||||
"upload.choose": "Choose images",
|
||||
"upload.remaining": "{n} / {max} uploads left today",
|
||||
"upload.done": "Uploaded {n}, waiting for review",
|
||||
"upload.mine": "My submissions",
|
||||
"upload.empty": "No submissions yet.",
|
||||
"upload.status.pending": "Pending",
|
||||
"upload.status.approved": "Added",
|
||||
"upload.status.rejected": "Not accepted",
|
||||
"review.heading": "Review submissions",
|
||||
"review.left": "{n} waiting",
|
||||
"review.approve": "Approve",
|
||||
"review.reject": "Reject",
|
||||
"review.approved": "Approved and added to the draw",
|
||||
"review.rejected": "Rejected",
|
||||
"review.empty": "Nothing to review right now",
|
||||
"err.quota_exceeded": "You've used today's uploads. Come back tomorrow",
|
||||
"err.forbidden": "Not allowed",
|
||||
"err.already_reviewed": "This one has already been reviewed",
|
||||
"err.not_found": "Not found"
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"lang.label": "言語",
|
||||
"menu": "メニュー",
|
||||
"auth.heading": "ログイン / 登録",
|
||||
"auth.hint": "メールアドレスに認証コードを送ります。初回ログイン時にアカウントが作成されます。",
|
||||
"auth.email": "メールアドレス",
|
||||
"auth.send": "認証コードを送信",
|
||||
"auth.sent": "{email} に認証コードを送りました(有効期限 5 分)。",
|
||||
"auth.code": "6 桁の認証コード",
|
||||
"auth.verify": "ログイン",
|
||||
"auth.resend": "再送信",
|
||||
"auth.resend_wait": "{s} 秒後に再送信できます",
|
||||
"auth.change_email": "別のメールアドレスを使う",
|
||||
"auth.logout": "ログアウト",
|
||||
"profile.view": "マイページ",
|
||||
"profile.edit": "プロフィール編集",
|
||||
"profile.avatar": "アイコン",
|
||||
"profile.avatar_hint": "1024×1024 の正方形に切り抜きます(最大 5MB)",
|
||||
"profile.avatar_change": "アイコンを変更",
|
||||
"profile.name": "名前",
|
||||
"profile.bio": "自己紹介(Markdown 対応)",
|
||||
"profile.preview": "プレビュー",
|
||||
"profile.edit_back": "編集に戻る",
|
||||
"profile.save": "保存",
|
||||
"profile.cancel": "キャンセル",
|
||||
"profile.saved": "保存しました",
|
||||
"checkin.button": "ログインボーナス",
|
||||
"checkin.login_first": "ログインすると毎日 1 回、INMU カードがもらえます。",
|
||||
"checkin.ready": "今日はまだ受け取っていません",
|
||||
"checkin.success": "受け取りました!",
|
||||
"checkin.done_today": "今日はもう受け取りました",
|
||||
"checkin.total": "累計 {n} 日",
|
||||
"checkin.streak": "連続 {n} 日",
|
||||
"checkin.next": "次回:{time}(あと {t})",
|
||||
"share.button": "シェア",
|
||||
"share.download": "画像を保存",
|
||||
"share.copied": "シェア用のテキストとリンクをコピーしました",
|
||||
"user.joined": "{d} に参加",
|
||||
"user.not_found": "ユーザーが見つかりません",
|
||||
"user.back": "トップへ",
|
||||
"user.no_bio": "自己紹介はまだありません。",
|
||||
"err.invalid_email": "メールアドレスの形式が正しくありません",
|
||||
"err.too_many_requests": "リクエストが多すぎます。しばらくしてからお試しください",
|
||||
"err.send_failed": "メールを送信できませんでした。しばらくしてからお試しください",
|
||||
"err.not_requested": "先に認証コードを送信してください",
|
||||
"err.expired": "認証コードが無効になりました。再送信してください",
|
||||
"err.wrong_code": "認証コードが違います",
|
||||
"err.unauthorized": "ログインしてください",
|
||||
"err.name_invalid": "名前は 1〜32 文字にしてください",
|
||||
"err.bio_too_long": "自己紹介は 2000 文字までです",
|
||||
"err.file_too_large": "ファイルが大きすぎます(最大 5MB)",
|
||||
"err.invalid_image": "この画像は読み込めません",
|
||||
"err.network": "接続できませんでした",
|
||||
"err.unknown": "エラーが発生しました",
|
||||
"err.code_used": "この認証コードは使用済みです。しばらくしてから新しいコードをお使いください",
|
||||
"nav.upload": "画像を投稿",
|
||||
"nav.review": "投稿の審査({n})",
|
||||
"upload.heading": "画像を投稿",
|
||||
"upload.hint": "カードに載せたい画像をアップロードしてください。審査に通るとガチャに追加されます。1日5枚まで(台湾時間 04:00 にリセット)、5MBまで。",
|
||||
"upload.choose": "画像を選ぶ",
|
||||
"upload.remaining": "今日はあと {n} / {max} 枚",
|
||||
"upload.done": "{n} 枚アップロードしました(審査待ち)",
|
||||
"upload.mine": "自分の投稿",
|
||||
"upload.empty": "まだ投稿がありません。",
|
||||
"upload.status.pending": "審査中",
|
||||
"upload.status.approved": "採用",
|
||||
"upload.status.rejected": "不採用",
|
||||
"review.heading": "投稿の審査",
|
||||
"review.left": "審査待ち {n} 枚",
|
||||
"review.approve": "採用",
|
||||
"review.reject": "却下",
|
||||
"review.approved": "採用しました",
|
||||
"review.rejected": "却下しました",
|
||||
"review.empty": "審査待ちの投稿はありません",
|
||||
"err.quota_exceeded": "今日の投稿枠を使い切りました。また明日どうぞ",
|
||||
"err.forbidden": "権限がありません",
|
||||
"err.already_reviewed": "この投稿はすでに審査済みです",
|
||||
"err.not_found": "見つかりません"
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"lang.label": "언어",
|
||||
"menu": "메뉴",
|
||||
"auth.heading": "로그인 / 가입",
|
||||
"auth.hint": "이메일로 인증 코드를 보내드립니다. 처음 로그인하면 계정이 자동으로 만들어집니다.",
|
||||
"auth.email": "이메일",
|
||||
"auth.send": "인증 코드 보내기",
|
||||
"auth.sent": "{email}(으)로 인증 코드를 보냈습니다. 5분 동안 유효합니다.",
|
||||
"auth.code": "6자리 인증 코드",
|
||||
"auth.verify": "로그인",
|
||||
"auth.resend": "다시 보내기",
|
||||
"auth.resend_wait": "{s}초 후 다시 보낼 수 있습니다",
|
||||
"auth.change_email": "다른 이메일 사용",
|
||||
"auth.logout": "로그아웃",
|
||||
"profile.view": "내 프로필",
|
||||
"profile.edit": "프로필 편집",
|
||||
"profile.avatar": "프로필 사진",
|
||||
"profile.avatar_hint": "1024×1024 정사각형으로 잘립니다 (최대 5MB)",
|
||||
"profile.avatar_change": "사진 변경",
|
||||
"profile.name": "이름",
|
||||
"profile.bio": "자기소개 (Markdown 지원)",
|
||||
"profile.preview": "미리보기",
|
||||
"profile.edit_back": "계속 편집",
|
||||
"profile.save": "저장",
|
||||
"profile.cancel": "취소",
|
||||
"profile.saved": "저장했습니다",
|
||||
"checkin.button": "출석 체크",
|
||||
"checkin.login_first": "로그인하면 하루에 한 번 출석하고 INMU 카드를 받을 수 있습니다.",
|
||||
"checkin.ready": "오늘은 아직 출석하지 않았습니다",
|
||||
"checkin.success": "출석 완료!",
|
||||
"checkin.done_today": "오늘은 이미 출석했습니다",
|
||||
"checkin.total": "누적 {n}일",
|
||||
"checkin.streak": "연속 {n}일",
|
||||
"checkin.next": "다음 출석: {time} ({t} 남음)",
|
||||
"share.button": "공유",
|
||||
"share.download": "이미지 저장",
|
||||
"share.copied": "공유 문구와 링크를 복사했습니다",
|
||||
"user.joined": "{d} 가입",
|
||||
"user.not_found": "사용자를 찾을 수 없습니다",
|
||||
"user.back": "홈으로",
|
||||
"user.no_bio": "아직 자기소개가 없습니다.",
|
||||
"err.invalid_email": "이메일 형식이 올바르지 않습니다",
|
||||
"err.too_many_requests": "요청이 너무 많습니다. 잠시 후 다시 시도해 주세요",
|
||||
"err.send_failed": "메일을 보내지 못했습니다. 잠시 후 다시 시도해 주세요",
|
||||
"err.not_requested": "먼저 인증 코드를 보내 주세요",
|
||||
"err.expired": "인증 코드가 만료되었습니다. 다시 보내 주세요",
|
||||
"err.wrong_code": "인증 코드가 틀렸습니다",
|
||||
"err.unauthorized": "로그인해 주세요",
|
||||
"err.name_invalid": "이름은 1~32자여야 합니다",
|
||||
"err.bio_too_long": "자기소개는 최대 2000자입니다",
|
||||
"err.file_too_large": "파일이 너무 큽니다 (최대 5MB)",
|
||||
"err.invalid_image": "이미지를 읽을 수 없습니다",
|
||||
"err.network": "연결에 실패했습니다",
|
||||
"err.unknown": "오류가 발생했습니다",
|
||||
"err.code_used": "이미 사용한 인증 코드입니다. 잠시 후 새 코드를 사용해 주세요",
|
||||
"nav.upload": "이미지 투고",
|
||||
"nav.review": "투고 심사 ({n})",
|
||||
"upload.heading": "이미지 투고",
|
||||
"upload.hint": "카드에 넣고 싶은 이미지를 올려 주세요. 심사를 통과하면 뽑기에 추가됩니다. 하루 최대 5장(대만 시간 04:00 초기화), 5MB까지.",
|
||||
"upload.choose": "이미지 선택",
|
||||
"upload.remaining": "오늘 {n} / {max}장 더 올릴 수 있어요",
|
||||
"upload.done": "{n}장 업로드했어요 (심사 대기)",
|
||||
"upload.mine": "내 투고",
|
||||
"upload.empty": "아직 투고한 이미지가 없어요.",
|
||||
"upload.status.pending": "심사 중",
|
||||
"upload.status.approved": "채택",
|
||||
"upload.status.rejected": "미채택",
|
||||
"review.heading": "투고 심사",
|
||||
"review.left": "심사 대기 {n}장",
|
||||
"review.approve": "승인",
|
||||
"review.reject": "거절",
|
||||
"review.approved": "승인했어요",
|
||||
"review.rejected": "거절했어요",
|
||||
"review.empty": "심사할 투고가 없어요",
|
||||
"err.quota_exceeded": "오늘 투고 한도를 다 썼어요. 내일 다시 와 주세요",
|
||||
"err.forbidden": "권한이 없어요",
|
||||
"err.already_reviewed": "이미 심사한 투고예요",
|
||||
"err.not_found": "찾을 수 없어요"
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"lang.label": "语言",
|
||||
"menu": "菜单",
|
||||
"auth.heading": "登录 / 注册",
|
||||
"auth.hint": "输入邮箱接收验证码,第一次登录会自动创建账号。",
|
||||
"auth.email": "邮箱",
|
||||
"auth.send": "发送验证码",
|
||||
"auth.sent": "验证码已发送到 {email},5 分钟内有效。",
|
||||
"auth.code": "6 位数验证码",
|
||||
"auth.verify": "登录",
|
||||
"auth.resend": "重新发送",
|
||||
"auth.resend_wait": "{s} 秒后可重发",
|
||||
"auth.change_email": "换一个邮箱",
|
||||
"auth.logout": "退出登录",
|
||||
"profile.view": "我的主页",
|
||||
"profile.edit": "编辑个人资料",
|
||||
"profile.avatar": "头像",
|
||||
"profile.avatar_hint": "会裁成 1024×1024 正方形,上限 5MB",
|
||||
"profile.avatar_change": "更换头像",
|
||||
"profile.name": "名称",
|
||||
"profile.bio": "自我介绍(支持 Markdown)",
|
||||
"profile.preview": "预览",
|
||||
"profile.edit_back": "继续编辑",
|
||||
"profile.save": "保存",
|
||||
"profile.cancel": "取消",
|
||||
"profile.saved": "已保存",
|
||||
"checkin.button": "签到",
|
||||
"checkin.login_first": "登录后每天都能签到一次,拿一张 INMU 小卡。",
|
||||
"checkin.ready": "今天还没签到",
|
||||
"checkin.success": "签到成功!",
|
||||
"checkin.done_today": "今天已经签到了",
|
||||
"checkin.total": "累计 {n} 天",
|
||||
"checkin.streak": "连续 {n} 天",
|
||||
"checkin.next": "下次签到:{time}(还有 {t})",
|
||||
"share.button": "分享",
|
||||
"share.download": "下载图片",
|
||||
"share.copied": "已复制分享文字和链接",
|
||||
"user.joined": "{d} 加入",
|
||||
"user.not_found": "找不到这个用户",
|
||||
"user.back": "回首页",
|
||||
"user.no_bio": "这个人还没写自我介绍。",
|
||||
"err.invalid_email": "邮箱格式不正确",
|
||||
"err.too_many_requests": "请求太频繁,请稍后再试",
|
||||
"err.send_failed": "验证邮件发送失败,请稍后再试",
|
||||
"err.not_requested": "请先发送验证码",
|
||||
"err.expired": "验证码已失效,请重新发送",
|
||||
"err.wrong_code": "验证码错误",
|
||||
"err.unauthorized": "请先登录",
|
||||
"err.name_invalid": "名称需要 1–32 个字",
|
||||
"err.bio_too_long": "自我介绍最多 2000 字",
|
||||
"err.file_too_large": "文件太大(上限 5MB)",
|
||||
"err.invalid_image": "无法读取这张图片",
|
||||
"err.network": "连接失败,请检查网络",
|
||||
"err.unknown": "发生错误,请稍后再试",
|
||||
"err.code_used": "这组验证码已经用过,请稍后获取新的验证码",
|
||||
"nav.upload": "投稿图片",
|
||||
"nav.review": "审核投稿({n})",
|
||||
"upload.heading": "投稿图片",
|
||||
"upload.hint": "上传你觉得适合放上小卡的图,审核通过后就会加入抽卡。每天最多 5 张(台湾时间 04:00 重置),上限 5MB。",
|
||||
"upload.choose": "选择图片",
|
||||
"upload.remaining": "今天还能上传 {n} / {max} 张",
|
||||
"upload.done": "已上传 {n} 张,等待审核",
|
||||
"upload.mine": "我的投稿",
|
||||
"upload.empty": "还没有投稿过。",
|
||||
"upload.status.pending": "审核中",
|
||||
"upload.status.approved": "已加入",
|
||||
"upload.status.rejected": "未通过",
|
||||
"review.heading": "审核投稿",
|
||||
"review.left": "待审 {n} 张",
|
||||
"review.approve": "同意",
|
||||
"review.reject": "拒绝",
|
||||
"review.approved": "已同意,加入抽卡",
|
||||
"review.rejected": "已拒绝",
|
||||
"review.empty": "目前没有待审的投稿",
|
||||
"err.quota_exceeded": "今天的投稿额度已经用完,明天再来",
|
||||
"err.forbidden": "没有权限",
|
||||
"err.already_reviewed": "这张已经审核过了",
|
||||
"err.not_found": "找不到"
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"lang.label": "語言",
|
||||
"menu": "選單",
|
||||
"auth.heading": "登入 / 註冊",
|
||||
"auth.hint": "輸入信箱收驗證碼,第一次登入會自動建立帳號。",
|
||||
"auth.email": "信箱",
|
||||
"auth.send": "寄送驗證碼",
|
||||
"auth.sent": "驗證碼已寄到 {email},5 分鐘內有效。",
|
||||
"auth.code": "6 位數驗證碼",
|
||||
"auth.verify": "登入",
|
||||
"auth.resend": "重新寄送",
|
||||
"auth.resend_wait": "{s} 秒後可重寄",
|
||||
"auth.change_email": "換一個信箱",
|
||||
"auth.logout": "登出",
|
||||
"profile.view": "我的個人頁",
|
||||
"profile.edit": "編輯個人資料",
|
||||
"profile.avatar": "大頭貼",
|
||||
"profile.avatar_hint": "會裁成 1024×1024 正方形,上限 5MB",
|
||||
"profile.avatar_change": "更換大頭貼",
|
||||
"profile.name": "名稱",
|
||||
"profile.bio": "自我介紹(支援 Markdown)",
|
||||
"profile.preview": "預覽",
|
||||
"profile.edit_back": "繼續編輯",
|
||||
"profile.save": "儲存",
|
||||
"profile.cancel": "取消",
|
||||
"profile.saved": "已儲存",
|
||||
"checkin.button": "簽到",
|
||||
"checkin.login_first": "登入後每天都能簽到一次,拿一張 INMU 小卡。",
|
||||
"checkin.ready": "今天還沒簽到",
|
||||
"checkin.success": "簽到成功!",
|
||||
"checkin.done_today": "今天已經簽到了",
|
||||
"checkin.total": "累計 {n} 天",
|
||||
"checkin.streak": "連續 {n} 天",
|
||||
"checkin.next": "下次簽到:{time}(還有 {t})",
|
||||
"share.button": "分享",
|
||||
"share.download": "下載圖片",
|
||||
"share.copied": "已複製分享文字和連結",
|
||||
"user.joined": "{d} 加入",
|
||||
"user.not_found": "找不到這個使用者",
|
||||
"user.back": "回首頁",
|
||||
"user.no_bio": "這個人還沒寫自我介紹。",
|
||||
"err.invalid_email": "信箱格式不正確",
|
||||
"err.too_many_requests": "請求太頻繁,請稍後再試",
|
||||
"err.send_failed": "驗證信寄送失敗,請稍後再試",
|
||||
"err.not_requested": "請先寄送驗證碼",
|
||||
"err.expired": "驗證碼已失效,請重新寄送",
|
||||
"err.wrong_code": "驗證碼錯誤",
|
||||
"err.unauthorized": "請先登入",
|
||||
"err.name_invalid": "名稱需要 1–32 個字",
|
||||
"err.bio_too_long": "自我介紹最多 2000 字",
|
||||
"err.file_too_large": "檔案太大(上限 5MB)",
|
||||
"err.invalid_image": "無法讀取這張圖片",
|
||||
"err.network": "連線失敗,請檢查網路",
|
||||
"err.unknown": "發生錯誤,請稍後再試",
|
||||
"err.code_used": "這組驗證碼已經用過,請稍後取得新的驗證碼",
|
||||
"nav.upload": "投稿圖片",
|
||||
"nav.review": "審核投稿({n})",
|
||||
"upload.heading": "投稿圖片",
|
||||
"upload.hint": "上傳你覺得適合放上小卡的圖,審核通過後就會加入抽卡。每天最多 5 張(台灣時間 04:00 重置),上限 5MB。",
|
||||
"upload.choose": "選擇圖片",
|
||||
"upload.remaining": "今天還能上傳 {n} / {max} 張",
|
||||
"upload.done": "已上傳 {n} 張,等待審核",
|
||||
"upload.mine": "我的投稿",
|
||||
"upload.empty": "還沒有投稿過。",
|
||||
"upload.status.pending": "審核中",
|
||||
"upload.status.approved": "已加入",
|
||||
"upload.status.rejected": "未通過",
|
||||
"review.heading": "審核投稿",
|
||||
"review.left": "待審 {n} 張",
|
||||
"review.approve": "同意",
|
||||
"review.reject": "拒絕",
|
||||
"review.approved": "已同意,加入抽卡",
|
||||
"review.rejected": "已拒絕",
|
||||
"review.empty": "目前沒有待審的投稿",
|
||||
"err.quota_exceeded": "今天的投稿額度已經用完,明天再來",
|
||||
"err.forbidden": "沒有權限",
|
||||
"err.already_reviewed": "這張已經審核過了",
|
||||
"err.not_found": "找不到"
|
||||
}
|
||||
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 213 KiB |
@@ -0,0 +1,179 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-Hant-TW">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>My INMU<!--BETA_TITLE--></title>
|
||||
<meta name="description" content="My INMU">
|
||||
<meta name="theme-color" content="#121016">
|
||||
<link rel="icon" href="/favicon.ico" sizes="48x48">
|
||||
<link rel="icon" href="/assets/icon-192.png" type="image/png" sizes="192x192">
|
||||
<link rel="apple-touch-icon" href="/assets/apple-touch-icon.png">
|
||||
<link rel="manifest" href="/assets/manifest.webmanifest">
|
||||
<meta name="asset-version" content="__ASSET_VERSION__">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=__ASSET_VERSION__">
|
||||
<script type="module" src="/assets/app.js?v=__ASSET_VERSION__"></script>
|
||||
<link rel="preload" as="image" href="/assets/media/checkin-1.webp?v=__ASSET_VERSION__">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layout">
|
||||
<aside id="sidebar">
|
||||
<div class="brand">
|
||||
<a href="/"><img class="logo" src="/assets/logo.png" alt="" width="32" height="32"><span>My INMU<!--BETA_BADGE--></span></a>
|
||||
<button id="menu-toggle" class="icon-btn only-mobile" type="button" data-i18n-aria="menu">☰</button>
|
||||
</div>
|
||||
|
||||
<div id="sidebar-body">
|
||||
<section id="auth-box" hidden>
|
||||
<h2 data-i18n="auth.heading"></h2>
|
||||
<p class="hint" data-i18n="auth.hint"></p>
|
||||
<form id="email-form" novalidate>
|
||||
<label><span data-i18n="auth.email"></span>
|
||||
<input type="text" inputmode="email" id="email" required autocomplete="username" autocapitalize="off" spellcheck="false" maxlength="254">
|
||||
</label>
|
||||
<button type="submit" class="primary" data-i18n="auth.send"></button>
|
||||
</form>
|
||||
<form id="code-form" hidden novalidate>
|
||||
<p class="hint" id="code-sent-msg"></p>
|
||||
<label><span data-i18n="auth.code"></span>
|
||||
<input id="code" inputmode="numeric" maxlength="6" autocomplete="one-time-code" required>
|
||||
</label>
|
||||
<button type="submit" class="primary" data-i18n="auth.verify"></button>
|
||||
<div class="row">
|
||||
<button type="button" class="link" id="resend"></button>
|
||||
<button type="button" class="link" id="change-email" data-i18n="auth.change_email"></button>
|
||||
</div>
|
||||
</form>
|
||||
<p class="error" id="auth-error" hidden></p>
|
||||
</section>
|
||||
|
||||
<section id="me-box" hidden>
|
||||
<img id="me-avatar" class="avatar" alt="" width="96" height="96">
|
||||
<div class="me-name" id="me-name"></div>
|
||||
<div class="uid" id="me-uid"></div>
|
||||
<nav class="me-nav">
|
||||
<a id="me-link" href="/" data-i18n="profile.view"></a>
|
||||
<a id="upload-link" href="/upload" data-i18n="nav.upload"></a>
|
||||
<a id="review-link" href="/review" hidden></a>
|
||||
<button type="button" class="link" id="edit-profile" data-i18n="profile.edit"></button>
|
||||
<button type="button" class="link" id="logout" data-i18n="auth.logout"></button>
|
||||
</nav>
|
||||
</section>
|
||||
|
||||
<label class="lang"><span data-i18n="lang.label"></span>
|
||||
<select id="lang">
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
<option value="zh-CN">简体中文</option>
|
||||
<option value="ja">日本語</option>
|
||||
<option value="ko">한국어</option>
|
||||
<option value="en">English</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main id="main">
|
||||
<section id="view-checkin" hidden>
|
||||
<div id="checkin-guest" class="center" hidden>
|
||||
<div class="big-mark">INMU</div>
|
||||
<p data-i18n="checkin.login_first"></p>
|
||||
<button id="guest-login" class="primary" type="button" data-i18n="auth.heading"></button>
|
||||
</div>
|
||||
<div id="checkin-ready" class="center" hidden>
|
||||
<p class="muted" data-i18n="checkin.ready"></p>
|
||||
<button id="checkin-btn" class="checkin-btn" type="button">
|
||||
<img id="checkin-face" src="/assets/media/checkin-0.webp?v=__ASSET_VERSION__" alt="" width="512" height="512" draggable="false">
|
||||
<span class="checkin-label" data-i18n="checkin.button"></span>
|
||||
</button>
|
||||
<audio id="checkin-sfx" src="/assets/media/114514.m4a?v=__ASSET_VERSION__" preload="auto"></audio>
|
||||
<p class="stats" id="ready-stats"></p>
|
||||
</div>
|
||||
<div id="checkin-done" class="center" hidden>
|
||||
<p class="checkin-msg" id="checkin-msg"></p>
|
||||
<img id="card-img" class="card-img" alt="INMU card" width="1080" height="1350">
|
||||
<div class="row actions">
|
||||
<button id="share-btn" class="primary" type="button" data-i18n="share.button"></button>
|
||||
<a id="download-btn" class="button" download data-i18n="share.download"></a>
|
||||
</div>
|
||||
<p class="stats" id="done-stats"></p>
|
||||
</div>
|
||||
<p class="hint center-text" id="next-reset" hidden></p>
|
||||
</section>
|
||||
|
||||
<section id="view-upload" hidden>
|
||||
<h1 data-i18n="upload.heading"></h1>
|
||||
<p class="hint" data-i18n="upload.hint"></p>
|
||||
<div class="row upload-bar">
|
||||
<label class="button primary" for="upload-file" id="upload-pick" data-i18n="upload.choose"></label>
|
||||
<input type="file" id="upload-file" accept="image/*" multiple hidden>
|
||||
<span class="muted" id="upload-quota"></span>
|
||||
</div>
|
||||
<p class="error" id="upload-error" hidden></p>
|
||||
<h2 data-i18n="upload.mine"></h2>
|
||||
<p class="hint" id="upload-empty" data-i18n="upload.empty" hidden></p>
|
||||
<div class="sub-grid" id="upload-list"></div>
|
||||
</section>
|
||||
|
||||
<section id="view-review" hidden>
|
||||
<h1 data-i18n="review.heading"></h1>
|
||||
<p class="muted" id="review-left"></p>
|
||||
<div id="review-item" class="center" hidden>
|
||||
<img id="review-img" class="review-img" alt="">
|
||||
<p class="review-meta">
|
||||
<a id="review-name" href="/"></a> <span class="uid" id="review-uid"></span><br>
|
||||
<span class="hint" id="review-time"></span>
|
||||
</p>
|
||||
<div class="row actions">
|
||||
<button type="button" id="review-reject" data-i18n="review.reject"></button>
|
||||
<button type="button" class="primary" id="review-approve" data-i18n="review.approve"></button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="center-text muted" id="review-empty" data-i18n="review.empty" hidden></p>
|
||||
</section>
|
||||
|
||||
<section id="view-user" hidden>
|
||||
<div id="user-card" class="profile" hidden>
|
||||
<img id="user-avatar" class="avatar large" alt="" width="160" height="160">
|
||||
<h1 id="user-name"></h1>
|
||||
<div class="uid" id="user-uid"></div>
|
||||
<p class="stats" id="user-stats"></p>
|
||||
<div class="bio" id="user-bio"></div>
|
||||
<p class="hint" id="user-joined"></p>
|
||||
</div>
|
||||
<p id="user-missing" class="center-text" hidden data-i18n="user.not_found"></p>
|
||||
<p class="center-text"><a href="/" data-i18n="user.back"></a></p>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<dialog id="profile-dialog">
|
||||
<form id="profile-form" method="dialog" novalidate>
|
||||
<h2 data-i18n="profile.edit"></h2>
|
||||
<div class="avatar-edit">
|
||||
<img id="edit-avatar" class="avatar" alt="" width="96" height="96">
|
||||
<div>
|
||||
<label class="button" for="avatar-file" data-i18n="profile.avatar_change"></label>
|
||||
<input type="file" id="avatar-file" accept="image/*" hidden>
|
||||
<p class="hint" data-i18n="profile.avatar_hint"></p>
|
||||
</div>
|
||||
</div>
|
||||
<label><span data-i18n="profile.name"></span>
|
||||
<input id="edit-name" maxlength="32" required>
|
||||
</label>
|
||||
<label><span data-i18n="profile.bio"></span>
|
||||
<textarea id="edit-bio" rows="8" maxlength="2000"></textarea>
|
||||
</label>
|
||||
<div class="bio preview" id="edit-preview" hidden></div>
|
||||
<p class="error" id="profile-error" hidden></p>
|
||||
<div class="row dialog-actions">
|
||||
<button type="button" class="link" id="preview-toggle" data-i18n="profile.preview"></button>
|
||||
<span class="spacer"></span>
|
||||
<button type="button" id="profile-cancel" data-i18n="profile.cancel"></button>
|
||||
<button type="submit" class="primary" id="profile-save" data-i18n="profile.save"></button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<div id="toast" role="status" hidden></div>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "My INMU",
|
||||
"short_name": "My INMU",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#121016",
|
||||
"theme_color": "#121016",
|
||||
"icons": [
|
||||
{ "src": "/assets/icon-192.png", "sizes": "192x192", "type": "image/png" },
|
||||
{ "src": "/assets/icon-512.png", "sizes": "512x512", "type": "image/png" }
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
@@ -0,0 +1,281 @@
|
||||
:root {
|
||||
--bg: #121016;
|
||||
--panel: #1c1922;
|
||||
--panel-2: #26222e;
|
||||
--line: #3a3448;
|
||||
--text: #f5f3fa;
|
||||
--muted: #b9b3c9;
|
||||
--accent: #f0a43a;
|
||||
--accent-ink: #1e1a24;
|
||||
--error: #ff7a7a;
|
||||
--radius: 12px;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
[hidden] { display: none !important; }
|
||||
|
||||
html, body { margin: 0; height: 100%; }
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font: 16px/1.6 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "Noto Sans JP", "Noto Sans KR",
|
||||
"Microsoft JhengHei", "PingFang TC", sans-serif;
|
||||
}
|
||||
a { color: var(--accent); }
|
||||
|
||||
.layout { display: flex; min-height: 100vh; }
|
||||
|
||||
/* ---------- 側邊欄 ---------- */
|
||||
#sidebar {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
background: var(--panel);
|
||||
border-right: 1px solid var(--line);
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
.brand { display: flex; align-items: center; justify-content: space-between; }
|
||||
.brand a { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
|
||||
font-weight: 800; font-size: 20px; }
|
||||
.brand .logo { border-radius: 8px; object-fit: cover; }
|
||||
#sidebar-body { display: flex; flex-direction: column; gap: 24px; flex: 1; }
|
||||
#sidebar h2 { font-size: 18px; margin: 0 0 4px; }
|
||||
|
||||
form { display: flex; flex-direction: column; gap: 12px; }
|
||||
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
|
||||
input, textarea, select {
|
||||
font: inherit;
|
||||
color: var(--text);
|
||||
background: var(--panel-2);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
width: 100%;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
|
||||
#code { letter-spacing: .4em; font-size: 20px; text-align: center; }
|
||||
textarea { resize: vertical; min-height: 120px; }
|
||||
|
||||
button, .button {
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--panel-2);
|
||||
color: var(--text);
|
||||
border-radius: 999px;
|
||||
padding: 9px 20px;
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
button:disabled { opacity: .5; cursor: default; }
|
||||
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
|
||||
button.link { background: none; border: none; padding: 0; color: var(--accent); border-radius: 0; }
|
||||
button.link:disabled { color: var(--muted); }
|
||||
.icon-btn { padding: 4px 10px; border-radius: 8px; font-size: 20px; }
|
||||
|
||||
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
|
||||
.spacer { flex: 1; }
|
||||
.hint { font-size: 13px; color: var(--muted); margin: 0; }
|
||||
.muted { color: var(--muted); }
|
||||
.error { color: var(--error); font-size: 14px; margin: 0; }
|
||||
|
||||
#me-box { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
|
||||
.me-name { font-size: 20px; font-weight: 700; word-break: break-word; }
|
||||
.me-nav { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 12px; }
|
||||
.me-nav a { text-decoration: none; }
|
||||
|
||||
.avatar { border-radius: 50%; object-fit: cover; background: var(--panel-2); width: 96px; height: 96px; }
|
||||
.avatar.large { width: 160px; height: 160px; }
|
||||
|
||||
.beta { font-size: 12px; font-weight: 600; color: var(--muted); }
|
||||
|
||||
/* UID:特殊序號用背景色標示(和小卡的 server/app/titles.py TIER_COLORS 一致) */
|
||||
.uid { color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||
.uid.tier-admin, .uid.tier-1919810, .uid.tier-114514 {
|
||||
display: inline-block;
|
||||
font-weight: 700;
|
||||
padding: 2px 10px;
|
||||
border-radius: 8px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.uid.tier-admin { background: #f5c518; color: #1e1a24; }
|
||||
.uid.tier-1919810 { background: #f07c2a; color: #1e1a24; }
|
||||
.uid.tier-114514 { background: #2f7beb; color: #fff; }
|
||||
|
||||
.lang { margin-top: auto; }
|
||||
|
||||
/* ---------- 主畫面 ---------- */
|
||||
#main { flex: 1; padding: 40px 24px; display: flex; justify-content: center; }
|
||||
#view-checkin, #view-user, #view-upload, #view-review { width: 100%; max-width: 560px; }
|
||||
#view-upload h1, #view-review h1 { font-size: 24px; margin: 0 0 8px; }
|
||||
#view-upload h2 { font-size: 18px; margin: 28px 0 12px; }
|
||||
.center { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
|
||||
.center-text { text-align: center; }
|
||||
|
||||
.big-mark { font-size: 72px; font-weight: 900; letter-spacing: .1em; color: var(--accent); margin-top: 10vh; }
|
||||
|
||||
/* 簽到按鈕:圓角方形,平常是 checkin-0,按下去換成 checkin-1 + 音效 + 粒子 */
|
||||
.checkin-btn {
|
||||
position: relative;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
margin-top: 8vh;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 28%;
|
||||
border: 3px solid var(--accent);
|
||||
background: var(--panel-2);
|
||||
box-shadow: 0 16px 48px #f0a43a44;
|
||||
transition: transform .15s;
|
||||
}
|
||||
.checkin-btn img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
|
||||
.checkin-label {
|
||||
position: absolute;
|
||||
left: 0; right: 0; bottom: 0;
|
||||
padding: 6px 0 8px;
|
||||
background: linear-gradient(transparent, #000c 70%);
|
||||
color: #fff;
|
||||
font-size: 22px;
|
||||
font-weight: 900;
|
||||
letter-spacing: .1em;
|
||||
}
|
||||
.checkin-btn:hover:not(:disabled) { transform: scale(1.04); }
|
||||
.checkin-btn:active:not(:disabled) { transform: scale(.97); }
|
||||
.checkin-btn:disabled { opacity: 1; }
|
||||
.checkin-btn.pressed { animation: press-pop .45s ease-out; }
|
||||
@keyframes press-pop {
|
||||
0% { transform: scale(.92); }
|
||||
45% { transform: scale(1.1) rotate(-2deg); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
/* 粒子:位置、方向、距離、顏色由 app.js 用 CSS 變數指定 */
|
||||
.particle {
|
||||
position: fixed;
|
||||
left: var(--x);
|
||||
top: var(--y);
|
||||
width: var(--s);
|
||||
height: var(--s);
|
||||
border-radius: 50%;
|
||||
background: var(--c);
|
||||
pointer-events: none;
|
||||
z-index: 20;
|
||||
animation: burst var(--d, .9s) cubic-bezier(.12, .75, .3, 1) forwards;
|
||||
}
|
||||
.particle.digit {
|
||||
width: auto;
|
||||
height: auto;
|
||||
background: none;
|
||||
color: var(--c);
|
||||
font-size: var(--s);
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
text-shadow: 0 2px 6px #0008;
|
||||
}
|
||||
@keyframes burst {
|
||||
from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
|
||||
70% { opacity: 1; }
|
||||
to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.3) rotate(var(--r)); opacity: 0; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.particle { display: none; }
|
||||
.checkin-btn.pressed { animation: none; }
|
||||
}
|
||||
|
||||
.checkin-msg { font-size: 22px; font-weight: 700; margin: 0; }
|
||||
.card-img { width: 100%; height: auto; border-radius: 16px; box-shadow: 0 12px 40px #0008; background: var(--panel); }
|
||||
.stats { color: var(--muted); margin: 0; font-size: 15px; }
|
||||
.actions { justify-content: center; }
|
||||
|
||||
/* ---------- 投稿 / 審核 ---------- */
|
||||
.upload-bar { margin-top: 16px; }
|
||||
.upload-bar label.button { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }
|
||||
.upload-bar label.button.busy { opacity: .5; pointer-events: none; }
|
||||
.sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
|
||||
.sub-item { position: relative; border-radius: 10px; overflow: hidden; background: var(--panel-2); aspect-ratio: 1; }
|
||||
.sub-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.sub-status {
|
||||
position: absolute;
|
||||
left: 6px; bottom: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
padding: 1px 8px;
|
||||
border-radius: 999px;
|
||||
background: #000b;
|
||||
color: var(--text);
|
||||
}
|
||||
.sub-status.approved { background: #2f9e5a; color: #fff; }
|
||||
.sub-status.rejected { background: #6b3a3a; color: #fff; }
|
||||
.review-img { max-width: 100%; max-height: 60vh; border-radius: 12px; background: var(--panel); box-shadow: 0 12px 40px #0008; }
|
||||
.review-meta { margin: 0; line-height: 1.9; }
|
||||
#review-name { font-weight: 700; text-decoration: none; }
|
||||
|
||||
.profile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
|
||||
.profile h1 { margin: 12px 0 0; font-size: 28px; word-break: break-word; }
|
||||
|
||||
.bio {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
padding: 4px 20px;
|
||||
margin-top: 16px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.bio pre { overflow-x: auto; background: var(--panel-2); padding: 12px; border-radius: 8px; }
|
||||
.bio code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
|
||||
.bio pre code { padding: 0; }
|
||||
.bio blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
|
||||
.bio table { border-collapse: collapse; }
|
||||
.bio th, .bio td { border: 1px solid var(--line); padding: 4px 8px; }
|
||||
.bio.empty { color: var(--muted); padding: 16px 20px; }
|
||||
|
||||
/* ---------- 編輯個人資料 ---------- */
|
||||
dialog {
|
||||
width: min(560px, calc(100vw - 32px));
|
||||
background: var(--panel);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
}
|
||||
dialog::backdrop { background: #000a; }
|
||||
dialog h2 { margin: 0 0 4px; }
|
||||
.avatar-edit { display: flex; gap: 16px; align-items: center; }
|
||||
.avatar-edit .button { margin-bottom: 6px; }
|
||||
.preview { margin-top: 0; max-height: 300px; overflow-y: auto; }
|
||||
.dialog-actions { margin-top: 8px; }
|
||||
|
||||
#toast {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 32px;
|
||||
transform: translateX(-50%);
|
||||
background: var(--panel-2);
|
||||
border: 1px solid var(--line);
|
||||
padding: 10px 20px;
|
||||
border-radius: 999px;
|
||||
box-shadow: 0 8px 24px #0008;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.only-mobile { display: none; }
|
||||
|
||||
/* ---------- 手機:側欄收到上方 ---------- */
|
||||
@media (max-width: 760px) {
|
||||
.layout { flex-direction: column; }
|
||||
#sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); padding: 12px 16px; gap: 12px; }
|
||||
.only-mobile { display: inline-flex; }
|
||||
#sidebar:not(.open) #sidebar-body { display: none; }
|
||||
#sidebar-body { padding-bottom: 8px; }
|
||||
#main { padding: 24px 16px; }
|
||||
.checkin-btn { width: 180px; height: 180px; margin-top: 6vh; }
|
||||
.checkin-label { font-size: 18px; }
|
||||
.big-mark { font-size: 56px; margin-top: 6vh; }
|
||||
}
|
||||