1document.addEventListener("DOMContentLoaded", function () { 2 const urlParams = new URLSearchParams(window.location.search); 3 const transition = urlParams.get('transition'); 4 const bodyElement = document.body; 5 const loadingDiv = document.getElementById('loading'); 6 const savedBgGif = sessionStorage.getItem('previousBgGif'); 7 const leftSidebar = document.querySelector('.sidebar--left'); 8 const rightSidebar = document.querySelector('.sidebar--right'); 9 10 if (transition === 'left' || transition === 'right') { 11 bodyElement.classList.add(`swipeIn--${transition}`); 12 13 if (savedBgGif && loadingDiv) { 14 loadingDiv.style.backgroundImage = `url('${savedBgGif}')`; 15 } 16 17 urlParams.delete('transition'); 18 const newUrl = window.location.pathname + 19 (urlParams.toString() ? '?' + urlParams.toString() : ''); 20 window.history.replaceState({}, document.title, newUrl); 21 } 22 23 function navigateWithAnimation(targetUrl, direction) { 24 if (loadingDiv) loadingDiv.style.display = 'block'; 25 26 bodyElement.classList.add( 27 direction === 'left' ? 'fadeOutLeftPrep' : 'fadeOutRightPrep', 28 direction === 'left' ? 'fadeOutLeft' : 'fadeOutRight' 29 ); 30 31 setTimeout(() => { 32 window.location.href = targetUrl; 33 }, 500); 34 } 35 36 function setupSidebarClickHandler(sidebarElement, direction) { 37 if (!sidebarElement) return; 38 39 sidebarElement.onclick = function (event) { 40 event.preventDefault(); 41 42 const currentBgGif = loadingDiv?.dataset.bg; 43 if (currentBgGif) { 44 sessionStorage.setItem('previousBgGif', currentBgGif); 45 } 46 47 const url = new URL(this.href); 48 url.searchParams.set('transition', direction); 49 url.searchParams.set('src', direction === 'left' ? 'idp' : 'bar'); 50 navigateWithAnimation(url.href, direction); 51 }; 52 } 53 54 setupSidebarClickHandler(leftSidebar, 'left'); 55 setupSidebarClickHandler(rightSidebar, 'right'); 56 57 if (bodyElement.classList.contains('swipeIn--right') || bodyElement.classList.contains('swipeIn--left')) { 58 59 setTimeout(() => { 60 bodyElement.classList.add( 61 bodyElement.classList.contains('swipeIn--right') 62 ? 'swipeIn--rightLoaded' 63 : 'swipeIn--leftLoaded' 64 ); 65 }, 500); 66 67 setTimeout(() => { 68 if (bodyElement.classList.contains('swipeIn--right')) { 69 bodyElement.classList.remove('swipeIn--right', 'swipeIn--rightLoaded'); 70 bodyElement.classList.add('swipe--left'); 71 } else { 72 bodyElement.classList.remove('swipeIn--left', 'swipeIn--leftLoaded'); 73 bodyElement.classList.add('swipe--right'); 74 } 75 76 if (loadingDiv?.dataset.bg) { 77 loadingDiv.style.backgroundImage = `url('${loadingDiv.dataset.bg}')`; 78 } 79 80 sessionStorage.removeItem('previousBgGif'); 81 }, 1000); 82 } else { 83 const sidebar = document.querySelector('.swipeNavigation .sidebar'); 84 const position = sidebar?.classList.contains('sidebar--left') ? 'left' : 'right'; 85 86 if (position === 'left') { 87 bodyElement.classList.add('swipe--left'); 88 } else { 89 bodyElement.classList.add('swipe--right'); 90 } 91 92 sessionStorage.removeItem('previousBgGif'); 93 } 94 95 // Detect back/forward navigation & fix stuck loader 96 window.addEventListener('pageshow', function (event) { 97 const isBackOrForward = event.persisted || window.performance.getEntriesByType("navigation")[0]?.type === "back_forward"; 98 99 if (isBackOrForward) { 100 if (loadingDiv) loadingDiv.style.display = 'none'; 101 } 102 }); 103});
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.