1document.addEventListener("DOMContentLoaded", () => { 2 const portrait = document.querySelector("[data-avatar-swap]"); 3 4 if (portrait) { 5 const togglePortrait = (active) => { 6 portrait.classList.toggle("is-swapped", active); 7 }; 8 9 portrait.addEventListener("mouseenter", () => togglePortrait(true)); 10 portrait.addEventListener("mouseleave", () => togglePortrait(false)); 11 portrait.addEventListener("focusin", () => togglePortrait(true)); 12 portrait.addEventListener("focusout", () => togglePortrait(false)); 13 } 14 15 document.querySelectorAll("[data-hover-preview]").forEach((media) => { 16 const video = media.querySelector("video"); 17 if (!video) { 18 return; 19 } 20 21 const startPreview = () => { 22 media.classList.add("is-previewing"); 23 video.currentTime = 0; 24 const playPromise = video.play(); 25 if (playPromise && typeof playPromise.catch === "function") { 26 playPromise.catch(() => {}); 27 } 28 }; 29 30 const stopPreview = () => { 31 media.classList.remove("is-previewing"); 32 video.pause(); 33 video.currentTime = 0; 34 }; 35 36 media.addEventListener("mouseenter", startPreview); 37 media.addEventListener("mouseleave", stopPreview); 38 media.addEventListener("focusin", startPreview); 39 media.addEventListener("focusout", stopPreview); 40 }); 41});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.