1class Debug_ads { 2 3 constructor(params) { 4 5 console.log('params',params); 6 7 const class_this = this; 8 let active = true; 9 10 /* works only if iddfp not defined */ 11 if(top.location.search.indexOf('debug') >= 0 || params.progressive){ 12 edinews_console_log('testads debug'); 13 class_this.test_ads(active); 14 15 } else if (typeof googletag !== 'undefined') { 16 17 edinews_console_log('googletag defined'); 18 googletag.cmd.push(function () { 19 let index = 0; 20 googletag.pubads().addEventListener('slotRenderEnded', function (event) { 21 index++; 22 edinews_console_log('slotRenderEnded', index); 23 if (index == 1) { 24 setTimeout(function(){ class_this.test_ads(active);}, 2000); 25 } 26 27 }); 28 29 }); 30 } 31 }; 32 33 test_ads(active) { 34 console.log('test_ads loaded'); 35 let target = edinet_get_sezioni_dfp(); 36 if (typeof target !== 'undefined') { 37 let sezione = document.createElement('p'); 38 sezione.classList.add('debug-sezioni') 39 // target = JSON.parse(target); 40 sezione.innerHTML += `Sezioni: ${target}`; 41 window.parent.document.body.insertBefore(sezione,window.parent.document.body.firstChild); 42 } 43 44 const all_adunit = document.querySelectorAll('.edibanner:not(.debug-mode), .adunit:not(.debug-mode), .pct-banner:not(.debug-mode), .widget_area:not(.debug-mode)'); 45 all_adunit.forEach(function (elem) { 46 if (active) { 47 let title = document.createElement('div'); 48 title.innerHTML = elem.dataset.name; 49 title.classList.add('ads-debug'); 50 elem.classList.add('debug-mode') 51 52 elem.style.minHeight = (elem.classList.contains('widget_area'))?'100px':'50px'; 53 elem.style.backgroundColor = (elem.classList.contains('widget_area'))?'rgba(0, 53, 255, 0.5)':'rgba(255, 255, 0, 0.5)'; 54 elem.style.border = (elem.classList.contains('widget_area'))?'4px solid rgba(0, 53, 255, 0.5)':''; 55 elem.insertBefore(title, elem.firstChild); 56 57 } else { 58 let title = elem.querySelector('.ads-debug'); 59 title.parentNode.removeChild(title); 60 elem.style.backgroundColor = 'transparent'; 61 if (elem.classList.contains('display-none')) { 62 elem.style.display = 'none'; 63 } 64 } 65 }) 66 67 } 68 69} 70 71if (top.location.search.indexOf('testads') >= 0) { 72 // if (window.debug_ads === undefined) { 73 // window.debug_ads = new Debug_ads(); 74 // } 75 76 document.addEventListener('home_chunk_appended',e => { 77 console.log('[testads] home_chunk_appended'); 78 window.debug_ads = new Debug_ads({ progressive: true } ) ; 79 }); 80 81 window.addEventListener('DOMContentLoaded', e => { 82 console.log('[testads] DOMContentLoaded'); 83 window.debug_ads = new Debug_ads( { progressive: false } ) ; 84 }); 85 86} 87 88
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.