Theme switch: auto | light | dark, stored in localStorage iap.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, dark everywhere on InstantAdPay; 1 = follow the device). It mirrors LinkSpin's themehead.js with only the storage key (iap.theme), the global (window.IAPTheme) and the event name (iap-theme) changed. The script sets data-theme on <html> from iap.theme (auto follows prefers-color-scheme and tracks changes live). tools/stamp-theme-head.cjs writes it into all 28 static site.css pages before the first stylesheet with data-theme-base="dark" on <html>; the blog, the 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 (without it the script is silently blocked).
Account side: accounts.theme (JSON store and MySQL, alterSafe theme VARCHAR(8)), in the public account JSON and /api/me; POST /api/my/profile {theme} rides the existing profile save path, never touches the username, and does not tap changed() (appearance is not mirrored to LinkSpin, same as LinkSpin's side). common.js owns the client side for every page: paints every .theme-seg, saves a click to the account, and IAP.themeSync lets the account value win over the local one at sign-in (a local choice is pushed up when the account has none yet); my.js calls it from render(). The Light / Dark / Auto segmented control sits in the member-area header (#boTheme) and in a Profile pane "Appearance" card, and in the admin header for the same session. shorts.html pins the dark ink set on its black video stage; view.html stops reading an undefined --bg. ?v= tags bumped on every changed stylesheet and script (20261101th): site.css on all 28 pages, common.js on 25, welcome.js on 17, support.js, my.js, engine-room.js, admin.js, admin-kits.js, blog-page.js.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+17
-10
@@ -1,11 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="dark">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Member area | InstantAdPay</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"dark",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("iap.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.IAPTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("iap.theme",c);else localStorage.removeItem("iap.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("iap-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20261008a">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20261101th">
|
||||
</head>
|
||||
<body class="bo-body">
|
||||
|
||||
@@ -173,6 +174,7 @@
|
||||
<button id="boBurger" aria-label="Menu" type="button">☰</button>
|
||||
<h2 id="boTitle" style="margin:0">Overview</h2>
|
||||
<span class="bo-rehearsal small" id="boRehearsal" hidden></span>
|
||||
<span class="seg theme-seg" id="boTheme" 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 class="ad-strip" id="adStripTop" hidden></div>
|
||||
</header>
|
||||
<main class="bo-content">
|
||||
@@ -661,7 +663,7 @@
|
||||
<button class="subtab" data-earn="inbox" type="button">Inbox Ads<span class="pill" id="inboxBadge2" hidden></span></button>
|
||||
</div>
|
||||
|
||||
<div class="card" id="fbankCard" hidden style="border-color:rgba(180,140,255,.45)">
|
||||
<div class="card" id="fbankCard" hidden style="border-color:var(--violet-line)">
|
||||
<h3 style="margin:0 0 4px">🎯 Friday Bonus Hunts <span class="badge" id="fbankCount" style="margin-left:6px">0 banked</span></h3>
|
||||
<p class="small muted" style="margin:0 0 10px" id="fbankLead">Each day, Saturday through Thursday, open one <b>Inbox Ad</b> and watch one <b>video</b> here. Every day you do both banks one extra PolHunter hunt for Friday.</p>
|
||||
<div id="fbankDays" style="display:flex;flex-wrap:wrap;gap:6px"></div>
|
||||
@@ -687,7 +689,7 @@
|
||||
<p><span class="badge" id="earnProgress">…</span>
|
||||
<span class="badge" id="earnBalance">…</span>
|
||||
<a href="#" id="earnActLink" class="small" title="every credit earned or spent, with the reason">Credit activity</a></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">
|
||||
@@ -706,7 +708,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">
|
||||
@@ -728,7 +730,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">
|
||||
@@ -1056,6 +1058,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
|
||||
@@ -1252,13 +1259,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261023ov"></script><script src="/assets/welcome.js?v=20260923b"></script>
|
||||
<script src="/assets/common.js?v=20261101th"></script><script src="/assets/welcome.js?v=20261101th"></script>
|
||||
<script src="/assets/wallet.js?v=20260911a"></script>
|
||||
<script src="/assets/promo.js?v=20261101ch"></script>
|
||||
<script src="/assets/support.js?v=20261016a"></script>
|
||||
<script src="/assets/my.js?v=20261030ww"></script>
|
||||
<script src="/assets/support.js?v=20261101th"></script>
|
||||
<script src="/assets/my.js?v=20261101th"></script>
|
||||
<script src="/assets/fuel.js?v=20261025ff"></script>
|
||||
<script src="/assets/engine-room.js?v=20261025ff"></script>
|
||||
<script src="/assets/engine-room.js?v=20261101th"></script>
|
||||
<script src="/assets/chat.js?v=20261016n"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user