1(function() { 2 function getNavigationType() { 3 const entry = performance.getEntriesByType('navigation')[0]; 4 if (entry) return entry.type; 5 if (!performance.navigation) return 'navigate'; 6 if (performance.navigation.type === 0) return 'navigate'; 7 if (performance.navigation.type === 1) return 'reload'; 8 return 'back_forward'; 9 } 10 11 const navigationType = getNavigationType(); 12 const isReload = navigationType === 'reload'; 13 const isSameTabReload = isReload && sessionStorage.getItem('pageVisited') === 'true'; 14 const lastHeartbeat = localStorage.getItem('delusionist_lastHeartbeat'); 15 const hasActiveTabs = lastHeartbeat && (Date.now() - parseInt(lastHeartbeat)) < 3000; 16 const isTabDuplicate = !isReload && navigationType === 'navigate' && 17 localStorage.getItem('delusionist_pageVisited') === 'true' && hasActiveTabs; 18 19 if (isSameTabReload || isTabDuplicate) { 20 const style = document.createElement('style'); 21 style.textContent = '#loadingScreen { display: none !important; }'; 22 document.head.appendChild(style); 23 } else if (navigationType === 'navigate' && !hasActiveTabs) { 24 localStorage.removeItem('delusionist_pageVisited'); 25 localStorage.removeItem('delusionist_lastHeartbeat'); 26 } 27 28 sessionStorage.setItem('pageVisited', 'true'); 29 localStorage.setItem('delusionist_pageVisited', 'true'); 30 31 function sendHeartbeat() { 32 localStorage.setItem('delusionist_pageVisited', 'true'); 33 localStorage.setItem('delusionist_lastHeartbeat', Date.now().toString()); 34 } 35 36 let heartbeatInterval = setInterval(sendHeartbeat, 1000); 37 38 document.addEventListener('visibilitychange', function() { 39 clearInterval(heartbeatInterval); 40 if (!document.hidden) { 41 heartbeatInterval = setInterval(sendHeartbeat, 1000); 42 } 43 }); 44 45 function onPageExit() { 46 clearInterval(heartbeatInterval); 47 sendHeartbeat(); 48 } 49 50 window.addEventListener('pagehide', onPageExit); 51 window.addEventListener('beforeunload', onPageExit); 52})();
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.