/* CASINO Collaborators page: big clear names over each tile, and a chosen project as each director's preview. C = director page -> [start of project link on their page, loop file name or '' for still image only]. */ (function () { if ((location.pathname.replace(/\/+$/, '') || '/') !== '/collaborators') return; var F = 'https://fabrikmedia.blob.core.windows.net/2akdc/files/'; var C = { '/theo-adams': ['fka-twigs-body-high', ''], '/charlotte-rutherford': ['pinkpantheress-stateside', 'stateside2-loop'], '/loys-assal': ['missu-sweat', 'sweat-loop-v2'], '/vasso-vu': ['say-now-hot', 'saynow-loop'], '/joseph-wilson': ['love-bailey', 'bailey2-loop'] }; document.documentElement.classList.add('cs-collab'); var st = document.createElement('style'); st.textContent = 'html.cs-collab .col.item .placeholder{position:relative;overflow:hidden;background:#111}' + 'html.cs-collab .col.item .placeholder video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .4s}' + 'html.cs-collab .col.item .placeholder video.on{opacity:1}' + 'html.cs-collab .col.item .overlay{position:absolute!important;inset:0!important;opacity:1!important;display:flex!important;align-items:center!important;justify-content:center!important;' + 'background:rgba(0,0,0,.28)!important;padding:0!important;width:auto!important;height:auto!important;transform:none!important;transition:background .3s!important;pointer-events:none}' + 'html.cs-collab .col.item:hover .overlay{background:rgba(0,0,0,.08)!important}' + 'html.cs-collab .col.item .overlay *{position:static!important;transform:none!important;text-align:center!important}' + 'html.cs-collab .col.item .overlay strong{color:#fff!important;font-family:"Hanken Grotesk",Arial,sans-serif!important;font-weight:800!important;' + 'text-transform:uppercase;letter-spacing:.04em;font-size:clamp(22px,2.6vw,40px)!important;line-height:1.1!important;text-shadow:0 2px 18px rgba(0,0,0,.45)}' + 'html.cs-collab .col.item .overlay .thumbnail-subtitle{display:none!important}' + 'html.cs-collab .col.item a.project-link{position:relative;display:block}' + '@media (min-width:576px){html.cs-collab .col.item{width:50%!important;max-width:50%!important;flex:0 0 50%!important}}'; document.head.appendChild(st); function go() { document.querySelectorAll('.col.item a.project-link').forEach(function (a) { var dir = a.getAttribute('href'), c = C[dir]; if (!c) return; var ph = a.querySelector('.placeholder'), img = ph && ph.querySelector('img'); // Overlay must sit over the image, inside the link var ov = a.querySelector('.overlay'); if (ov && ph && ov.parentNode !== ph) ph.appendChild(ov); // Swap the still for the chosen project's thumbnail (taken from the director's own page) fetch(dir, { credentials: 'same-origin' }).then(function (r) { return r.text(); }).then(function (t) { var d = new DOMParser().parseFromString(t, 'text/html'); var p = [].find.call(d.querySelectorAll('.col.item a'), function (x) { return (x.getAttribute('href') || '').indexOf('/portfolio/' + c[0]) === 0; }); var si = p && p.querySelector('img'); if (!si || !img) return; ['data-srcset', 'srcset', 'data-src', 'src'].forEach(function (k) { var v = si.getAttribute(k); if (v) img.setAttribute(k, v); }); var best = (si.getAttribute('data-srcset') || '').split(',').pop().trim().split(' ')[0] || si.getAttribute('data-src'); if (best) { img.removeAttribute('srcset'); img.src = best; } }).catch(function () {}); if (c[1] && ph) { var v = document.createElement('video'); v.muted = true; v.loop = true; v.autoplay = true; v.playsInline = true; v.setAttribute('muted', ''); v.setAttribute('playsinline', ''); v.preload = 'auto'; v.src = F + c[1] + '.mp4'; v.addEventListener('playing', function () { v.classList.add('on'); }); ph.insertBefore(v, ov && ov.parentNode === ph ? ov : null); var p = v.play(); if (p && p.catch) p.catch(function () {}); } }); } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', go); else go(); })();