1document.addEventListener("DOMContentLoaded", function () { 2 function createPlayer(src) { 3 var audio = new Audio(src); 4 audio.preload = "auto"; 5 return audio; 6 } 7 8 document.querySelectorAll("a[data-sfx-click], a[data-sfx-hover]").forEach(function (link) { 9 var clickSrc = link.getAttribute("data-sfx-click"); 10 var hoverSrc = link.getAttribute("data-sfx-hover"); 11 var clickAudio = clickSrc ? createPlayer(clickSrc) : null; 12 var hoverAudio = hoverSrc ? createPlayer(hoverSrc) : null; 13 14 if (clickAudio) { 15 link.addEventListener("click", function () { 16 clickAudio.currentTime = 0; 17 clickAudio.play(); 18 }); 19 } 20 21 if (hoverAudio) { 22 link.addEventListener("mouseenter", function () { 23 hoverAudio.currentTime = 0; 24 hoverAudio.play(); 25 }); 26 } 27 }); 28});
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.