1const pageProtocol = window.location.protocol; 2const pageUrl = window.location.hostname; 3const pagePath = window.location.pathname; 4const pageQString = window.location.search; 5const isArticlePage = pagePath.indexOf("/articoli/") != "-1" || pagePath.indexOf("/feeds/") != "-1" ? true : false; 6const isTiscaliPage = pageUrl.indexOf("tiscali.it") != "-1" ? true : false; 7 8const isMobilePage = function(){ 9 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 10 return true; 11 } else { 12 return false; 13 } 14} 15 16const moveBanner = function(confObj){ 17 let loadJsOb = false; 18 const urlPage = pageProtocol+'//'+pageUrl+pagePath; 19 for(id in confObj){ 20 //console.debug(confObj); 21 let targetId = id; 22 let widgetId = confObj[targetId]; 23 let targetNode = document.querySelector('#'+targetId); 24 if(targetNode !== null){ 25 let widgetCode = ''; 26 if(targetId == 'adwallpaper'){ 27 if(!isMobilePage()){ 28 targetNode.setAttribute("style", "display:inline-grid;width:970px;text-align:center;margin-bottom:0px"); 29 } 30 } 31 32 if(isMobilePage() && (targetId == 'admputop2' || targetId == 'admpumiddle2' || targetId == 'admpubottom2')){ 33 targetNode.setAttribute("style", "display:inline-block"); 34 } 35 widgetCode = '<div class="OUTBRAIN" data-src="'+urlPage+'" data-widget-id="'+widgetId+'"></div>'; 36 37 targetNode.innerHTML = widgetCode; 38 if(targetNode.hasAttribute("style")){ 39 if(window.getComputedStyle(targetNode).display === "none"){ 40 targetNode.style.display = ''; 41 } 42 } 43 loadJsOb = true; 44 } 45 if(loadJsOb){ 46 (function (d, s, id) { 47 var url = '//widgets.outbrain.com/outbrain.js'; 48 var js, fjs = d.getElementsByTagName(s)[0]; 49 if (d.getElementById(id)) { 50 return; 51 } 52 js = d.createElement("script"); 53 js.id = id; 54 js.onload = function () {}; 55 js.async = true; 56 js.src = url; 57 fjs.appendChild(js); 58 }(document, 'head', 'ts_outbrain')); 59 } 60 } 61} 62 63const confDesktopHp = { 64 'adwallpaper': 'AR_10', 65 'admputop': 'AR_11', 66 'admpumiddle': 'AR_13', 67 'admpubottom': 'AR_14' 68} 69const confDesktopNews = { 70 'adwallpaper': 'AR_10', 71 'admputop': 'AR_11', 72 'admpumiddle': 'AR_12', 73 'admpubottom': 'AR_13' 74} 75const confMobile = { 76 'admputop2': 'AR_11', 77 'admpumiddle2': 'AR_12', 78 'admpubottom2': 'AR_13' 79} 80 81if(isMobilePage()){ 82 confMobile.adwallpaper = 'MB_4'; 83} 84 85if(isTiscaliPage){ 86 if(isMobilePage()){ 87 //console.debug("movebanner mobile"); 88 moveBanner(confMobile); 89 }else{ 90 if(isArticlePage){ 91 //console.debug("movebanner article"); 92 moveBanner(confDesktopNews); 93 }else{ 94 //console.debug("movebanner outbrain"); 95 moveBanner(confDesktopHp); 96 } 97 } 98} 99 100 101 102 103 104 105 106 107
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.