FREE SHIPPING ON EVERY ORDER · 30-DAY RETURNS & EXCHANGES
bottom of page
/* ============================================================
TG HERO PRELOAD + SKELETON v3 — TrippyGame category pages
(2026-10-15)
------------------------------------------------------------
1. PRELOAD: the category hero image (the mobile LCP) is
preloaded at Body-End with imagesrcset (1440/1320/980),
before the two CMS queries + VEVO hydration discover it.
2. SKELETON: the VEVO element paints nothing for the first
~15 s (Wix hydration + CMS + renderer). As soon as the
element appears, a fixed full-viewport hero image fills
the screen; it is removed the moment the renderer
hydrates with real content. LCP is then captured at first
paint instead of after hydration.
Install: Wix Dashboard → Paramètres → Code personnalisé →
Pages: All pages → Placement: Body - End.
MAINTENANCE: media ids captured from the live renderer
2026-10-15. If a category hero changes in the CMS, update
its media id (grab the rendered img src). Stale entries only
waste a preload fetch — rendering never breaks.
============================================================ */
(function () {
if (window.__tgHeroPreload) return;
window.__tgHeroPreload = true;
var HEROES = {
'/tops': 'f19971_b6ff29d251484b44a7919fceb50da214~mv2.jpg',
'/new-in': 'f19971_10dc91b450e24511a9cb18fe62b6d244~mv2.jpg',
'/bottoms': 'f19971_56d4cc73ddfe450493546e38a15a0405~mv2.jpg',
'/outerwear': 'f19971_d201905b565b448cae3d248a32b234fd~mv2.jpg',
'/accessories': 'f19971_4a171c8ee2994c9eb36bd6844b6ec1d0~mv2.jpg',
'/hoodies': 'f19971_a87fc9e230b944e18a277c3739fc9e1b~mv2.jpg',
'/sport': 'f19971_6775d89bbe964063a6a61b2d8b850d96~mv2.jpg',
'/shoes-boots': 'f19971_7ef0e305728e4098ac79dcabe4e93f9d~mv2.jpg',
'/bags': 'f19971_1ac7893534d542a08cec88d4b914208c~mv2.jpg'
};
var media = HEROES[location.pathname.replace(/\/+$/, '') || '/'];
if (!media) return;
var B = 'https://static.wixstatic.com/media/' + media + '/v1/fit/';
var T = ',q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/file.jpg';
var SRCSET = B + 'w_1440,h_1440' + T + ' 1440w, ' +
B + 'w_1320,h_1320' + T + ' 1320w, ' +
B + 'w_980,h_980' + T + ' 980w';
/* ---- 1. preload ---- */
var l = document.createElement('link');
l.rel = 'preload';
l.as = 'image';
l.fetchPriority = 'high';
l.imagesrcset = SRCSET;
l.imagesizes = '100vw';
document.head.appendChild(l);
/* ---- 2. skeleton ---- */
function hydrated(host) {
try {
return !!host.shadowRoot &&
Array.prototype.some.call(host.shadowRoot.children, function (c) { return c.tagName !== 'STYLE'; });
} catch (e) { return false; }
}
function whenHost(cb) {
var el = document.querySelector('wix-default-custom-element');
if (el) return cb(el);
var mo = new MutationObserver(function () {
var el = document.querySelector('wix-default-custom-element');
if (el) { mo.disconnect(); cb(el); }
});
mo.observe(document.documentElement, { childList: true, subtree: true });
setTimeout(function () { mo.disconnect(); }, 30000);
}
whenHost(function (host) {
if (hydrated(host)) return;
var img = document.createElement('img');
img.alt = '';
img.setAttribute('aria-hidden', 'true');
img.src = B + 'w_1320,h_1320' + T;
img.srcset = SRCSET;
img.sizes = '100vw';
img.style.cssText =
'position:fixed;inset:0;width:100vw;height:100vh;object-fit:cover;' +
'filter:brightness(.55);z-index:1;pointer-events:none;';
document.body.appendChild(img);
var ticks = 0;
var iv = setInterval(function () {
ticks++;
if (hydrated(host) || !host.isConnected || ticks > 200) {
img.remove();
clearInterval(iv);
}
}, 150);
});
})();
/* ============================================================
ORIGINKIT A11Y PATCH — TrippyGame VEVO headings (2026-10-15)
------------------------------------------------------------
The VEVO renderer splits titles on "|" into block spans for the
kinetic-type animation, which consumes word separators in DOM
text (screen readers / copy-paste see "Stop dressingbasic.").
The scene configs in the DOM carry the true titles, so this
patch copies them onto each heading as aria-label.
Install: Wix Dashboard → Code personnalisé → All pages →
Body - End. Idempotent (only sets aria-label when absent),
safe with renderer updates, covers Wix SPA re-renders ~30 s.
Verify after publish: h1 exposes
aria-label="Stop dressing basic." on trippygame.com.
============================================================ */
(function () {
if (window.__tgA11yPatch) return;
window.__tgA11yPatch = true;
var clean = function (s) {
return String(s || '').replace(/\|/g, ' ').replace(/\s+/g, ' ').trim();
};
var pass = function () {
var walk = function (root, depth) {
if (depth > 8) return;
var els = root.querySelectorAll('*');
for (var i = 0; i < els.length; i++) {
var el = els[i];
if (el.tagName === 'VEVO-SCENE' && el.shadowRoot) {
var c = {};
try { c = JSON.parse(el.getAttribute('config') || '{}'); } catch (e) { c = {}; }
var t = clean(c.headline || c.title);
if (t) {
var h = el.shadowRoot.querySelector('h1, h2');
if (h && !h.getAttribute('aria-label')) h.setAttribute('aria-label', t);
}
}
if (el.shadowRoot) walk(el.shadowRoot, depth + 1);
}
};
walk(document, 0);
};
pass();
var ticks = 0;
var iv = setInterval(function () {
pass();
if (++ticks > 20) clearInterval(iv);
}, 1500);
window.addEventListener('popstate', function () { ticks = 0; });
})();