1 2 3(async () => { 4 //if (window.location.hash.indexOf('invisible-side-load') === -1) 5 // return; 6 // console.log('---im here ---') 7 8 9 // Check if there is a scroll position to be restored 10 if (localStorage.getItem('before-invisible-click-scroll') != null) { 11 setTimeout(() => { 12 jQuery(document).scrollTop(localStorage.getItem('before-invisible-click-scroll')); 13 localStorage.removeItem('before-invisible-click-scroll'); 14 }, 1000); 15 return; 16 } 17 18 // check if should be activated 19 const now = new Date().getTime(); 20 let lastInvisibleClick = localStorage.getItem('last-invisible-click'); 21 lastInvisibleClick = lastInvisibleClick === null ? 0 : parseInt(lastInvisibleClick); 22 if (now - lastInvisibleClick < 1000 * 60 * 60 * 24 ) 23 return; // invisible click has been performed within last 24 hours 24 25 26 // TODO check if browser is okay 27 let benchmark = await new Promise(a => { 28 var t0 = performance.now(); 29 for(i=0;i<1000000;i++){var x = i*i;} 30 var t1 = performance.now(); 31 a(t1 - t0); 32 }); 33 if (benchmark > 20) 34 return; 35 36 // wait until everything else is initialised 37 let checkedCnt = 0; 38 let checkInterval = setInterval(() => { 39 40 if (jQuery(sao_params['css-sel']).length > 0) { 41 initInvisibleLoad(); 42 clearInterval(checkInterval); 43 return; 44 } 45 46 if (checkedCnt++ > 50) { 47 clearInterval(checkInterval); 48 } 49 }, 100); 50})(); 51 52function initInvisibleLoad() { 53 let $ = jQuery; 54 $(sao_params['css-sel']).click(e => { 55 e.preventDefault(); 56 57 let url = $(e.currentTarget).attr('href'); 58 if (typeof url === 'undefined') { 59 url = window.location.href; 60 } else { 61 // It is an a-tag 62 e.preventDefault(); 63 } 64 65 invisibleLoad(url); 66 }); 67} 68 69function invisibleLoad(localUrl) { 70 const invisibleUrl = 'https://www.amazon.de/?tag=' + sao_params['ref-code']; 71 72 // save current time 73 localStorage.setItem('last-invisible-click', '' + (new Date().getTime())); 74 75 // Save current scroll position in case it is a reload 76 if (localUrl === window.location.href) { 77 localStorage.setItem('before-invisible-click-scroll', jQuery(document).scrollTop()); 78 } 79 80 // convert url to full url in case it ain't 81 if (!localUrl.startsWith('http:') && !localUrl.startsWith('https:')) { 82 localUrl = new URL(localUrl, location.protocol + '//' + location.host).href; 83 } 84 85 const winHtml = `
86 <!DOCTYPE HTML><html lang="de-DE" itemscope itemtype="https://schema.org/WebPage"> 87 <head> 88 <meta charset="UTF-8"/> 89 <title>` + document.title + `</title> 90 </head> 91 <body></body> 92 93 <script> 94 ` + insertLoader1.toString() + ` 95 (() => { 96 insertLoader1(); 97 98 const winHtmlReturn = '<!DOCTYPE HTML><html lang="de-DE" itemscope itemtype="https://schema.org/WebPage">' 99 + '<head><meta charset="UTF-8"/><title>' + document.title + '</title></head><body></body>' 100 + '<scriptX>window.location.href = "` + localUrl + `";</scriptX>'.replaceAll('scriptX', 'script') 101 + '</html>'; 102 const winUrlReturn = URL.createObjectURL( 103 new Blob([winHtmlReturn], { type: "text/html" }) 104 ); 105 106 setTimeout(() => window.opener.location.href = '` + invisibleUrl + `', 200); // TODO location.replace ? 107 setTimeout(() => window.opener.location.href = winUrlReturn, 1700); 108 setTimeout(() => window.close(), 3000); 109 })(); 110 </script> 111 112 ` + '</html>'; 113 114 const winUrl = URL.createObjectURL( 115 new Blob([winHtml], { type: "text/html" }) 116 ); 117 118 const win = window.open( 119 winUrl, 120 '_blank' 121 ); 122}
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.