1// GDPR: used only for technical cookies 2function tnp_leads_set_cookie(name, value, time) { 3 var e = new Date(); 4 e.setTime(e.getTime() + time * 24 * 60 * 60 * 1000); 5 document.cookie = name + "=" + value + "; expires=" + e.toGMTString() + "; path=/"; 6} 7 8function tnp_leads_get_cookie(name, def) { 9 var cs = document.cookie.toString().split('; '); 10 var c, n, v; 11 for (var i = 0; i < cs.length; i++) { 12 c = cs[i].split("="); 13 n = c[0]; 14 v = c[1]; 15 if (n == name) 16 return v; 17 } 18 return def; 19} 20 21// For compatibility 22function newsletter_leads_open() { 23 tnp_leads_open(); 24} 25 26function tnp_leads_open() { 27 fetch(tnp_leads_url).then(data => { 28 data.text().then(body => { 29 var modal_body = document.getElementById('tnp-modal-body'); 30 modal_body.innerHTML = body; 31 var modal = document.getElementById('tnp-modal'); 32 modal.style.display = 'block'; 33 //console.log(body); 34 }); 35 }).catch(error => { 36 console.error(error); 37 }); 38} 39 40function tnp_leads_close() { 41 var modal = document.getElementById('tnp-modal'); 42 modal.style.display = 'none'; 43} 44 45function tnp_outside_click(e) { 46 var modal = document.getElementById('tnp-modal'); 47 if (e.target == modal) { 48 modal.style.display = 'none'; 49 } 50} 51 52window.addEventListener('click', tnp_outside_click); 53document.getElementById('tnp-modal-close').addEventListener('click', tnp_leads_close); 54 55if (tnp_leads_popup_test) { 56 tnp_leads_open(); 57} else { 58 if (tnp_leads_get_cookie("newsletter", null) == null) { 59 var count = parseInt(tnp_leads_get_cookie("newsletter_leads", 0)); 60 tnp_leads_set_cookie("newsletter_leads", count + 1, tnp_leads_days); 61 if (count == tnp_leads_count) { 62 setTimeout(tnp_leads_open, tnp_leads_delay); 63 } else { 64 console.log('Count not matching'); 65 } 66 } 67} 68 69function tnp_leads_submit(form) { 70 const form_data = new FormData(form); 71 fetch(tnp_leads_post, { 72 method: 'POST', 73 body: form_data 74 }).then(data => { 75 data.text().then(body => { 76 document.getElementById('tnp-modal-html').innerHTML = 77 '<div class="tnp-success-icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="120px" height="120px" viewBox="0 0 48 48"><g ><path fill="#fff" d="M22,45C10.4209,45,1,35.57959,1,24S10.4209,3,22,3c3.91211,0,7.72852,1.08301,11.03809,3.13184' 78 + 'c0.46973,0.29053,0.61426,0.90674,0.32422,1.37646c-0.29102,0.47021-0.90723,0.61426-1.37695,0.32373' 79 + 'C28.99219,5.97949,25.54004,5,22,5C11.52344,5,3,13.52344,3,24s8.52344,19,19,19s19-8.52344,19-19' 80 + 'c0-1.69238-0.22266-3.37207-0.66211-4.99268c-0.14453-0.5332,0.16992-1.08252,0.70312-1.22705' 81 + 'c0.53418-0.14209,1.08301,0.1709,1.22656,0.70361C42.75391,20.2749,43,22.13086,43,24C43,35.57959,33.5791,45,22,45z"/>' 82 + '<path fill="#72C472" d="M22,29c-0.25586,0-0.51172-0.09766-0.70703-0.29297l-8-8c-0.39062-0.39062-0.39062-1.02344,0-1.41406' 83 + 's1.02344-0.39062,1.41406,0L22,26.58594L43.29297,5.29297c0.39062-0.39062,1.02344-0.39062,1.41406,0s0.39062,1.02344,0,1.41406' 84 + 'l-22,22C22.51172,28.90234,22.25586,29,22,29z"/></g></svg></div>' + body; 85 }) 86 }); 87}
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.