@ywkrlerche/richardwho 1.0.37 β 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +172 -4
- package/index.html +33 -2
- package/package.json +1 -1
- package/style.css +37 -0
- package/logos/trivia-funtrivia.webp +0 -0
- package/logos/trivia-travle.webp +0 -0
- package/logos/trivia-triviaplaza.webp +0 -0
- package/logos/trivia-worldle.webp +0 -0
package/app.js
CHANGED
|
@@ -613,6 +613,9 @@
|
|
|
613
613
|
stopTriviaTimer();
|
|
614
614
|
closeTriviaSite();
|
|
615
615
|
if (!$("trivia-play").hidden) triviaScreen("setup");
|
|
616
|
+
trivia.daily = false; // a daily challenge left halfway is used up (one try a day)
|
|
617
|
+
$("trivia-daily").hidden = false;
|
|
618
|
+
renderDaily();
|
|
616
619
|
}
|
|
617
620
|
if (view === "ai") { renderAi(); setTimeout(() => $("ai-input").focus(), 50); }
|
|
618
621
|
if (view === "changelog") renderChangelog();
|
|
@@ -681,6 +684,11 @@
|
|
|
681
684
|
// Newest first. Add an entry here with every publish; its version should match package.json.
|
|
682
685
|
// Each has: new (features), games (added/removed/fixed games), fixes (bugs). Leave a list out if empty.
|
|
683
686
|
const CHANGELOG = [
|
|
687
|
+
{ version: "1.0.39", date: "2026-10-29",
|
|
688
|
+
fixes: ["Old daily challenge scores clean themselves up after 2 days"] },
|
|
689
|
+
{ version: "1.0.38", date: "2026-10-29",
|
|
690
|
+
new: ["Daily trivia challenge: the same 10 questions for everyone, one try a day, with a leaderboard", "A quick tour of the site for first-time visitors (replay it from Settings)"],
|
|
691
|
+
fixes: ["Trimmed the trivia puzzle list to the best ones"] },
|
|
684
692
|
{ version: "1.0.37", date: "2026-10-29",
|
|
685
693
|
new: ["π€ AI chat: ask anything, and it can look at pictures too", "A cleaner Games page: search on top, categories in one row", "π Halloween look on the home page, plus quick buttons for popular games", "Hide the side bar with the arrow at its bottom", "π¨ Themes in Settings: Auto, Black, White, Halloween and Christmas",
|
|
686
694
|
"π₯ Popular games are now the ones people actually play, and games show how many are playing right now", "π― Game of the day on the Games page",
|
|
@@ -2518,11 +2526,7 @@
|
|
|
2518
2526
|
|
|
2519
2527
|
// Puzzle sites: "embed" ones play inside the page; the rest refuse to be framed and open in a new tab
|
|
2520
2528
|
const TRIVIA_SITES = [
|
|
2521
|
-
{ id: "worldle", name: "Worldle", icon: "π", url: "https://worldle.teuteuf.fr/", desc: "Guess the country from its shape" }, // its makers ask not to be shown inside other sites
|
|
2522
2529
|
{ id: "globle", name: "Globle", icon: "π", url: "https://globle-game.com/", desc: "Find the mystery country on the globe", embed: true },
|
|
2523
|
-
{ id: "travle", name: "Travle", icon: "π§", url: "https://travle.earth/", desc: "Travel between two countries" }, // same makers as Worldle, same request
|
|
2524
|
-
{ id: "triviaplaza", name: "TriviaPlaza", icon: "β", url: "https://www.triviaplaza.com/", desc: "Quizzes by topic", embed: true },
|
|
2525
|
-
{ id: "funtrivia", name: "FunTrivia", icon: "π²", url: "https://www.funtrivia.com/", desc: "Huge trivia library and games", embed: true },
|
|
2526
2530
|
{ id: "grid-football", name: "Immaculate Grid: Football", icon: "π", url: "https://www.sports-reference.com/immaculate-grid/football/", desc: "Name players who fit the row and column" },
|
|
2527
2531
|
{ id: "grid-baseball", name: "Immaculate Grid: Baseball", icon: "βΎ", url: "https://www.sports-reference.com/immaculate-grid/", desc: "The baseball version" },
|
|
2528
2532
|
{ id: "krillion", name: "Krillion", icon: "π¦", url: "https://krillion.io/", desc: "Daily puzzle" },
|
|
@@ -2606,6 +2610,7 @@
|
|
|
2606
2610
|
for (const id of ["setup", "play", "done"]) $(`trivia-${id}`).hidden = id !== which;
|
|
2607
2611
|
}
|
|
2608
2612
|
async function startTrivia() {
|
|
2613
|
+
trivia.daily = false;
|
|
2609
2614
|
triviaScreen("play");
|
|
2610
2615
|
Object.assign(trivia, { qs: [], i: 0, score: 0, right: 0, streak: 0, best: 0, locked: true });
|
|
2611
2616
|
$("trivia-q").textContent = "Getting questionsβ¦";
|
|
@@ -2667,6 +2672,17 @@
|
|
|
2667
2672
|
}
|
|
2668
2673
|
function finishTrivia() {
|
|
2669
2674
|
triviaScreen("done");
|
|
2675
|
+
if (trivia.daily) {
|
|
2676
|
+
trivia.daily = false;
|
|
2677
|
+
submitDaily();
|
|
2678
|
+
$("trivia-final").textContent = `${trivia.score.toLocaleString()} points`;
|
|
2679
|
+
$("trivia-summary").textContent = `${trivia.right} of 10 right in today's challenge. Check the leaderboard above.`;
|
|
2680
|
+
$("trivia-daily").hidden = false;
|
|
2681
|
+
$("trivia-again").textContent = "Play a quick quiz";
|
|
2682
|
+
renderDaily();
|
|
2683
|
+
return;
|
|
2684
|
+
}
|
|
2685
|
+
$("trivia-again").textContent = "Play again";
|
|
2670
2686
|
const key = triviaBestKey(), bests = store.get(TRIVIA_BEST_KEY, {});
|
|
2671
2687
|
const record = trivia.score > (bests[key] || 0);
|
|
2672
2688
|
if (record) { bests[key] = trivia.score; store.set(TRIVIA_BEST_KEY, bests); }
|
|
@@ -2675,6 +2691,10 @@
|
|
|
2675
2691
|
(trivia.best >= 3 ? `, best streak ${trivia.best}` : "") + (record && trivia.score ? ". New personal best!" : ".");
|
|
2676
2692
|
}
|
|
2677
2693
|
function bindTrivia() {
|
|
2694
|
+
$("daily-start").addEventListener("click", startDaily);
|
|
2695
|
+
$("daily-name").addEventListener("keydown", (e) => { if (e.key === "Enter") startDaily(); });
|
|
2696
|
+
renderDaily();
|
|
2697
|
+
watchDailyBoard();
|
|
2678
2698
|
renderTriviaChoices();
|
|
2679
2699
|
renderTriviaSites();
|
|
2680
2700
|
$("trivia-cats").addEventListener("click", (e) => { const b = e.target.closest("[data-topic]"); if (b) { const v = b.dataset.topic; trivia.topic = /^\d+$/.test(v) ? Number(v) : v; trivia.team = ""; renderTriviaChoices(); } });
|
|
@@ -2697,6 +2717,150 @@
|
|
|
2697
2717
|
});
|
|
2698
2718
|
}
|
|
2699
2719
|
|
|
2720
|
+
// ---------- Daily trivia challenge: the same 10 questions for everyone today, one try, a leaderboard ----------
|
|
2721
|
+
// Questions come from the built-in sets, picked and ordered by today's date, so every visitor gets the same quiz.
|
|
2722
|
+
// Scores go to daily/<date>/<player id> (one per person per day, checked by the database).
|
|
2723
|
+
const DAILY_KEY = "rug-daily";
|
|
2724
|
+
const dailyDate = (d = new Date()) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
2725
|
+
function seededRandom(text) { // the same text always gives the same sequence of numbers
|
|
2726
|
+
let h = 1779033703 ^ text.length;
|
|
2727
|
+
for (let i = 0; i < text.length; i++) { h = Math.imul(h ^ text.charCodeAt(i), 3432918353); h = (h << 13) | (h >>> 19); }
|
|
2728
|
+
return () => { h = Math.imul(h ^ (h >>> 16), 2246822507); h = Math.imul(h ^ (h >>> 13), 3266489909); h ^= h >>> 16; return (h >>> 0) / 4294967296; };
|
|
2729
|
+
}
|
|
2730
|
+
function dailyQuestions() {
|
|
2731
|
+
const rnd = seededRandom("richardwho daily " + dailyDate());
|
|
2732
|
+
const mix = (a) => { a = a.slice(); for (let i = a.length - 1; i > 0; i--) { const j = Math.floor(rnd() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } return a; };
|
|
2733
|
+
// a spread: 3 NFL, 3 NBA, 2 MLB, 2 general knowledge, easy to hard
|
|
2734
|
+
const fromLeague = (lg, n) => mix(TRIVIA_LEAGUES[lg]).slice(0, n).map(([, , q, right, ...wrong]) => ({ q, right, wrong, topic: lg.toUpperCase() }));
|
|
2735
|
+
const general = mix(TRIVIA_BACKUP).slice(0, 2).map(([q, right, ...wrong]) => ({ q, right, wrong, topic: "General" }));
|
|
2736
|
+
return mix([...fromLeague("nfl", 3), ...fromLeague("nba", 3), ...fromLeague("mlb", 2), ...general])
|
|
2737
|
+
.map(({ q, right, wrong, topic }) => ({ q, right, topic: `Daily Β· ${topic}`, answers: mix([right, ...wrong]) }));
|
|
2738
|
+
}
|
|
2739
|
+
const daily = { board: [], ref: null };
|
|
2740
|
+
function dailyMine() { const d = store.get(DAILY_KEY, null); return d && d.date === dailyDate() ? d : null; }
|
|
2741
|
+
async function startDaily() {
|
|
2742
|
+
if (dailyMine()) return renderDaily();
|
|
2743
|
+
const name = ($("daily-name").value || "").replace(/\s+/g, " ").trim();
|
|
2744
|
+
if (!name) { $("daily-note").textContent = "Pick a name for the leaderboard first."; $("daily-name").focus(); return; }
|
|
2745
|
+
if ([...name].length > 16) { $("daily-note").textContent = "Names can be up to 16 characters."; return; }
|
|
2746
|
+
if (/^ *richard *$/i.test(name)) { $("daily-note").textContent = "That name is taken."; return; }
|
|
2747
|
+
store.set("rug-chat-name", store.get("rug-chat-name", "") || name); // same name as chat, if chat doesn't have one yet
|
|
2748
|
+
store.set(DAILY_KEY, { date: dailyDate(), name: maskSlurs(name), started: true }); // one try: starting counts
|
|
2749
|
+
trivia.daily = true;
|
|
2750
|
+
$("trivia-daily").hidden = true;
|
|
2751
|
+
triviaScreen("play");
|
|
2752
|
+
Object.assign(trivia, { qs: dailyQuestions(), i: 0, score: 0, right: 0, streak: 0, best: 0, locked: true });
|
|
2753
|
+
showTriviaQuestion();
|
|
2754
|
+
}
|
|
2755
|
+
async function submitDaily() {
|
|
2756
|
+
const mine = { ...store.get(DAILY_KEY, {}), score: trivia.score, right: trivia.right, finished: true };
|
|
2757
|
+
store.set(DAILY_KEY, mine);
|
|
2758
|
+
const app = await getFirebase();
|
|
2759
|
+
if (!app) return;
|
|
2760
|
+
try {
|
|
2761
|
+
const user = await signedInUser(app);
|
|
2762
|
+
await app.database().ref(`daily/${mine.date}/${user.uid}`).set({
|
|
2763
|
+
name: mine.name, score: mine.score, right: mine.right, ts: window.firebase.database.ServerValue.TIMESTAMP,
|
|
2764
|
+
});
|
|
2765
|
+
} catch { /* already played today from this browser, or offline: the local score still shows */ }
|
|
2766
|
+
}
|
|
2767
|
+
// Old boards clean themselves up: whoever opens Trivia deletes scores more than 2 days old (the database allows
|
|
2768
|
+
// that for anyone), a few days at a time, so the owner never has to
|
|
2769
|
+
async function sweepOldDaily(db) {
|
|
2770
|
+
try {
|
|
2771
|
+
const cutoff = dailyDate(new Date(Date.now() - 3 * 86400000)), old = Date.now() - 2 * 86400000;
|
|
2772
|
+
const days = await db.ref("daily").orderByKey().endAt(cutoff).limitToFirst(5).once("value");
|
|
2773
|
+
const changes = {};
|
|
2774
|
+
days.forEach((day) => { day.forEach((row) => { if ((row.val() || {}).ts < old) changes[`daily/${day.key}/${row.key}`] = null; }); });
|
|
2775
|
+
if (Object.keys(changes).length) await db.ref().update(changes);
|
|
2776
|
+
} catch { /* older rules, or someone else swept first */ }
|
|
2777
|
+
}
|
|
2778
|
+
async function watchDailyBoard() {
|
|
2779
|
+
const app = await getFirebase();
|
|
2780
|
+
if (!app) return;
|
|
2781
|
+
signedInUser(app).then(() => sweepOldDaily(app.database()));
|
|
2782
|
+
if (daily.ref) daily.ref.off();
|
|
2783
|
+
daily.ref = app.database().ref(`daily/${dailyDate()}`).orderByChild("score").limitToLast(10);
|
|
2784
|
+
daily.ref.on("value", (s) => {
|
|
2785
|
+
const rows = [];
|
|
2786
|
+
s.forEach((c) => { const v = c.val(); if (v && typeof v.name === "string") rows.push({ ...v, uid: c.key }); });
|
|
2787
|
+
daily.board = rows.sort((a, b) => b.score - a.score || a.ts - b.ts); // ties: whoever finished first
|
|
2788
|
+
daily.me = app.auth().currentUser?.uid;
|
|
2789
|
+
renderDaily();
|
|
2790
|
+
}, () => {});
|
|
2791
|
+
}
|
|
2792
|
+
function renderDaily() {
|
|
2793
|
+
const mine = dailyMine();
|
|
2794
|
+
$("daily-date").textContent = new Date().toLocaleDateString([], { weekday: "long", month: "long", day: "numeric" });
|
|
2795
|
+
$("daily-name-row").hidden = !!mine;
|
|
2796
|
+
$("daily-start").hidden = !!mine;
|
|
2797
|
+
if (!$("daily-name").value) $("daily-name").value = store.get("rug-chat-name", "");
|
|
2798
|
+
$("daily-status").textContent = !mine ? "10 questions, same for everyone, one try. Come back tomorrow for a new one."
|
|
2799
|
+
: mine.finished ? `You scored ${mine.score.toLocaleString()} (${mine.right}/10). New challenge tomorrow.`
|
|
2800
|
+
: "You started today's challenge but didn't finish it. New challenge tomorrow.";
|
|
2801
|
+
$("daily-board").innerHTML = daily.board.length
|
|
2802
|
+
? daily.board.map((r, i) => `<li class="${r.uid === daily.me ? "me" : ""}"><span class="daily-rank">${i + 1}</span>` +
|
|
2803
|
+
`<span class="daily-who">${escapeHtml(maskSlurs(r.name))}</span><span class="daily-pts">${Number(r.score).toLocaleString()}</span></li>`).join("")
|
|
2804
|
+
: `<li class="daily-empty">No scores yet today. Be the first!</li>`;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
// ---------- First-visit tour: a few steps pointing at the side bar, shown once to new visitors ----------
|
|
2808
|
+
const TOUR_KEY = "rug-tour-done";
|
|
2809
|
+
const TOUR_STEPS = [
|
|
2810
|
+
[null, "Welcome to richardwho", "Hundreds of free games, nothing to install. Here's a quick tour (about 20 seconds)."],
|
|
2811
|
+
["#home-search", "Search", "Start typing to find any game. Press / from anywhere to jump here."],
|
|
2812
|
+
[".rail-btn[data-nav=games]", "Games", "Every game, by category. There's a Game of the day and the most played games at the top."],
|
|
2813
|
+
[".rail-btn[data-nav=trivia]", "Trivia", "Quick quizzes, NFL, NBA and MLB team trivia, and a daily challenge with a leaderboard."],
|
|
2814
|
+
["#soundboard-btn", "Soundboard", "Meme sounds and effects, one click away."],
|
|
2815
|
+
[".rail-btn[data-nav=ai]", "AI chat", "Ask anything: homework help, game ideas, or just questions."],
|
|
2816
|
+
[".rail-btn[data-nav=chat]", "Chat", "Talk with everyone on the site. Be nice, and you can post polls too."],
|
|
2817
|
+
["#panic-btn", "Panic button", "Jumps straight to Google Classroom. The ` and ] keys do it too."],
|
|
2818
|
+
[".rail-btn[data-nav=settings]", "Settings", "Themes, the tab disguise, the panic page and more. You can replay this tour there."],
|
|
2819
|
+
];
|
|
2820
|
+
const tour = { i: 0 };
|
|
2821
|
+
function showTour() {
|
|
2822
|
+
tour.i = 0;
|
|
2823
|
+
document.documentElement.classList.add("rail-peek");
|
|
2824
|
+
$("tour").hidden = false;
|
|
2825
|
+
tourStep();
|
|
2826
|
+
}
|
|
2827
|
+
function endTour() {
|
|
2828
|
+
$("tour").hidden = true;
|
|
2829
|
+
document.documentElement.classList.remove("rail-peek");
|
|
2830
|
+
store.set(TOUR_KEY, true);
|
|
2831
|
+
}
|
|
2832
|
+
function tourStep() {
|
|
2833
|
+
const [sel, title, text] = TOUR_STEPS[tour.i];
|
|
2834
|
+
const target = sel && document.querySelector(sel);
|
|
2835
|
+
const r = target && target.offsetParent !== null ? target.getBoundingClientRect() : null;
|
|
2836
|
+
const spot = $("tour-spot"), card = $("tour-card");
|
|
2837
|
+
spot.hidden = !r;
|
|
2838
|
+
if (r) Object.assign(spot.style, { left: `${r.left - 6}px`, top: `${r.top - 6}px`, width: `${r.width + 12}px`, height: `${r.height + 12}px` });
|
|
2839
|
+
$("tour-step").textContent = `${tour.i + 1} of ${TOUR_STEPS.length}`;
|
|
2840
|
+
$("tour-title").textContent = title;
|
|
2841
|
+
$("tour-text").textContent = text;
|
|
2842
|
+
$("tour-back").hidden = tour.i === 0;
|
|
2843
|
+
$("tour-next").textContent = tour.i === TOUR_STEPS.length - 1 ? "Done" : "Next";
|
|
2844
|
+
// put the card beside the highlighted thing (to its right, or above it on phones), or in the middle
|
|
2845
|
+
const w = card.offsetWidth || 320, h = card.offsetHeight || 170;
|
|
2846
|
+
let x = innerWidth / 2 - w / 2, y = innerHeight / 2 - h / 2;
|
|
2847
|
+
if (r) {
|
|
2848
|
+
if (r.right + 20 + w < innerWidth) { x = r.right + 20; y = r.top + r.height / 2 - h / 2; }
|
|
2849
|
+
else { x = r.left + r.width / 2 - w / 2; y = r.top - h - 20 > 0 ? r.top - h - 20 : r.bottom + 20; }
|
|
2850
|
+
}
|
|
2851
|
+
card.style.left = `${Math.max(12, Math.min(innerWidth - w - 12, x))}px`;
|
|
2852
|
+
card.style.top = `${Math.max(12, Math.min(innerHeight - h - 12, y))}px`;
|
|
2853
|
+
$("tour-next").focus();
|
|
2854
|
+
}
|
|
2855
|
+
function bindTour() {
|
|
2856
|
+
$("tour-next").addEventListener("click", () => { if (++tour.i >= TOUR_STEPS.length) endTour(); else tourStep(); });
|
|
2857
|
+
$("tour-back").addEventListener("click", () => { tour.i = Math.max(0, tour.i - 1); tourStep(); });
|
|
2858
|
+
$("tour-skip").addEventListener("click", endTour);
|
|
2859
|
+
$("set-tour").addEventListener("click", () => { go("home"); setTimeout(showTour, 400); });
|
|
2860
|
+
document.addEventListener("keydown", (e) => { if (!$("tour").hidden && e.key === "Escape") endTour(); });
|
|
2861
|
+
addEventListener("resize", () => { if (!$("tour").hidden) tourStep(); });
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2700
2864
|
// ---------- AI chat ----------
|
|
2701
2865
|
// One chatbot backed by several free AI services. It tries them in order (Gemini, Groq, OpenRouter,
|
|
2702
2866
|
// Mistral); when one is out of free messages, down or missing a key, it moves to the next.
|
|
@@ -3441,6 +3605,8 @@
|
|
|
3441
3605
|
}
|
|
3442
3606
|
|
|
3443
3607
|
async function init() {
|
|
3608
|
+
let firstVisit = false;
|
|
3609
|
+
try { firstVisit = !Object.keys(localStorage).some((k) => k.startsWith("rug-")); } catch {}
|
|
3444
3610
|
loadSettings();
|
|
3445
3611
|
startBoot();
|
|
3446
3612
|
initTheme();
|
|
@@ -3517,6 +3683,8 @@
|
|
|
3517
3683
|
startCommunity();
|
|
3518
3684
|
route();
|
|
3519
3685
|
finishBoot("Done");
|
|
3686
|
+
bindTour();
|
|
3687
|
+
if (firstVisit && !store.get(TOUR_KEY, false) && !location.hash) setTimeout(showTour, 700);
|
|
3520
3688
|
}
|
|
3521
3689
|
|
|
3522
3690
|
init();
|
package/index.html
CHANGED
|
@@ -159,6 +159,22 @@
|
|
|
159
159
|
<section id="view-trivia" class="view trivia" hidden>
|
|
160
160
|
<div id="trivia-home">
|
|
161
161
|
<header class="games-head"><h1>Trivia</h1></header>
|
|
162
|
+
<div class="trivia-card daily" id="trivia-daily">
|
|
163
|
+
<h2>Daily challenge</h2>
|
|
164
|
+
<p class="trivia-help" id="daily-date"></p>
|
|
165
|
+
<div class="daily-grid">
|
|
166
|
+
<div class="daily-side">
|
|
167
|
+
<p class="daily-status" id="daily-status"></p>
|
|
168
|
+
<div class="daily-name-row" id="daily-name-row"><input id="daily-name" maxlength="16" placeholder="Your name for the leaderboard" spellcheck="false" autocomplete="off" aria-label="Your name for the leaderboard"></div>
|
|
169
|
+
<button class="pill-btn trivia-start" type="button" id="daily-start">Start today's challenge</button>
|
|
170
|
+
<p class="daily-note" id="daily-note" aria-live="polite"></p>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="daily-side">
|
|
173
|
+
<h3 class="daily-board-title">Today's top 10</h3>
|
|
174
|
+
<ol class="daily-board" id="daily-board"></ol>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
162
178
|
<div class="trivia-card" id="trivia-setup">
|
|
163
179
|
<h2>Quick quiz</h2>
|
|
164
180
|
<p class="trivia-help">10 questions, 15 seconds each. Faster answers and streaks score more. Keys 1β4 answer too.</p>
|
|
@@ -185,7 +201,7 @@
|
|
|
185
201
|
</div>
|
|
186
202
|
|
|
187
203
|
<h2 class="trivia-sites-title">Daily puzzles and more trivia</h2>
|
|
188
|
-
<p class="trivia-help">
|
|
204
|
+
<p class="trivia-help">The ones marked β don't allow being shown inside other sites, so they open in a new tab.</p>
|
|
189
205
|
<div class="trivia-sites" id="trivia-sites"></div>
|
|
190
206
|
<p class="trivia-credit">Quiz questions: <a href="https://opentdb.com/" target="_blank" rel="noopener noreferrer">Open Trivia Database</a>, CC BY-SA 4.0.</p>
|
|
191
207
|
</div>
|
|
@@ -414,7 +430,8 @@
|
|
|
414
430
|
|
|
415
431
|
<div class="set-group">
|
|
416
432
|
<h2>Your data</h2>
|
|
417
|
-
<div class="set-row"><span>Recently played</span><button class="pill-btn" type="button" id="set-clear-recent">Clear</button></div> <div class="set-row"><span>
|
|
433
|
+
<div class="set-row"><span>Recently played</span><button class="pill-btn" type="button" id="set-clear-recent">Clear</button></div> <div class="set-row"><span>Site tour</span><button class="pill-btn" type="button" id="set-tour">Show the tour again</button></div>
|
|
434
|
+
<div class="set-row"><span>All settings</span><button class="pill-btn danger" type="button" id="set-reset">Reset to default</button></div>
|
|
418
435
|
</div>
|
|
419
436
|
</section>
|
|
420
437
|
</main>
|
|
@@ -524,6 +541,20 @@
|
|
|
524
541
|
|
|
525
542
|
<div class="toast" id="toast" role="status" aria-live="polite"></div>
|
|
526
543
|
|
|
544
|
+
<!-- First-visit tour (also from Settings β Site tour) -->
|
|
545
|
+
<div class="tour" id="tour" hidden>
|
|
546
|
+
<div class="tour-spot" id="tour-spot"></div>
|
|
547
|
+
<div class="tour-card" id="tour-card" role="dialog" aria-modal="true" aria-labelledby="tour-title">
|
|
548
|
+
<p class="tour-step" id="tour-step"></p>
|
|
549
|
+
<h2 id="tour-title"></h2>
|
|
550
|
+
<p class="tour-text" id="tour-text"></p>
|
|
551
|
+
<div class="tour-btns">
|
|
552
|
+
<button class="text-btn" type="button" id="tour-skip">Skip tour</button>
|
|
553
|
+
<span><button class="text-btn" type="button" id="tour-back">Back</button><button class="pill-btn" type="button" id="tour-next">Next</button></span>
|
|
554
|
+
</div>
|
|
555
|
+
</div>
|
|
556
|
+
</div>
|
|
557
|
+
|
|
527
558
|
|
|
528
559
|
<script src="config.js"></script>
|
|
529
560
|
<script src="app.js"></script>
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -946,3 +946,40 @@ html.christmas[data-theme="dark"] .xmas { display: block; }
|
|
|
946
946
|
.trivia-site-text { padding: 10px 0 11px 12px; }
|
|
947
947
|
.trivia-site-how { padding-right: 12px; }
|
|
948
948
|
.trivia-select { height: 34px; min-width: 240px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 13px; font-weight: 600; }
|
|
949
|
+
|
|
950
|
+
/* ---------- Daily trivia challenge ---------- */
|
|
951
|
+
.trivia-card.daily[hidden] { display: none; }
|
|
952
|
+
.daily-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
|
|
953
|
+
.daily-status { margin: 0 0 14px; font-size: 14px; line-height: 1.5; }
|
|
954
|
+
.daily-name-row input { width: 100%; height: 40px; margin-bottom: 10px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 14px; }
|
|
955
|
+
.daily-name-row[hidden], #daily-start[hidden] { display: none; }
|
|
956
|
+
.daily-note { min-height: 1.2em; margin: 8px 0 0; color: var(--danger, #ef4444); font-size: 13px; }
|
|
957
|
+
.daily-board-title { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
|
|
958
|
+
.daily-board { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
|
|
959
|
+
.daily-board li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 6px; background: var(--soft); font-size: 13px; }
|
|
960
|
+
.daily-board li.me { outline: 1px solid var(--glow-cyan, #22d3ee); }
|
|
961
|
+
.daily-board li:nth-child(1) .daily-rank { color: #facc15; }
|
|
962
|
+
.daily-board li:nth-child(2) .daily-rank { color: #cbd5e1; }
|
|
963
|
+
.daily-board li:nth-child(3) .daily-rank { color: #d97706; }
|
|
964
|
+
.daily-rank { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
965
|
+
.daily-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
|
|
966
|
+
.daily-pts { font-variant-numeric: tabular-nums; color: var(--muted); }
|
|
967
|
+
.daily-board li.daily-empty { display: block; line-height: 32px; color: var(--muted); }
|
|
968
|
+
@media (max-width: 720px) { .daily-grid { grid-template-columns: 1fr; } }
|
|
969
|
+
|
|
970
|
+
/* ---------- First-visit tour ---------- */
|
|
971
|
+
.tour { position: fixed; inset: 0; z-index: 90; }
|
|
972
|
+
.tour[hidden] { display: none; }
|
|
973
|
+
.tour::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
|
|
974
|
+
.tour:has(.tour-spot:not([hidden]))::before { display: none; } /* the spotlight's own shadow darkens the rest */
|
|
975
|
+
.tour-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .6); outline: 2px solid var(--glow-cyan, #22d3ee); transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; pointer-events: none; }
|
|
976
|
+
.tour-spot[hidden] { display: none; }
|
|
977
|
+
.tour-card { position: fixed; width: min(320px, calc(100vw - 24px)); padding: 18px 18px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .8); transition: left .25s ease, top .25s ease; }
|
|
978
|
+
.tour-step { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
|
|
979
|
+
.tour-card h2 { margin: 0 0 6px; font-size: 18px; }
|
|
980
|
+
.tour-text { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
|
|
981
|
+
.tour-btns { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
982
|
+
.tour-btns span { display: flex; gap: 6px; }
|
|
983
|
+
.tour-btns [hidden] { display: none; }
|
|
984
|
+
.tour-btns .pill-btn { color: var(--bg); background: var(--text); border-color: var(--text); }
|
|
985
|
+
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }
|
|
Binary file
|
package/logos/trivia-travle.webp
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|