← back to Corkwallcovering
4-grid hero: drop-in script + crop CSS + initial 4 newest products
a400ef6d88b40bdc253103e090b9a48eece32f06 · 2026-05-14 08:48:23 -0700 · Steve
Files touched
A data/hero-4grid.jsonA public/hero-4grid.jsM public/index.html
Diff
commit a400ef6d88b40bdc253103e090b9a48eece32f06
Author: Steve <steve@designerwallcoverings.com>
Date: Thu May 14 08:48:23 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 | 12 +++++-
3 files changed, 227 insertions(+), 2 deletions(-)
diff --git a/data/hero-4grid.json b/data/hero-4grid.json
new file mode 100644
index 0000000..4b81153
--- /dev/null
+++ b/data/hero-4grid.json
@@ -0,0 +1,113 @@
+{
+ "cells": [
+ {
+ "kind": "room",
+ "sku": "dwrw-76561",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/RS17521_image1.jpg?v=1756312151",
+ "title": "CRK Slate | Rebel Walls"
+ },
+ {
+ "kind": "pattern",
+ "sku": "dwrw-75218",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/R17521_image2.jpg?v=1756326723",
+ "title": "CRK, Slate | Rebel Walls"
+ },
+ {
+ "kind": "room",
+ "sku": "dwrw-76562",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/RS17522_image1.jpg?v=1756312150",
+ "title": "CRK Graphite | Rebel Walls"
+ },
+ {
+ "kind": "pattern",
+ "sku": "dwrw-75219",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/R17522_image2.jpg?v=1756326721",
+ "title": "CRK Graphite | Rebel Walls"
+ }
+ ],
+ "rotation_pool": [
+ {
+ "sku": "dwrw-76561",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/RS17521_image1.jpg?v=1756312151",
+ "title": "CRK Slate | Rebel Walls"
+ },
+ {
+ "sku": "dwrw-75218",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/R17521_image2.jpg?v=1756326723",
+ "title": "CRK, Slate | Rebel Walls"
+ },
+ {
+ "sku": "dwrw-76562",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/RS17522_image1.jpg?v=1756312150",
+ "title": "CRK Graphite | Rebel Walls"
+ },
+ {
+ "sku": "dwrw-75219",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/R17522_image2.jpg?v=1756326721",
+ "title": "CRK Graphite | Rebel Walls"
+ },
+ {
+ "sku": "medici-real-cork-damask-wallpaper-cork-92712",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/c5d302c6b3ec780eb9750776db12e8f0.jpg?v=1745460388",
+ "title": "Medici Real Cork Damask | Phillipe Romano"
+ },
+ {
+ "sku": "godiva-grande-grill-mica-22001-grey-print-with-white-grey-chip-mic-22000",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/a257a20c49f27d10f8a262e7c145c317.jpg?v=1745460680",
+ "title": "Godiva Grande Grill Mica | Phillipe Romano"
+ },
+ {
+ "sku": "dwqw-57952-handle",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/EW11905_324b4dc0-c92b-4cf8-abd5-083a0091d641.jpg?v=1748378831",
+ "title": "Blossom Cork Contemporary Floral - Gold Chip | Architectural Wallcoverings"
+ },
+ {
+ "sku": "medici-real-cork-damask-wallpaper-cork-92709",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/0e435c21e1ebfe5823ec42af931d2a25.jpg?v=1745460394",
+ "title": "Medici Real Cork Damask | Phillipe Romano"
+ },
+ {
+ "sku": "dwtt-70858-designer-wallcoverings-los-angeles",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/T10409_68a9f582-aae1-4d2e-87de-0af11c339892.jpg?v=1733895208",
+ "title": "Mamora Trellis Cork White on Metallic Blush - White on Metallic Blush Wallcovering | Thibaut"
+ },
+ {
+ "sku": "dwtt-70861-designer-wallcoverings-los-angeles",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/T10412_e16d7f5e-9a48-466d-afb6-b3f7d3e2cdbf.jpg?v=1733895200",
+ "title": "Mamora Trellis Cork Beige on White - Beige on White Wallcovering | Thibaut"
+ },
+ {
+ "sku": "dwk-29028-tak-ca01-05-designer-wallcoverings-los-angeles",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/TAKUMI-ROOMSET_TAK-CA01-05__CORK__new.jpg?v=1739409195",
+ "title": "Wash Cork Green - Olive Green Commercial Wallcovering | Koroseal"
+ },
+ {
+ "sku": "purity-cork-wallpaper-1838-wallcoverings",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/2210-163-04-Purity-Cork-2_098c46b2-527f-4499-8121-fa983ad36ccf.jpg?v=1773305261",
+ "title": "Purity - Cork Wallcovering | 1838 Wallcoverings"
+ },
+ {
+ "sku": "pe-1852-mx-maya-50442",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/Maya-50442-DesignerWallcoverings-Los-AngelesMaya-Romanoff-Wallpaper-PE-1852-MX-1.jpg?v=1738861253",
+ "title": "Porto Elo - Rosé Reserve | Maya Romanoff"
+ },
+ {
+ "sku": "pe-1604-maya-50437",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/Maya-50437-DesignerWallcoverings-Los-AngelesMaya-Romanoff-Wallpaper-PE-1604-1.jpg?v=1738861264",
+ "title": "Porto Elo - Nebbiolo Natural | Maya Romanoff"
+ },
+ {
+ "sku": "pe-1670-mx-maya-50441",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/Maya-50441-DesignerWallcoverings-Los-AngelesMaya-Romanoff-Wallpaper-PE-1670-MX-1.jpg?v=1738861254",
+ "title": "Porto Elo - Green Grenache | Maya Romanoff"
+ },
+ {
+ "sku": "pe-1099-maya-50435",
+ "image_url": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/Maya-50435-DesignerWallcoverings-Los-AngelesMaya-Romanoff-Wallpaper-PE-1099-1.jpg?v=1738861269",
+ "title": "Porto Elo - Gamay Gray | Maya Romanoff"
+ }
+ ],
+ "autocycle_seconds": 6,
+ "updated_at": "2026-05-14T15:38:53.300Z",
+ "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 18d1f80..9165c98 100644
--- a/public/index.html
+++ b/public/index.html
@@ -174,7 +174,14 @@ textarea:focus-visible,
<meta name="twitter:description" content="Cork Wallcovering — Cork-bark & sustainable natural wallcoverings.">
<meta name="twitter:image" content="https://corkwallcovering.com/hero-bg.jpg">
<!-- graphics-loop pass 13: footer + fb -->
-<style id="ns-modal-fix">.ns-modal{display:none}.ns-modal.show{display:flex;align-items:center;justify-content:center;position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:1000}.ns-modal-card{background:#faf6ef;color:#1a1714;padding:32px;border-radius:12px;max-width:480px;width:90%;position:relative;box-shadow:0 20px 60px rgba(0,0,0,0.3)}.ns-modal .close-x{position:absolute;top:12px;right:16px;background:transparent;border:0;font-size:24px;cursor:pointer;color:#1a1714}.ns-modal h3{margin:0 0 8px;font-size:22px;font-weight:400}.ns-modal .sub{color:rgba(0,0,0,0.5);margin:0 0 20px;font-size:14px}.ns-actions{display:grid;gap:10px}.ns-action{display:flex;gap:14px;align-items:center;color:inherit;text-decoration:none;padding:14px 16px;border:1px solid rgba(0,0,0,0.12);border-radius:8px}.ns-action:hover{background:rgba(0,0,0,0.04)}.ns-action .ico{font-size:20px}.ns-action .txt{display:flex;flex-direction:column}.ns-action .txt b{font-weight:600}.ns-action .txt span{font-size:12px;color:rgba(0,0,0,0.5)}</style></head>
+<style id="ns-modal-fix">.ns-modal{display:none}.ns-modal.show{display:flex;align-items:center;justify-content:center;position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:1000}.ns-modal-card{background:#faf6ef;color:#1a1714;padding:32px;border-radius:12px;max-width:480px;width:90%;position:relative;box-shadow:0 20px 60px rgba(0,0,0,0.3)}.ns-modal .close-x{position:absolute;top:12px;right:16px;background:transparent;border:0;font-size:24px;cursor:pointer;color:#1a1714}.ns-modal h3{margin:0 0 8px;font-size:22px;font-weight:400}.ns-modal .sub{color:rgba(0,0,0,0.5);margin:0 0 20px;font-size:14px}.ns-actions{display:grid;gap:10px}.ns-action{display:flex;gap:14px;align-items:center;color:inherit;text-decoration:none;padding:14px 16px;border:1px solid rgba(0,0,0,0.12);border-radius:8px}.ns-action:hover{background:rgba(0,0,0,0.04)}.ns-action .ico{font-size:20px}.ns-action .txt{display:flex;flex-direction:column}.ns-action .txt b{font-weight:600}.ns-action .txt span{font-size:12px;color:rgba(0,0,0,0.5)}</style><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">
.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); }
@@ -645,7 +652,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).
============================================================ -->
← 91a5aeb favicon: Mag-7-inspired SVG glyph
·
back to Corkwallcovering
·
hero-4grid: relocate json from data/ to public/ for Express 69df5f1 →