if (typeof PBSclickTag == "undefined") { PBSclickTag = {} } var QueryString = function() { var query_string = {}; var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (typeof query_string[pair[0]] === "undefined") { query_string[pair[0]] = pair[1] } } return query_string }(); id = typeof QueryString.id !== "undefined" ? PBSclickTag[QueryString.id] = {} : PBSclickTag[location.pathname] = {}; PBSclick = { divsId: [], obj: {}, ct: function() { return QueryString.ct }, makeObj: function() { for (var i = 0; i < this.divsId.length; i++) { if (i === 0) { this.obj[this.divsId[i]] = 'click' } else { this.obj[this.divsId[i]] = 'click' + i + '' } if (document.getElementById(this.divsId[i]).nodeName == "A") { document.getElementById(this.divsId[i]).setAttribute("target", "_blank"); if (QueryString.i == "1") { document.getElementById(this.divsId[i]).setAttribute("href", "https://ak-ads-ns.prisasd.com/0/ct/check.html?i=ahref") } else { document.getElementById(this.divsId[i]).setAttribute("href", PBSclick.getUrl(this.divsId[i], true)) } } else { document.getElementById(this.divsId[i]).addEventListener("click", function() { PBSclick.getUrl(this.id) }) } } id.showClick = this.obj; if (QueryString.i == "1") { var newInfo = document.createElement('p'); document.body.appendChild(newInfo); newInfo.style.cssText = "z-index:100001;position:fixed;right:2%;top:0px;border-radius:3px;display:inline-block;cursor:pointer;color:#000;font-family:Arial;font-size:13px;text-decoration:none;"; var content = function() { var i = ""; var n = 0; for (var w in id.showClick) { var c = PBSclick.getColor(); n++; if (w == "clickTagX") { i += "
Click bottom ID (autogenerated and cover all ad area): [" + w + "]

"; document.getElementById(w).style.background = c + 73 } else { i += "
Click bottom ID : [" + w + "]

"; document.getElementById(w).style.background = c } } return i }; newInfo.innerHTML = content() } }, getUrl: function(e, a) { var clickOrg = e; for (var CT in PBSclick.obj) { window.alert(CT); if (CT == clickOrg) { var targetUrl = (QueryString[PBSclick.obj[CT]] ? QueryString[PBSclick.obj[CT]] : ""); if (QueryString.i == "1") { console.log(e); targetUrl = "https://ak-ads-ns.prisasd.com/0/ct/check.html?i=" + e }; if (a) { return unescape(this.ct() + targetUrl) } else { if (QueryString.i == "1") { window.open(unescape(targetUrl), "_blank") } else { window.open(unescape(this.ct() + targetUrl), "_blank") } } } } }, makeDiv: function() { var newDiv = document.createElement('div'); document.body.appendChild(newDiv); newDiv.style.cssText = "height:100%;width:100%;position:absolute;top:0;left:0;z-index:100000;cursor:pointer;"; newDiv.id = "clickTagX"; this.divRef = "clickTagX"; this.getCT(); id.showDiv = newDiv }, getCT: function() { if (this.divRef !== "") { if (document.querySelectorAll("[id*='" + this.divRef + "']")[0] != undefined) { clearTimeout(this.timerOut); clearInterval(this.timer); var divs = document.querySelectorAll("[id*='" + this.divRef + "']") ? document.querySelectorAll("[id*='" + this.divRef + "']") : 0; for (var i = 0; i < divs.length; i++) { this.divsId.push(divs[i].id) }; this.divsId.sort(); this.makeObj(); id.showDiv = divs } else { if (this.timer == undefined) { this.timer = setInterval(function() { PBSclick.getCT() }, 500); this.timerOut = setInterval(function() { clearInterval(PBSclick.timer) }, 2000) } } } else { this.makeDiv() } }, color: function(inferior, superior) { numPosibilidades = superior - inferior; aleat = Math.random() * numPosibilidades; aleat = Math.floor(aleat); return parseInt(inferior) + aleat }, getColor: function() { hexadecimal = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"); color_aleatorio = "#"; for (i = 0; i < 6; i++) { pos = this.color(0, hexadecimal.length); color_aleatorio += hexadecimal[pos] } return color_aleatorio; } };