1(function(){'use strict';var i18n=(window.jdData&&window.jdData.i18n)||{};function initSearch(){var toggle=document.querySelector('.jd-search-toggle');var panel=document.getElementById('jd-search');if(!toggle||!panel){return} 2toggle.addEventListener('click',function(){var open=panel.dataset.open==='true';panel.dataset.open=open?'false':'true';toggle.setAttribute('aria-expanded',String(!open));if(!open){var field=panel.querySelector('input[type="search"]');if(field){field.focus()}}});document.addEventListener('keydown',function(e){if(e.key==='Escape'&&panel.dataset.open==='true'){panel.dataset.open='false';toggle.setAttribute('aria-expanded','false');toggle.focus()}})} 3function initDrawer(){var burger=document.querySelector('.jd-burger');var drawer=document.getElementById('jd-drawer');if(!burger||!drawer){return} 4var closeBtn=drawer.querySelector('.jd-drawer-close');var lastFocus=null;function focusables(){return drawer.querySelectorAll('a[href], button:not([disabled]), input, [tabindex]:not([tabindex="-1"])')} 5function open(){lastFocus=document.activeElement;drawer.dataset.open='true';burger.setAttribute('aria-expanded','true');document.body.classList.add('jd-locked');var first=focusables()[0];if(first){first.focus()}} 6function close(){drawer.dataset.open='false';burger.setAttribute('aria-expanded','false');document.body.classList.remove('jd-locked');if(lastFocus){lastFocus.focus()}} 7burger.addEventListener('click',open);if(closeBtn){closeBtn.addEventListener('click',close)} 8drawer.addEventListener('keydown',function(e){if(e.key==='Escape'){close();return} 9if(e.key!=='Tab'){return} 10var items=focusables();if(!items.length){return} 11var first=items[0];var last=items[items.length-1];if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus()}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus()}});window.addEventListener('resize',function(){if(window.innerWidth>900&&drawer.dataset.open==='true'){close()}})} 12function initStickyHeader(){var bar=document.querySelector('.jd-topbar');if(!bar){return} 13var COMPACT_AT=120;var HIDE_AT=320;var DELTA=10;var last=window.scrollY;var lastVH=window.innerHeight;var ticking=!1;function update(){var vh=window.innerHeight;if(vh!==lastVH){lastVH=vh;last=window.scrollY;ticking=!1;return} 14var maxY=Math.max(0,document.documentElement.scrollHeight-vh);var y=Math.min(Math.max(window.scrollY,0),maxY);var drawer=document.getElementById('jd-drawer');var search=document.getElementById('jd-search');var panelOpen=(drawer&&drawer.dataset.open==='true')||(search&&search.dataset.open==='true');bar.dataset.compact=y>COMPACT_AT?'true':'false';if(panelOpen||y<=HIDE_AT||y>=maxY-2){bar.dataset.hidden='false'}else if(Math.abs(y-last)>DELTA){bar.dataset.hidden=y>last?'true':'false'} 15last=y;ticking=!1} 16function onScroll(){if(!ticking){ticking=!0;window.requestAnimationFrame(update)}} 17window.addEventListener('scroll',onScroll,{passive:!0});window.addEventListener('orientationchange',function(){lastVH=window.innerHeight;bar.dataset.hidden='false'});if(window.visualViewport){window.visualViewport.addEventListener('resize',function(){lastVH=window.innerHeight;last=window.scrollY})} 18bar.addEventListener('focusin',function(){bar.dataset.hidden='false'});
18update()} 19function initGauge(){var gauge=document.querySelector('.jd-gauge');var article=document.querySelector('.jd-post article');if(!gauge||!article){return} 20var pct=gauge.querySelector('.jd-gauge__pct');var ticking=!1;function measure(){var start=article.getBoundingClientRect().top+window.scrollY;var span=Math.max(article.offsetHeight-window.innerHeight,1);var run=(window.scrollY-start)/span;var clamped=Math.min(1,Math.max(0,run));gauge.style.setProperty('--_progress',clamped.toFixed(4));if(pct){pct.textContent=Math.round(clamped*100)+'%'} 21ticking=!1} 22function onScroll(){if(!ticking){ticking=!0;window.requestAnimationFrame(measure)}} 23window.addEventListener('scroll',onScroll,{passive:!0});window.addEventListener('resize',onScroll,{passive:!0});measure()} 24function initToc(){var toc=document.querySelector('.jd-toc');if(!toc||!('IntersectionObserver' in window)){return} 25var links={};toc.querySelectorAll('a[href^="#"]').forEach(function(a){links[a.getAttribute('href').slice(1)]=a});var headings=document.querySelectorAll('.jd-post__content h2[id]');if(!headings.length){return} 26var observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){var link=links[entry.target.id];if(!link){return}
27if(entry.isIntersecting){Object.keys(links).forEach(function(k){links[k].removeAttribute('aria-current')});link.setAttribute('aria-current','true')}})},{rootMargin:'-10% 0px -75% 0px',threshold:0});headings.forEach(function(h){observer.observe(h)})} 28function initCopy(){document.querySelectorAll('.jd-copy').forEach(function(btn){btn.addEventListener('click',function(){var url=btn.dataset.url||window.location.href;function done(ok){var label=btn.querySelector('.jd-sr');btn.classList.toggle('is-copied',ok);if(label){label.textContent=ok?(i18n.copied||'Link copied'):(i18n.copyFailed||'Copy failed')} 29window.setTimeout(function(){btn.classList.remove('is-copied')},2000)} 30if(navigator.clipboard&&window.isSecureContext){navigator.clipboard.writeText(url).then(function(){done(!0)}).catch(function(){done(!1)})}else{done(!1)}})})} 31function initFind(){document.querySelectorAll('.jd-find').forEach(function(form){var endpoint=form.getAttribute('action');var field=form.querySelector('.jd-find__field');var btn=form.querySelector('.jd-find__submit');var msg=document.getElementById(form.dataset.msg);if(!field||!btn){return} 32function say(state,text){if(!msg){return} 33msg.dataset.state=state;msg.textContent=text} 34field.addEventListener('input',function(){field.removeAttribute('aria-invalid');say('','')});form.addEventListener('submit',function(e){var value=(field.value||'').trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value)){e.preventDefault();field.setAttribute('aria-invalid','true');field.focus();say('error',i18n.badEmail||'That address doesnât look right.');return} 35if(!window.fetch){return} 36e.preventDefault();btn.classList.add('is-loading');btn.disabled=!0;say('','');var status=0;fetch(endpoint,{method:'POST',body:new FormData(form),credentials:'same-origin',headers:{'X-Requested-With':'fetch'}}).then(function(r){status=r.status;return r.json().catch(function(){return null})}).then(function(data){if(data&&data.ok){say('success',data.message||'You\u2019re in.');form.reset();return} 37field.setAttribute('aria-invalid','true');if(data&&data.message){say('error',data.message);return} 38if(window.console&&console.error){console.error('[The Find] Non-JSON response from '+endpoint+' - HTTP '+status)} 39say('error',(i18n.blocked||'The signup could not be delivered')+(status?' (HTTP '+status+')':''))}).catch(function(){say('error',navigator.onLine?(i18n.signupFail||'Something went wrong.'):(i18n.offline||'You appear to be offline.'))}).then(function(){btn.classList.remove('is-loading');btn.disabled=!1})})})} 40var STORE='jd:read';function readSet(){try{return new Set(JSON.parse(window.localStorage.getItem(STORE)||'[]'))}catch(e){return new Set()}} 41function initReadState(){var seen=readSet();document.querySelectorAll('.jd-card').forEach(function(card){var link=card.querySelector('.jd-card__title a');if(!link){return} 42if(seen.has(link.pathname)){card.dataset.read='true'}});if(document.body.classList.contains('single')){window.setTimeout(function(){try{var s=readSet();s.add(window.location.pathname);window.localStorage.setItem(STORE,JSON.stringify(Array.from(s).slice(-300)))}catch(e){}},8000)}} 43function boot(){initStickyHeader();initSearch();initDrawer();initCopy();initFind();initReadState();initToc();initGauge()} 44if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',boot)}else{boot()}}())
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.