[object Object]

← back to Hollywood Wallcoverings

feat(theme): add ?theme=N toggle to layout() — mirrors dw-domain-fleet productPage() canonical (commit 34fbe0e). Single block injected after <body> opening, before ns-header-modal-styles. Hidden until ?theme=1|2 or localStorage opt-in.

d87438ca189f83a32624606af0bd6875268ef464 · 2026-05-29 15:12:00 -0700 · Steve Abrams

Files touched

Diff

commit d87438ca189f83a32624606af0bd6875268ef464
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri May 29 15:12:00 2026 -0700

    feat(theme): add ?theme=N toggle to layout() — mirrors dw-domain-fleet productPage() canonical (commit 34fbe0e). Single block injected after <body> opening, before ns-header-modal-styles. Hidden until ?theme=1|2 or localStorage opt-in.
---
 server.js | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/server.js b/server.js
index 63fe4f5..2218fd8 100644
--- a/server.js
+++ b/server.js
@@ -342,6 +342,78 @@ const layout = (title, body, { q='', type='' } = {}) => `<!doctype html>
   <script src="/corner-nav.js" defer></script>
 </head>
 <body>
+<!-- Theme toggle (theme1 / theme2) — query-param-gated preview surface
+     (Steve 2026-05-29). Mirror of dw-domain-fleet shared/render.js productPage()
+     block (commit 34fbe0e). No admin auth → security-by-obscurity: ?theme=2
+     flips to theme2 and persists in localStorage 'wallco-page-theme'. Toggle UI
+     hidden until ?theme=N or localStorage opt-in. Shares the wallco-page-theme
+     localStorage key for cross-site continuity. -->
+<script>
+(function(){
+  var qs = new URLSearchParams(location.search);
+  var fromUrl = qs.get('theme');
+  var saved = null; try { saved = localStorage.getItem('wallco-page-theme'); } catch(e){}
+  var theme = null;
+  if (fromUrl === '2' || fromUrl === 'theme2') theme = 'theme2';
+  else if (fromUrl === '1' || fromUrl === 'theme1') theme = 'theme1';
+  else if (saved === 'theme2' || saved === 'theme1') theme = saved;
+  if (theme) {
+    document.documentElement.setAttribute('data-page-theme', theme);
+    if (fromUrl) { try { localStorage.setItem('wallco-page-theme', theme); } catch(e){} }
+  }
+  /* No opt-in → no attribute set, toggle stays display:none (gate works). */
+})();
+</script>
+<style id="page-theme-css-fleet">
+  [data-page-theme="theme2"] body{
+    --bg:#ffffff !important; --ink:#0a0a0a !important;
+    --muted:#5a5a5a !important; --line:#e5e5e5 !important;
+    --card-bg:#fafafa !important; --accent:#c14a2e !important;
+    background:#fff !important; color:#0a0a0a !important;
+  }
+  [data-page-theme="theme2"] h1,
+  [data-page-theme="theme2"] h2,
+  [data-page-theme="theme2"] h3{ letter-spacing:-0.01em; font-weight:500; }
+  [data-page-theme="theme2"] .card{
+    background:#fafafa !important; border:1px solid #e5e5e5 !important; box-shadow:none !important;
+  }
+  #page-theme-toggle{ display:none; }
+  [data-page-theme] #page-theme-toggle{ display:inline-flex; }
+  #page-theme-toggle{
+    position:fixed; top:96px; right:14px; z-index:90;
+    gap:0; align-items:center;
+    background:rgba(255,255,255,.92); border:1px solid #d8d2c5;
+    border-radius:999px; padding:3px; backdrop-filter:blur(6px);
+    box-shadow:0 2px 10px rgba(0,0,0,.08);
+    font:600 11px ui-sans-serif,system-ui; letter-spacing:.06em; text-transform:uppercase;
+  }
+  #page-theme-toggle button{
+    border:0; background:transparent; color:#5a5048; cursor:pointer;
+    padding:6px 14px; border-radius:999px; font:inherit; transition:all .15s;
+  }
+  #page-theme-toggle button[aria-pressed="true"]{ background:#1a1714; color:#faf7f2; }
+  #page-theme-toggle button:hover:not([aria-pressed="true"]){ color:#1a1714; }
+</style>
+<div id="page-theme-toggle" role="group" aria-label="Page theme">
+  <button type="button" data-theme="theme1" aria-pressed="false">Theme 1</button>
+  <button type="button" data-theme="theme2" aria-pressed="false">Theme 2</button>
+</div>
+<script>
+(function(){
+  var cur = document.documentElement.getAttribute('data-page-theme') || 'theme1';
+  var btns = document.querySelectorAll('#page-theme-toggle button');
+  function sync(t){ btns.forEach(function(b){ b.setAttribute('aria-pressed', b.dataset.theme === t ? 'true' : 'false'); }); }
+  sync(cur);
+  btns.forEach(function(b){
+    b.addEventListener('click', function(){
+      var t = b.dataset.theme;
+      document.documentElement.setAttribute('data-page-theme', t);
+      try { localStorage.setItem('wallco-page-theme', t); } catch(e){}
+      sync(t);
+    });
+  });
+})();
+</script>
 <style id="ns-header-modal-styles">
         .ns-header { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 18px 36px; background: rgba(10,10,10,0.92) !important; backdrop-filter: blur(8px); border-bottom: 1px solid rgba(245,241,232,0.06); }
         .ns-brand { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; }

← 222a6d0 scrub vendor name leaks from products.json source (1 product  ·  back to Hollywood Wallcoverings  ·  fix: strip 3rd-party vendor tokens from product slug (redact 161125d →