/** * Zjistí jestli je zapnutý adblock. Pokud je, tak vyhledá všechny adsense reklamy na stránce a vloží tam vlastní reklamu (affiliate). * * @author Milan Šarík * @date 2014-10-24 * @version 1.0 * */ var aa_adblock = true; var aa_imported = document.createElement('script'); aa_imported.src = 'https://netincome.cz/getbanner.cfm?'; document.head.appendChild(aa_imported); var aa_savedStats = false; var aa_someFinded = false; var aa_bnrs = {"728":{"90":[{"width":728,"height":90,"img_path":"https:\/\/netincome.cz\/aa_plugin\/shakes_fidget-728_90.jpeg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=f882d7860e7d341da1edf7a1983a9b87&affilId=bwnt2vtf&channelId=myplugin"},{"width":728,"height":90,"img_path":"https:\/\/netincome.cz\/aa_plugin\/4story-728_90.jpg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=59591d4dbbf9b5d53234c0595e60ea7a&affilId=bwnt2vtf&channelId=myplugin"}]},"300":{"250":[{"width":300,"height":250,"img_path":"https:\/\/netincome.cz\/aa_plugin\/shakes_fidget-300_250.jpeg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=f882d7860e7d341da1edf7a1983a9b87&affilId=bwnt2vtf&channelId=myplugin"},{"width":300,"height":250,"img_path":"https:\/\/netincome.cz\/aa_plugin\/4story-300_250.jpg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=59591d4dbbf9b5d53234c0595e60ea7a&affilId=bwnt2vtf&channelId=myplugin"}]},"160":{"600":[{"width":160,"height":600,"img_path":"https:\/\/netincome.cz\/aa_plugin\/shakes_fidget-160_600.jpeg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=f882d7860e7d341da1edf7a1983a9b87&affilId=bwnt2vtf&channelId=myplugin"},{"width":160,"height":600,"img_path":"https:\/\/netincome.cz\/aa_plugin\/4story-160_600.jpg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=59591d4dbbf9b5d53234c0595e60ea7a&affilId=bwnt2vtf&channelId=myplugin"}]},"468":{"60":[{"width":468,"height":60,"img_path":"https:\/\/netincome.cz\/aa_plugin\/shakes_fidget-46860.jpeg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=f882d7860e7d341da1edf7a1983a9b87&affilId=bwnt2vtf&channelId=myplugin"},{"width":468,"height":60,"img_path":"https:\/\/netincome.cz\/aa_plugin\/4story-46860.jpg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=59591d4dbbf9b5d53234c0595e60ea7a&affilId=bwnt2vtf&channelId=myplugin"}]},"336":{"280":[{"width":336,"height":280,"img_path":"https:\/\/netincome.cz\/aa_plugin\/4story-336_280.jpg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=59591d4dbbf9b5d53234c0595e60ea7a&affilId=bwnt2vtf&channelId=myplugin"},{"width":336,"height":280,"img_path":"https:\/\/netincome.cz\/aa_plugin\/good_empire_cz-336_280.gif","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=a2b70673ef19694dc1e910985b79feae&affilId=bwnt2vtf&channelId=myplugin"}]},"200":{"200":[{"width":200,"height":200,"img_path":"https:\/\/netincome.cz\/aa_plugin\/4story-200_200.jpg","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=59591d4dbbf9b5d53234c0595e60ea7a&affilId=bwnt2vtf&channelId=myplugin"},{"width":200,"height":200,"img_path":"https:\/\/netincome.cz\/aa_plugin\/good_empire_cz-200_200.gif","url":"http:\/\/xml.affilnet.cz\/banners\/go.php?url=a2b70673ef19694dc1e910985b79feae&affilId=bwnt2vtf&channelId=myplugin"}]}};var aa_widths = [160,300,336,728,468,200];var aa_heights = [600,250,280,90,60,200]; function getBanner (w, h) { w = parseInt(w); h = parseInt(h); var max_width = 0; var max_height = 0; for (var x = 0 in aa_widths) { if ( w >= aa_widths[x] && max_width <= aa_widths[x] && h >= aa_heights[x] && max_height <= aa_heights[x] ) { max_width = aa_widths[x]; max_height = aa_heights[x]; } } if (max_width > 0 && max_height > 0 && aa_bnrs[max_width][max_height]) { return aa_bnrs[max_width][max_height]; } else { return false; } } /** * Vloží div před reklamu * @param object p kam se to bude vkládat * @param object ads reklama původní (velikost, html, ...) */ function insertFirstChild(p, ads) { var myelement = document.createElement("div"); var banner = 'Hello world!' banner = getBanner(ads.width, ads.height); var rand = Math.floor(Math.random() * banner.length); var saveStats = ''; if (!aa_savedStats) { saveStats = ''; aa_savedStats = true; } myelement.innerHTML = ''+ saveStats; myelement.style.width = ads.width +'px'; myelement.style.height = ads.height +'px'; myelement.style.display = ads.display; myelement.style.textAlign = ads.textAlign; p.parentNode.insertBefore(myelement, p); } function aa_checkAds() { var e = document.getElementsByTagName("script"); for (var i = 0; i < e.length; i++) { if (e[i].src.indexOf("googlesyndication") > -1) { var parentElem = e[i].parentNode; if (parentElem.nodeName == 'head' || parentElem.nodeName == 'HEAD') continue; //var parentElemObj = e[i].parentElement; //console.log(parentElem); var elems = parentElem.getElementsByTagName("ins"); if (elems.length >= 1) { for (var j = 0; j < elems.length; j++) { var ads = {}; ads.elem = elems[j]; ads.display = (elems[j].style.display ? elems[j].style.display : 'inline-block'); ads.width = (elems[j].style.width ? elems[j].style.width.replace("px", "") : 0); ads.height = (elems[j].style.height ? elems[j].style.height.replace("px", "") : 0); ads.textAlign = 'center'; insertFirstChild(e[i], ads); } } else if (elems.length == 0) { var scripts = parentElem.getElementsByTagName("script"); for (var j = 0; j < scripts.length; j++) { if (scripts[j].src.indexOf("googlesyndication") < 0) { var ads = {}; ads.elem = scripts[j]; ads.display = 'inline-block'; ads.textAlign = 'center'; var findAttr = scripts[j].innerHTML; var res = findAttr.split(";"); for (var k = 0; k < res.length; k++) { var num = 0; if (res[k].indexOf("google_ad_width") > -1) { num = parseInt(res[k].match(/\d+$/)[0]); ads.width = (num ? num : 0); } else if (res[k].indexOf("google_ad_height") > -1) { num = parseInt(res[k].match(/\d+$/)[0]); ads.height = (num ? num : 0); } } insertFirstChild(e[i], ads); } } } } } } function initAntiAdblock() { // adblock je zapnutý if (aa_adblock == true) { setTimeout('aa_checkAds()', 500); } } window.onload = initAntiAdblock;