1var _ads = {} 2 , _logads = false; 3 4var clearWebspaces = function () { 5 var _maxIterations = 1000; 6 var _excluded = ["LEADER", "SKIN"];//"SPONSORED" 7 var _adInterval = 888; 8 //var _adInterval = 1888;//pestaola 9 //var _isMobile = false;//pestaola 10 11 12 $("script[data-server]").add(".page-contents script[data-h='ads.naftemporiki.gr']") 13 .add(".inner-page-contents script[data-h='ads.naftemporiki.gr']").each(function (i, e) { 14 if ($(e).parent().length && typeof $(e).parent().attr("data-ads") == "undefined") { 15 var _id = $(e).parent().attr("id"); 16 if (typeof _id == "undefined" || $.trim(_id) == "") 17 _id = $(e).parents(".ad").length && typeof $(e).parents(".ad").attr("data-ads") == "undefined" ? $(e).parents(".ad").attr("id") : ""; 18 if (typeof _id != "undefined" && $.trim(_id) != "") 19 _ads[_id] = {}; 20 } 21 }); 22 23 setInterval(function () { 24 for (var _a in _ads) { 25 if (_ads.hasOwnProperty(_a)) { 26 //console.log(_a) 27 if ($.trim(_a) != "") { 28 if (typeof _ads[_a] != "undefined") { 29 var r = _ads[_a]; 30 if (typeof r == "undefined" || 31 _excluded.indexOf(_a.toUpperCase()) > -1 || 32 r.iterations > _maxIterations) { 33 delete _ads[_a]; 34 continue; 35 } 36 var $el = $(document.getElementById(_a)); 37 if (r.contentsHeight < 200 && r.isEmpty && r.iterations > 4 && r.elements < 3 && r.wasViewed) { 38 console.log("________Element " + _a + " was hidden_____"); 39 if (window.location.search.toUpperCase().indexOf("TESTADS") > -1) 40 console.log("________Element " + _a + " was hidden_____"); 41 console.log(JSON.stringify(r, null, 4)); 42 //$(document.getElementById(_a)).css("height", "0!important"); 43 $el.attr("style", "height: 0!important"); 44 $el.attr("data-ads", 1); 45 delete _ads[_a]; 46 continue; 47 } 48 if ((_isMobile || _a === "UA") && r.webspaceHeight > 300 && r.contentsHeight <= 300 49 && r.wasViewed && r.iterations > 20 && !r.isEmpty) {//iterations raised from 5 to 20 50 var _h = r.contentsHeight < 250 ? 300 : r.contentsHeight; 51 //todo define again height 52 $el.attr("style", "height: " + _h + "px!important"); 53 $el.attr("data-ads", 2); 54 delete _ads[_a]; 55 continue; 56 } 57 58 if (((_a !== "UA" && r.onSidebar) || _isMobile) && r.webspaceHeight > 200 && r.contentsHeight > 100 && r.wasViewed && r.iterations > 10 && !r.isEmpty) { 59 $el.attr("data-ads", 3); 60 delete _ads[_a]; 61 continue; 62 } 63 64 _ads[_a] = $.isEmptyObject(r) ? clearAdsWhiteSpace(_a) : clearAdsWhiteSpace(_a, r); 65 } 66 } 67 } 68 } 69 //console.log(JSON.stringify(_ads, null, 4)); 70 }, _adInterval); 71 72 function clearAdsWhiteSpace(w, r) { 73 var $w = $(document.getElementById(w)); 74 if (!$w.length) 75 return; 76 var _r = (typeof r != "undefined") ? r : { 77 webspaceHeight: 0, 78 contentsHeight: 0, 79 isEmpty: false, 80 inView: false, 81 iterations: 0, 82 onSidebar: false, 83 elements: 0, 84 wasViewed: false 85 }; 86 // console.log(" " + w + " " + " webspaceHeight: " + webspaceHeight + " contentsHeight: " + contentsHeight + " isEmpty:" + isEmpty + " inView:" + inView); 87 88 var onSidebar = $w.parents("div#sidebar").length > 0;//$w.find(".sidebar__inner").length > 0 || 89 var contentsHeight = 0; 90 var webspaceHeight = $w.innerHeight(); 91 var isEmpty = false; 92 var inView = false; 93 var elements = 0; 94 var wasViewed = false; 95 96 if (onSidebar) { 97 if ($w.find(".inner-wrapper-sticky").length) { 98 $w = $w.find(".sidebar__inner>.inner-wrapper-sticky"); 99 } else { 100 $w = $w.find(".sidebar__inner"); 101 } 102 } else {//not in sidebar 103 } 104 105 isEmpty = ($w.find("script").length == 1 && $w.find("script[data-server]:first").parent().find("*").not("script").length <= 1 && !$.trim($w.find("script[data-server]").parent().find("*").not("noscript").not("script").html())); 106 inView = $w.find("script:first").length && (($w.find("script").length == 1 && $w.find("script[data-server]:first").parent().find("*").not("script").length == 0) || ($w.find("script[data-server]:first").length && $w.find("script[data-server]:first").html().toUpperCase().indexOf('DATA-INVIEW="FALSE"') == -1)); 107 108 $w.children().each(function (i, e) { 109 if ($(e)[0].tagName.toUpperCase() === "IFRAME") { 110 if (_logads) 111 console.log($(e)[0].tagName + " " + $(e).contents().find("body").innerHeight() + " _______________"); 112 var t = $(e).contents().find("body").innerHeight(); 113 if (t > 0 && t > contentsHeight) 114 contentsHeight = t; 115 } 116 if (_logads) 117 console.log($(e)[0].tagName + " " + $(e).innerHeight()); 118 119 var t = $(e).innerHeight(); 120 if (t > 0 && t > contentsHeight) 121 contentsHeight = t; 122 t = $(e).height(); 123 if (t > 0 && t > contentsHeight) 124 contentsHeight = t; 125 }); 126 127 $w.find("img").each(function (i, e) { 128 var t = $(e)[0].naturalHeight; 129 if (t > 0 && t > contentsHeight) 130 contentsHeight = t; 131 }); 132 133 elements = $w.find("script[data-server]:first").siblings().not("script").length + 1; 134 wasViewed = (w.toUpperCase() === "SPONSORED" && elements === 1) || elements >= 1 || $w.find("script[data-server]:first").parent().find("*").length > 3; 135 136 if (_logads) 137 console.log(" " + w + " " + " webspaceHeight: " + webspaceHeight + " contentsHeight: " + contentsHeight + " isEmpty:" + isEmpty + " inView:" + inView); 138 139 contentsHeight = contentsHeight ? (contentsHeight > 250 ? contentsHeight : 300) : 300; 140 _r = { 141 webspaceHeight: webspaceHeight, 142 contentsHeight: contentsHeight, 143 isEmpty: isEmpty, 144 inView: inView, 145 iterations: _r.iterations + 1, 146 onSidebar: onSidebar, 147 elements: elements, 148 wasViewed: wasViewed 149 }; 150 return _r; 151 } 152};
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.