1(function(){ 2 'use strict'; 3 var host=document.getElementById('header-user');if(!host||window.XDMemberDeviceStarted)return; 4 window.XDMemberDeviceStarted=true; 5 var rootKey='xd_member_browser_v1',started=false,observer; 6 function read(key){try{var value=localStorage.getItem(key);if(value!==null)return value;}catch(e){}try{return sessionStorage.getItem(key);}catch(ignore){return null;}} 7 function save(key,value){try{localStorage.setItem(key,value);return true;}catch(e){try{sessionStorage.setItem(key,value);return true;}catch(ignore){return false;}}} 8 function collect(marker){ 9 if(!marker.isConnected||document.visibilityState==='hidden')return; 10 var mid=marker.getAttribute('data-device-member'),token=marker.getAttribute('data-device-token'); 11 if(!/^[1-9][0-9]*$/.test(mid||'')||!token)return; 12 var throttleKey='xd_member_device_seen_v1:'+mid,now=Date.now(); 13 if(Number(read(throttleKey)||0)>now)return; 14 var id=read(rootKey); 15 if(!/^[a-f0-9]{32}$/.test(id||'')){ 16 if(!window.crypto||!crypto.getRandomValues)return; 17 var bytes=new Uint8Array(16);crypto.getRandomValues(bytes); 18 id=Array.from(bytes,function(n){return ('0'+n.toString(16)).slice(-2);}).join('');if(!save(rootKey,id))return; 19 } 20 var tz='';try{tz=Intl.DateTimeFormat().resolvedOptions().timeZone||'';}catch(e){} 21 var data={v:1,id:id,screen:[Math.round(screen.width||0),Math.round(screen.height||0)],depth:Math.round(screen.colorDepth||0),cores:Math.round(navigator.hardwareConcurrency||0),touch:navigator.maxTouchPoints>0?1:0,tz:tz,lang:String(navigator.language||'').slice(0,24)}; 22 // Short backoff on failure; no retry loop and no navigation blocking. 23 if(!save(throttleKey,String(now+300000)))return; 24 var xhr=new XMLHttpRequest();xhr.open('POST','/user/device_observe.php',true);xhr.timeout=4000; 25 xhr.setRequestHeader('Content-Type','application/json');xhr.setRequestHeader('X-Device-Token',token); 26 xhr.onload=function(){if(xhr.status===200){try{if(JSON.parse(xhr.responseText).ok)save(throttleKey,String(Date.now()+1800000));}catch(e){}}}; 27 xhr.send(JSON.stringify(data)); 28 } 29 function check(){ 30 var marker=host.querySelector('[data-device-member][data-device-token]'); 31 if(!marker||started)return;started=true;if(observer)observer.disconnect(); 32 function run(){if(document.visibilityState==='hidden'){document.addEventListener('visibilitychange',function visible(){if(document.visibilityState==='visible'){document.removeEventListener('visibilitychange',visible);collect(marker);}});}else collect(marker);} 33 if(window.requestIdleCallback)requestIdleCallback(run,{timeout:2500});else setTimeout(run,1200); 34 } 35 check();if(!started){observer=new MutationObserver(check);observer.observe(host,{childList:true,subtree:true});} 36})();
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.