1/* global NexT, CONFIG */ 2 3NexT.boot = {}; 4 5NexT.boot.registerEvents = function() { 6 7 NexT.utils.registerScrollPercent(); 8 NexT.utils.registerCanIUseTag(); 9 10 // Mobile top menu bar. 11 document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => { 12 event.currentTarget.classList.toggle('toggle-close'); 13 const siteNav = document.querySelector('.site-nav'); 14 if (!siteNav) return; 15 siteNav.style.setProperty('--scroll-height', siteNav.scrollHeight + 'px'); 16 document.body.classList.toggle('site-nav-on'); 17 }); 18 19 document.querySelectorAll('.sidebar-nav li').forEach((element, index) => { 20 element.addEventListener('click', () => { 21 NexT.utils.activateSidebarPanel(index); 22 }); 23 }); 24 25 window.addEventListener('hashchange', () => { 26 const tHash = location.hash; 27 if (tHash !== '' && !tHash.match(/%\S{2}/)) { 28 const target = document.querySelector(`.tabs ul.nav-tabs li a[href="${tHash}"]`); 29 target && target.click(); 30 } 31 }); 32}; 33 34NexT.boot.refresh = function() { 35 36 /** 37 * Register JS handlers by condition option. 38 * Need to add config option in Front-End at 'scripts/helpers/next-config.js' file. 39 */ 40 CONFIG.prism && window.Prism.highlightAll(); 41 CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img', { 42 background: 'var(--content-bg-color)' 43 }); 44 CONFIG.lazyload && window.lozad('.post-body img').observe(); 45 CONFIG.pangu && window.pangu.spacingPage(); 46 47 CONFIG.exturl && NexT.utils.registerExtURL(); 48 NexT.utils.wrapTableWithBox(); 49 NexT.utils.registerCopyCode(); 50 NexT.utils.registerTabsTag(); 51 NexT.utils.registerActiveMenuItem(); 52 NexT.utils.registerLangSelect(); 53 NexT.utils.registerSidebarTOC(); 54 NexT.utils.registerPostReward(); 55 NexT.utils.registerVideoIframe(); 56}; 57 58NexT.boot.motion = function() { 59 // Define Motion Sequence & Bootstrap Motion. 60 if (CONFIG.motion.enable) { 61 NexT.motion.integrator 62 .add(NexT.motion.middleWares.header) 63 .add(NexT.motion.middleWares.postList) 64 .add(NexT.motion.middleWares.sidebar) 65 .add(NexT.motion.middleWares.footer) 66 .bootstrap(); 67 } 68 NexT.utils.updateSidebarPosition(); 69}; 70 71document.addEventListener('DOMContentLoaded', () => { 72 NexT.boot.registerEvents(); 73 NexT.boot.refresh(); 74 NexT.boot.motion(); 75});
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.