← back to Linenwallpaper
4-grid hero: drop-in script + crop CSS + initial 4 newest products
b27fd5772b917d05f77b9822a2f74140cec77d7d · 2026-05-14 08:48:45 -0700 · Steve
Files touched
A data/hero-4grid.jsonA public/hero-4grid.jsM public/index.html
Diff
commit b27fd5772b917d05f77b9822a2f74140cec77d7d
Author: Steve <steve@designerwallcoverings.com>
Date: Thu May 14 08:48:45 2026 -0700
4-grid hero: drop-in script + crop CSS + initial 4 newest products
---
data/hero-4grid.json | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++
public/hero-4grid.js | 104 +++++++++++++++++++++++++++++++++++++++++++++++
public/index.html | 10 ++++-
3 files changed, 226 insertions(+), 1 deletion(-)
diff --git a/data/hero-4grid.json b/data/hero-4grid.json
new file mode 100644
index 0000000..fbdf8b2
--- /dev/null
+++ b/data/hero-4grid.json
@@ -0,0 +1,113 @@
+{
+ "cells": [
+ {
+ "kind": "room",
+ "sku": "vaticano-durable-vinyl-dur-72384",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/DUR-72384-sample-clean.jpg?v=1774485305",
+ "title": "Vaticano Durable Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "kind": "pattern",
+ "sku": "paddock-type-ii-vinyl-wallcovering-xpd-48174",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xpd-48174-sample-paddock-type-ii-vinyl-hollywood-wallcoverings.jpg?v=1775728569",
+ "title": "Paddock Type II Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "kind": "room",
+ "sku": "milbanks-metallic-grasscloth-vinyl-dwx-58162",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/dwx-58162-sample-milbanks-metallic-grasscloth-vinyl-hollywood-wallcoverings.jpg?v=1775725617",
+ "title": "Milbanks Metallic Grasscloth Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "kind": "pattern",
+ "sku": "la-voltere-durable-vinyl-dur-72293",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/DUR-72293-sample-clean.jpg?v=1774485070",
+ "title": "la Voltere Durable Vinyl | Hollywood Wallcoverings"
+ }
+ ],
+ "rotation_pool": [
+ {
+ "sku": "vaticano-durable-vinyl-dur-72384",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/DUR-72384-sample-clean.jpg?v=1774485305",
+ "title": "Vaticano Durable Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "paddock-type-ii-vinyl-wallcovering-xpd-48174",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xpd-48174-sample-paddock-type-ii-vinyl-hollywood-wallcoverings.jpg?v=1775728569",
+ "title": "Paddock Type II Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "milbanks-metallic-grasscloth-vinyl-dwx-58162",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/dwx-58162-sample-milbanks-metallic-grasscloth-vinyl-hollywood-wallcoverings.jpg?v=1775725617",
+ "title": "Milbanks Metallic Grasscloth Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "la-voltere-durable-vinyl-dur-72293",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/DUR-72293-sample-clean.jpg?v=1774485070",
+ "title": "la Voltere Durable Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "dwtt-71264-designer-wallcoverings-los-angeles",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/T83044_e31f0cfb-374f-4066-a45d-f56991489743.jpg?v=1733894336",
+ "title": "Metal Linen Metallic Grey | Thibaut"
+ },
+ {
+ "sku": "lovela-faux-vertical-durable-walls-xwo-53619",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/tableau-terra_cotta.jpg?v=1777480910",
+ "title": "Pippy's Peacock - Silver Room Setting Commercial Wallcovering | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "bellaire-faux-finish-durable-walls-xww-53062",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xww-53062-sample-bellaire-faux-finish-durable-hollywood-wallcoverings.jpg?v=1775703542",
+ "title": "Bellaire Faux Finish Durable | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "bellaire-faux-finish-durable-walls-xww-53063",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xww-53063-sample-bellaire-faux-finish-durable-hollywood-wallcoverings.jpg?v=1775703545",
+ "title": "Bellaire Faux Finish Durable | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "paddock-type-ii-vinyl-wallcovering-xpd-48163",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xpd-48163-sample-paddock-type-ii-vinyl-hollywood-wallcoverings.jpg?v=1775728337",
+ "title": "Paddock Type II Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "eatonville-faux-linen-durable-walls-xwt-53320",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xwt-53320-sample-eatonville-faux-linen-durable-hollywood-wallcoverings.jpg?v=1775710834",
+ "title": "Eatonville Faux Linen Durable | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "hawthorne-faux-vertical-silk-durable-walls-xwo-53625",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xwo-53625-sample-hawthorne-faux-vertical-silk-durable-hollywood-wallcoverings.jpg?v=1775716645",
+ "title": "Hawthorne Faux Vertical Silk Durable | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "la-roche-durable-vinyl-dur-72066",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/DUR-72066-sample-clean.jpg?v=1774484242",
+ "title": "La Roche Durable Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "berkeley-type-ii-vinyl-wallcovering-xju-47331",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/xju-47331-sample-berkeley-type-ii-vinyl-hollywood-wallcoverings.jpg?v=1775704900",
+ "title": "Berkeley Type II Vinyl | Hollywood Wallcoverings"
+ },
+ {
+ "sku": "barocco-linen-cream-wallcovering-versace-1",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/667726f3e15a08df98b645c2abdab5a7.jpg?v=1773710515",
+ "title": "Barocco Linen Cream Wallcovering | Versace"
+ },
+ {
+ "sku": "wolfgordonwallcovering_dwwg_obt-9460_8-jpg",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/obt-9460_8.jpg?v=1762302571",
+ "title": "Orbit - Linen | Wolf Gordon Wallcoverings"
+ },
+ {
+ "sku": "hanover-faux-embossed-faux-linen-walls-xwy-53158",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/loom-flax.jpg?v=1777480768",
+ "title": "Hanover Faux Embossed Faux Linen | Hollywood Wallcoverings"
+ }
+ ],
+ "autocycle_seconds": 6,
+ "updated_at": "2026-05-14T15:38:53.382Z",
+ "generated_by": "dw-4grid-fanout.js"
+}
\ No newline at end of file
diff --git a/public/hero-4grid.js b/public/hero-4grid.js
new file mode 100644
index 0000000..1bc244c
--- /dev/null
+++ b/public/hero-4grid.js
@@ -0,0 +1,104 @@
+/**
+ * hero-4grid.js — universal 2×2 rotating hero for DW-family sites.
+ *
+ * What it does:
+ * - Fetches /data/hero-4grid.json on load
+ * - Switches the hero to 4-square mode (data-hero-mode="four-square")
+ * - Paints 4 cells with the configured images
+ * - Auto-cycles each cell every N seconds, rotating through the pool
+ * - Applies object-fit: cover; object-position: center 12% to ENFORCE
+ * the "never show image with header" rule
+ *
+ * Drop-in: <script src="/hero-4grid.js" defer></script>
+ *
+ * Per-site override: set window.Hero4GridConfig = { url, autocycle } before load.
+ */
+(function () {
+ 'use strict';
+ if (window.__hero4GridLoaded) return;
+ window.__hero4GridLoaded = true;
+
+ var CFG = window.Hero4GridConfig || {};
+ var URL = CFG.url || '/data/hero-4grid.json';
+
+ function inject(cellEls, grid) {
+ // Switch hero mode
+ document.documentElement.dataset.heroMode = 'four-square';
+ var cinema = document.querySelector('.cinema');
+ if (!cinema) return;
+ // Build .cinema-grid if absent
+ var gridEl = cinema.querySelector('.cinema-grid');
+ if (!gridEl) {
+ gridEl = document.createElement('div');
+ gridEl.className = 'cinema-grid';
+ cinema.appendChild(gridEl);
+ }
+ gridEl.innerHTML = '';
+ for (var i = 0; i < 4; i++) {
+ var cell = document.createElement('div');
+ cell.className = 'cell hero4-cell';
+ cell.dataset.idx = i;
+ gridEl.appendChild(cell);
+ }
+ // Anti-header crop CSS — applied via inline so it ALWAYS wins
+ var style = document.createElement('style');
+ style.id = 'hero4-crop';
+ style.textContent =
+ '.hero4-cell{background-size:cover !important;background-position:center 12% !important;transition:opacity 600ms ease;}' +
+ '.hero4-cell.swap-out{opacity:0;}';
+ document.head.appendChild(style);
+
+ paint(grid);
+ if (grid.rotation_pool && grid.rotation_pool.length > 4) {
+ startRotation(grid);
+ }
+ }
+
+ function paint(grid) {
+ var cells = document.querySelectorAll('.hero4-cell');
+ for (var i = 0; i < cells.length; i++) {
+ var c = grid.cells[i];
+ if (c && c.image_url) {
+ cells[i].style.backgroundImage = "url('" + c.image_url + "')";
+ cells[i].title = c.title || '';
+ }
+ }
+ }
+
+ function startRotation(grid) {
+ var sec = Number(grid.autocycle_seconds) || 6;
+ var pool = grid.rotation_pool.slice();
+ // Index per cell — start with the next image after the initial 4
+ var nextIdx = [4 % pool.length, 5 % pool.length, 6 % pool.length, 7 % pool.length];
+ var cellIdx = 0;
+ setInterval(function () {
+ if (document.hidden) return; // pause when tab hidden
+ var cells = document.querySelectorAll('.hero4-cell');
+ var cell = cells[cellIdx];
+ if (!cell) return;
+ var next = pool[nextIdx[cellIdx] % pool.length];
+ if (!next || !next.image_url) { cellIdx = (cellIdx + 1) % 4; return; }
+ // Preload then swap
+ var pre = new Image();
+ pre.onload = function () {
+ cell.classList.add('swap-out');
+ setTimeout(function () {
+ cell.style.backgroundImage = "url('" + next.image_url + "')";
+ cell.title = next.title || '';
+ cell.classList.remove('swap-out');
+ }, 600);
+ };
+ pre.src = next.image_url;
+ nextIdx[cellIdx] = (nextIdx[cellIdx] + 4) % pool.length;
+ cellIdx = (cellIdx + 1) % 4;
+ }, sec * 1000);
+ }
+
+ fetch(URL, { credentials: 'same-origin' })
+ .then(function (r) { return r.ok ? r.json() : null; })
+ .then(function (grid) {
+ if (!grid || !grid.cells || !Array.isArray(grid.cells)) return;
+ inject(null, grid);
+ })
+ .catch(function (e) { console.warn('[hero-4grid] fetch failed:', e); });
+})();
diff --git a/public/index.html b/public/index.html
index 9c50eae..7192f43 100644
--- a/public/index.html
+++ b/public/index.html
@@ -186,6 +186,13 @@ textarea:focus-visible,
<meta name="twitter:description" content="linenwallpaper — a curated wallcovering atelier. Free memo samples. Trade service.">
<meta name="twitter:image" content="https://linenwallpaper.com/hero-bg.jpg">
<!-- graphics-loop pass 13: footer + fb -->
+<style id="hero4-anti-header-crop">
+/* Never-show-images-with-headers rule (2026-05-14): every hero image
+ is cropped to center 12% from the top to defeat vendor watermarks /
+ scraped-site chrome / banner overlays. */
+.cinema-bg, .hero4-cell, .cell { background-position: center 12% !important; }
+.card img, .product img { object-position: center 12% !important; }
+</style>
</head>
<body>
<style id="ns-header-modal-styles">
@@ -722,7 +729,8 @@ loadGridPage();
</script>
<!-- ============================================================
DW UNIVERSAL CONTACT MODULE — fashion-house UX
- Inject before </body> in every DW-family sister site.
+ Inject before <script src="/hero-4grid.js" defer></script>
+</body> in every DW-family sister site.
Self-contained: CSS + 4 modals + JS submission handlers.
Uses host site's CSS vars (--bg, --fg, --gold, --rule).
============================================================ -->
← 1d0045a favicon: Mag-7-inspired SVG glyph
·
back to Linenwallpaper
·
hero-4grid: relocate json from data/ to public/ for Express 5ac29df →