Theme switch: auto | light | dark, stored in localStorage ls.theme and on the account, applied before first paint on every page
themehead.js is the one source of the tiny inline head script (and of AUTO_DEFAULT, the one constant Marty decides later: 0 = nothing stored keeps the page's current look, light for Control Room and public pages, dark for the sapphire pages; 1 = follow the device). The script sets data-theme on <html> from ls.theme (auto follows prefers-color-scheme and tracks changes live) and exposes window.LSTheme. tools/stamp-theme-head.cjs writes it into every static page before the first stylesheet with data-theme-base on <html>; blog, leaderboard, what's-new, the badge page, the unsubscribe page and the wall 404 read the module directly. The site CSP allows inline scripts by hash only, so themehead.CSP_HASH joins script-src (the script was silently blocked until then).
Account side: accounts.theme (JSON store and MySQL, alterSafe column), in the public account JSON and /api/me; POST /api/my/profile {theme} rides the existing profile save path and never touches the username. cr-shell.js renders a Light / Dark / Auto segmented control in the topbar of every Control Room screen and paints every .theme-seg on the page (the Profile pane gains an Appearance card with the same control); a click applies at once, saves locally and to the account when signed in; at sign-in the account value wins over the local one, and a local choice is pushed up when the account has none yet. view.html stops reading an undefined --bg so its light variant has a light stage. ?v= tags bumped on every changed stylesheet and script (20261101t / ls20261101t).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+16
-10
@@ -1,14 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>More · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261020s">
|
||||
<style>@import url("/assets/site.css?v=ls20260916a") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261018pc2">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>@import url("/assets/site.css?v=ls20261101t") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -590,7 +591,7 @@
|
||||
campaigns just like purchased ones.</p>
|
||||
<p><span class="badge" id="earnProgress">…</span>
|
||||
<span class="badge" id="earnBalance">…</span></p>
|
||||
<div class="card" style="background:rgba(4,8,7,.5)" id="earnStage">
|
||||
<div class="card" style="background:var(--ground-soft)" id="earnStage">
|
||||
<div id="earnAdBox" class="small muted" style="min-height:80px;display:grid;place-items:center">
|
||||
Press the button to open the first ad in a new tab.</div>
|
||||
<p style="margin-top:14px">
|
||||
@@ -609,7 +610,7 @@
|
||||
can't be skipped — the timer runs on our server. You never see your own videos.
|
||||
Prefer a feed? <a href="/shorts">Open Shorts</a> for a full-screen, swipe-to-next experience.</p>
|
||||
<p><span class="badge" id="vidProgress">…</span></p>
|
||||
<div class="card" style="background:rgba(4,8,7,.5)" id="vidStage">
|
||||
<div class="card" style="background:var(--ground-soft)" id="vidStage">
|
||||
<div id="vidBox" class="small muted" style="min-height:120px;display:grid;place-items:center">
|
||||
Press the button to load the first video.</div>
|
||||
<div id="vidWrap" hidden style="max-width:560px;margin:0 auto">
|
||||
@@ -631,7 +632,7 @@
|
||||
<p class="muted small">Visit a member's site in a new tab, stay the required few seconds,
|
||||
pass a quick check, and earn. Each site counts once for you — real, unique human visits.</p>
|
||||
<p><span class="badge" id="vsProgress">…</span></p>
|
||||
<div class="card" style="background:rgba(4,8,7,.5)">
|
||||
<div class="card" style="background:var(--ground-soft)">
|
||||
<div id="vsBox" class="small muted" style="min-height:70px;display:grid;place-items:center">Press the button to load a site to visit.</div>
|
||||
<div id="vsCheck" hidden style="margin-top:10px"><span class="prompt" id="vsPrompt"></span> <span id="vsOpts"></span></div>
|
||||
<p style="margin-top:12px">
|
||||
@@ -866,6 +867,11 @@
|
||||
<p style="margin-top:12px"><button class="btn" id="pfDetailsSave">Save profile</button>
|
||||
<a class="btn small sec" id="pfViewBio" target="_blank" rel="noopener" hidden>View my page</a></p>
|
||||
</div>
|
||||
<div class="card theme-card">
|
||||
<h3>Appearance</h3>
|
||||
<p class="muted small">Light or dark, or Auto to follow your device setting. Saved with your account, so it follows you to any browser you sign in on.</p>
|
||||
<span class="seg theme-seg" role="group" aria-label="Theme"><button type="button" data-theme="light" title="Light theme">Light</button><button type="button" data-theme="dark" title="Dark theme">Dark</button><button type="button" data-theme="auto" title="Follow the device">Auto</button></span>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Your line banner</h3>
|
||||
<p class="muted small">Set a destination link (and a banner image for your wall), and every new
|
||||
@@ -1009,12 +1015,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261023ov"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261025ff"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/tools.js?v=20261011a"></script>
|
||||
<script src="/assets/wallet.js?v=20261021a"></script>
|
||||
<script src="/assets/promo.js?v=20261020bs3"></script>
|
||||
<script src="/assets/my.js?v=20261030pp"></script>
|
||||
<script src="/assets/my.js?v=20261101t"></script>
|
||||
<script src="/assets/chat.js?v=20261016a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user