1// Confirm before unload 2function confirmBeforeUnload(e) { 3 if (localStorage.getItem('confirmationEnabled') === 'true' && (e.clientY < 0 || e.clientY === undefined)) { 4 var confirmationMessage = 'Are you sure you want to leave? You may lose your progress.'; 5 e.returnValue = confirmationMessage; 6 return confirmationMessage; 7 } 8} 9 10window.addEventListener('beforeunload', confirmBeforeUnload); 11 12document.addEventListener('DOMContentLoaded', function() { 13 // Handle confirmation toggle 14 var toggleConfirmation = document.getElementById('toggleConfirmation'); 15 if (localStorage.getItem('confirmationEnabled') === 'true') { 16 toggleConfirmation.checked = true; 17 } 18 19 // Handle FPS counter 20 if (localStorage.getItem('fpsCounterEnabled') === 'true') { 21 loadFpsCounterScript(); 22 document.getElementById('fps').style.display = 'block'; 23 } else { 24 document.getElementById('fps').style.display = 'none'; 25 } 26 27 function loadFpsCounterScript() { 28 if (!document.getElementById('fpsCounterScript')) { 29 var script = document.createElement('script'); 30 script.id = 'fpsCounterScript'; 31 script.src = 'jsload/fpsCounter.js'; 32 document.body.appendChild(script); 33 } 34 } 35 36 function unloadFpsCounterScript() { 37 var script = document.getElementById('fpsCounterScript'); 38 if (script) { 39 script.remove(); 40 } 41 document.getElementById('fps').innerHTML = "--"; 42 document.getElementById('fps').style.display = 'none'; 43 } 44});
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.