1const tickSound = new Audio("/sounds/tick.wav"); 2const tockSound = new Audio("/sounds/tock.wav"); 3 4tickSound.volume = 0.5; 5 6tickSound.preload = "auto"; 7tockSound.preload = "auto"; 8 9let lastTickTime = 0; 10let lastRemainingSeconds = null; 11 12function playTickAndTock() { 13 const nowPerf = performance.now(); 14 const now = new Date(); 15 16 if (nowPerf - lastTickTime >= 900) { 17 tickSound.currentTime = 0; 18 tickSound.play().catch(() => {}); 19 lastTickTime = nowPerf; 20 } 21 22 const midnight = new Date( 23 now.getFullYear(), 24 now.getMonth(), 25 now.getDate() + 1, 26 0, 0, 0, 0 27 ); 28 29 let remaining = midnight - now; 30 if (remaining < 0) remaining = 0; 31 32 const remainingSeconds = Math.floor(remaining / 1000); 33 34 if ( 35 lastRemainingSeconds !== null && 36 lastRemainingSeconds > 0 && 37 remainingSeconds === 0 38 ) { 39 tockSound.currentTime = 0; 40 tockSound.play().catch(() => {}); 41 } 42 43 lastRemainingSeconds = remainingSeconds; 44} 45 46playTickAndTock(); 47setInterval(playTickAndTock, 1000);
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.