Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* V6 - 02/01/2017 */
- /* FIX CSS */
- var CualD = VerCualDisp();
- var viewport = document.querySelector('meta[name="viewport"]');
- var meta = document.createElement('meta');
- var html = document.getElementsByTagName('html')[0];
- var cantidadI = DameCookie("nopINTER");
- if(cantidadI<0) cantidadI = 0;
- var MaxI = 2;
- var cuantasEntro = 0;
- var TextoAlerta = "Te recomendamos esta aplicación";
- function CargarInter(a,b,c){
- SacarScroll(true);
- cantidadI++
- MeterCookie(cantidadI);
- var css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fonts.googleapis.com/css?family=Open+Sans\" /><style>.barrita{font-family:'Open Sans';background-color:#eeeeee;height:25px;text-align:right;width:100%;position:absolute;top:0px;left:0px;z-index:2147483647;}.barrita a{font-family:'Open Sans';font-size:13px;padding:5px;text-decoration:none;color:#000}.fondo{z-index:147483600;position:fixed;background-color:#000;top:0px;left:0px;width:100%;height:100%;opacity:0.5;filter:alpha(opacity=50)}.alerta{width: 100%;height: 100%;position: fixed;top: 0px;left: 0px;z-index: 2147483640;font-family:'Open Sans',Verdana;}.clase0{z-index:2147483640;border-radius:3px;background:#eeeeee;width:90%;margin:auto;position:absolute;left:0;right:0;top:30%;border:1px solid #fff}.clase0 #ionofooter .vacio{color: #eeeeee;}.clase0 img{width:30px;height:30px;border-radius:5px;margin:4px 0px 0px 5%;float:left}.clase0 #ionoheader{font-weight:bold;color:#3c3c3c;padding:10px 0px 0px 5%}.clase0 #ionoarticle{font-weight:500;margin:4px 5% 0px 5%;font-size:14px;color:#3c3c3c}.clase0 #ionofooter{float:left;width:100%;text-align:right;margin-bottom:10px;}.clase0 #ionofooter .boton{font-size:14px;color:#009688;font-weight:bold;margin:2%}.clase0 .nombreAPP{font-size:14px;float:left;font-weight:bold;color:#3c3c3c;margin:10px 0px 0px 1%;padding:0px}@media only screen and (min-width: 768px){.clase0 #ionofooter{margin-bottom:10px;margin-left:0px}}.clase1{z-index:2147483640;border-radius:8px;background:#e6e6e6;width:90%;margin:auto;position:absolute;left:0;right:0;top:30%;border:1px solid #fff}.clase1 img{width:30px;height:30px;border-radius:5px;margin:4px 0px 8px 5%;vertical-align:middle}.clase1 #ionoheader{font-weight:bold;color:#4f4f4f;width:100%;text-align:center;padding-top:10px}.clase1 #ionoarticle{width:100%;text-align:center;font-size:14px;color:#3c3c3c}.clase1 #ionofooter{margin-bottom:10px;width:100%;text-align:center;border-top:solid 1px #dcdcdc}.clase1 #ionofooter .vacio{display:none;}.clase1 #ionofooter .boton{font-size:14px;color:#6dacf3;font-weight:bold;padding:15px}.clase1 .nombreAPP{font-size:14px;font-weight:bold;color:#3c3c3c}@media only screen and (min-width: 768px){.clase1 #ionofooter{margin-bottom:10px;margin-left:0px}}</style>";
- var info = "<div class=\"barrita\"><a href=\"javascript:void(0);\" onclick=\"CerrarX();\">x</a></div><div class=\"alerta\"> <div class=\"clase0\"> <header>Alerta</header> <article>"+TextoAlerta+"</article> <img src=\""+c+"\"> <span class=\"nombreAPP\">"+b+"</span> <footer><span class=\"boton\">OK</span></footer> </div></div><div class=\"fondo\"></div>";
- if(document.body != null){
- document.body.innerHTML += css + info;
- if(CualD=="1"){
- document.getElementsByClassName("clase0")[0].className = "clase1";
- };
- document.getElementsByClassName("alerta")[0].addEventListener('click', function () {
- CerrarX();
- MeterCookie(1000);
- top.location.href = a;
- }, false);
- }else{
- if(cuantasEntro<=2){
- cuantasEntro++;
- console.log('Entro con el timer ' + cuantasEntro);
- setTimeout(function(){ CargarInter(a,b,c); }, 3000);
- }
- };
- };
- function CerrarX(){
- SacarScroll(false);
- document.getElementsByClassName("fondo")[0].style.display = "none";
- document.getElementsByClassName("alerta")[0].style.display = "none";
- document.getElementsByClassName("barrita")[0].style.display = "none";
- };
- function SacarScroll(n) {
- if (n) {
- html.style['overflow'] = 'hidden';
- html.style['width'] = '100%';
- html.style['height'] = '100%';
- html.style['max-height'] = '100%';
- html.style['position'] = 'fixed';
- html.style['top'] = '0';
- html.style['left'] = '0';
- } else {
- html.style['overflow'] = 'initial';
- html.style['height'] = 'auto';
- html.style['width'] = 'auto';
- html.style['position'] = 'static';
- html.style['max-height'] = 'initial';
- };
- };
- function DameCookie(cname) {
- var name = cname + "=";
- var ca = document.cookie.split(';');
- for(var i = 0; i <ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0)==' ') {
- c = c.substring(1);
- };
- if (c.indexOf(name) == 0) {
- return c.substring(name.length,c.length);
- };
- };
- return "";
- };
- function setVP() {
- meta.name = 'viewport';
- meta.content = 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no';
- if (viewport) {
- viewport.parentNode.removeChild(viewport);
- };
- document.head.appendChild(meta);
- };
- function VerCualDisp(){
- var t=navigator.userAgent||navigator.vendor||window.opera;
- var cual = t.match(/Opera Mini/i)||t.match(/Windows/i)?"unknown":t.match(/iPad/i)||t.match(/iPhone/i)||t.match(/iPod/i)||t.match(/iOS/i)?"iOS":t.match(/Android/i)?"Android":"unknown";
- if(cual=="iOS") return 1;
- if(cual=="Android") return 2;
- return 3;
- };
- function VerCualID(){
- var iOS_ID = "ACA_ID_IOS";
- var Android_ID = "ACA_ID_ANDROID";
- if(CualD=="1") return iOS_ID;
- if(CualD=="2") return Android_ID;
- return;
- };
- function MeterCookie(cantidad){
- var cad = new Date();
- cad['setTime'](cad['getTime']() + (24 * 60 * 60 * 1000));
- var expira = '; expires=' + cad['toGMTString']();
- document.cookie = 'nopINTER=' + cantidad + expira + ';path=/';
- };
- function loadJSON() {
- var data_file = "https://admin.appnext.com/offerWallApi.aspx?pimp=1&tid=API&id="+VerCualID()+"&cnt=10";
- var http_request = new XMLHttpRequest();
- try {
- http_request = new XMLHttpRequest();
- } catch (e) {
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- return false;
- };
- };
- };
- http_request.onreadystatechange = function() {
- if (http_request.readyState == 4) {
- if(http_request.responseText=="") return;
- var jsonObj = JSON.parse(http_request.responseText);
- if (jsonObj.apps.length > 0) {
- var entry = jsonObj.apps[Math.floor(Math.random() * jsonObj.apps.length)];
- new Image().src = entry.pixelImp;
- setVP();
- CargarInter(entry.urlApp,entry.title,entry.urlImg);
- };
- };
- };
- http_request.open("GET", data_file, true);
- http_request.send();
- };
- document.addEventListener('DOMContentLoaded', function () {
- if(CualD!=3 && cantidadI<=MaxI){
- loadJSON();
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement