Tema para preguntas random a Chatgpt 🤖

  • Autor Autor Carlos Arreola
  • Fecha de inicio Fecha de inicio
Hay un error en la lógica de las resoluciones en tu código. El problema principal es que está tratando de manejar resoluciones de video y los valores de las opciones no son consistentes con las comparaciones. Aquí hay unas correcciones:

1. Comparaciones de valor: Cambia las comparaciones de cadenas a números. Por ejemplo, cuando haces substr($resolucion, 0, $posicion) <= "250", debes asegurarte de que estás comparando números.

2. Agregar la resolución correcta para 4K: El caso para 4K debería estar correctamente definido.

Te dejo una versión corregida del código:

PHP:
if (isset($fila['calidad']) && $fila['calidad'] !== false && $fila['calidad'] !== "null") {
    $resolucion = $fila['calidad'];
    $posicion = strpos($resolucion, 'x');
   
    // Asegurarse de que la resolución esté en un formato válido
    if ($posicion === false) {
        echo "<option value='800x400'>480p</option>";
    } else {
        $ancho = (int)substr($resolucion, 0, $posicion); // Convertir a entero antes de comparar

        if ($ancho <= 250) {
            echo "<option value='250x400'>144p</option>";
        } elseif ($ancho <= 600) {
            echo "<option value='600x400'>360p</option>";
        } elseif ($ancho <= 800) {
            echo "<option value='800x400'>480p</option>";
        } elseif ($ancho <= 1200) {
            echo "<option value='1200x400'>720p</option>";
        } elseif ($ancho <= 1900) {
            echo "<option value='1900x400'>1080p</option>";
        } elseif ($ancho <= 4000) {
            echo "<option value='4000x400'>4K</option>"; // Asegúrate de que el valor tenga una altura si es necesario
        } else {
            echo "<option value='800x400'>480p</option>";
        }
    }
} else {
    echo '<option value="800x400">480p</option>';
}

### Cambios Realizados:
  • Se usan comparaciones numéricas al convertir la anchura de la resolución a un entero.
  • Se corrige la comparación de false, ya que se verifica también si la calidad no es null.
  • La opción para 4K ahora tiene una altura 400 para mantener la consistencia.

Asegúrate de probar que calidad contenga el formato correcto de resolución (ej. "1920x1080") y que este código maneje correctamente todas las condiciones esperadas. Si necesitas más ayuda, ¡déjamelo saber!
pero esas si son los tamaños de las calidades, lo que pasa es que los videos que subo aveces son de menor calidad y dice una calidad mas alta
 
pero esas si son los tamaños de las calidades, lo que pasa es que los videos que subo aveces son de menor calidad y dice una calidad mas alta
Si los videos que subes tienen resoluciones más bajas y el sistema reporta una calidad más alta, podrías necesitar agregar una verificación adicional para asegurarte de que solo se muestren las resoluciones válidas correspondientes a los videos disponibles.

Puedes ajustar tu código para manejar mejor esta situación. Aquí te muestro cómo hacerlo:

### Código PHP Ajustado

PHP:
if (isset($fila['calidad']) && $fila['calidad'] !== false && $fila['calidad'] !== "null") {
    $resolucion = $fila['calidad'];
    $posicion = strpos($resolucion, 'x');
    
    // Asegurarse de que la resolución esté en un formato válido
    if ($posicion === false) {
        echo "<option value='800x400'>480p</option>";
    } else {
        $ancho = (int)substr($resolucion, 0, $posicion);
        
        // Establecemos un límite máximo a la resolución que se puede mostrar
        $maxCalidad = 4000; // Por ejemplo, 4K

        // Comparar con las resoluciones disponibles
        if ($ancho <= 250 && $ancho <= $maxCalidad) {
            echo "<option value='250x400'>144p</option>";
        } elseif ($ancho <= 600 && $ancho <= $maxCalidad) {
            echo "<option value='600x400'>360p</option>";
        } elseif ($ancho <= 800 && $ancho <= $maxCalidad) {
            echo "<option value='800x400'>480p</option>";
        } elseif ($ancho <= 1200 && $ancho <= $maxCalidad) {
            echo "<option value='1200x400'>720p</option>";
        } elseif ($ancho <= 1900 && $ancho <= $maxCalidad) {
            echo "<option value='1900x400'>1080p</option>";
        } elseif ($ancho <= 4000 && $ancho <= $maxCalidad) {
            echo "<option value='4000x400'>4K</option>";
        } else {
            echo "<option value='800x400'>480p</option>"; // Default si no se cumple ninguna
        }
    }
} else {
    echo '<option value="800x400">480p</option>';
}

### Ajustes Realizados:

1. Verificación de calidad: Asegúrate de que el ancho esté dentro de los límites que defines como válidos y que se correspondan con la calidad real del video.

2. Máximo de calidad: Añadí la variable $maxCalidad para establecer un límite superior a la calidad que puedes mostrar. Puedes ajustar este valor según la calidad máxima de los videos que tienes.

3. Previene el uso de calidades erróneas: Esto ajusta la lógica para garantizar que solo se muestre la calidad correspondiente a la resolución real del video.

Con esos cambios, tu sistema debería manejar mejor los videos de baja resolución, y las opciones de calidad reflejarán más fielmente lo que está disponible. Si necesitas más ayuda o ajustes, ¡házmelo saber!
 
Si los videos que subes tienen resoluciones más bajas y el sistema reporta una calidad más alta, podrías necesitar agregar una verificación adicional para asegurarte de que solo se muestren las resoluciones válidas correspondientes a los videos disponibles.

Puedes ajustar tu código para manejar mejor esta situación. Aquí te muestro cómo hacerlo:

### Código PHP Ajustado

PHP:
if (isset($fila['calidad']) && $fila['calidad'] !== false && $fila['calidad'] !== "null") {
    $resolucion = $fila['calidad'];
    $posicion = strpos($resolucion, 'x');
   
    // Asegurarse de que la resolución esté en un formato válido
    if ($posicion === false) {
        echo "<option value='800x400'>480p</option>";
    } else {
        $ancho = (int)substr($resolucion, 0, $posicion);
       
        // Establecemos un límite máximo a la resolución que se puede mostrar
        $maxCalidad = 4000; // Por ejemplo, 4K

        // Comparar con las resoluciones disponibles
        if ($ancho <= 250 && $ancho <= $maxCalidad) {
            echo "<option value='250x400'>144p</option>";
        } elseif ($ancho <= 600 && $ancho <= $maxCalidad) {
            echo "<option value='600x400'>360p</option>";
        } elseif ($ancho <= 800 && $ancho <= $maxCalidad) {
            echo "<option value='800x400'>480p</option>";
        } elseif ($ancho <= 1200 && $ancho <= $maxCalidad) {
            echo "<option value='1200x400'>720p</option>";
        } elseif ($ancho <= 1900 && $ancho <= $maxCalidad) {
            echo "<option value='1900x400'>1080p</option>";
        } elseif ($ancho <= 4000 && $ancho <= $maxCalidad) {
            echo "<option value='4000x400'>4K</option>";
        } else {
            echo "<option value='800x400'>480p</option>"; // Default si no se cumple ninguna
        }
    }
} else {
    echo '<option value="800x400">480p</option>';
}

### Ajustes Realizados:

1. Verificación de calidad: Asegúrate de que el ancho esté dentro de los límites que defines como válidos y que se correspondan con la calidad real del video.

2. Máximo de calidad: Añadí la variable $maxCalidad para establecer un límite superior a la calidad que puedes mostrar. Puedes ajustar este valor según la calidad máxima de los videos que tienes.

3. Previene el uso de calidades erróneas: Esto ajusta la lógica para garantizar que solo se muestre la calidad correspondiente a la resolución real del video.

Con esos cambios, tu sistema debería manejar mejor los videos de baja resolución, y las opciones de calidad reflejarán más fielmente lo que está disponible. Si necesitas más ayuda o ajustes, ¡házmelo saber!
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a');
var kevs = setInterval(function(){
if(enlace.length > 0){
alert("encontrado");
$(this).css({
"background":"gold",
"opacity":"1"
});
clearInterval(kevs);
}
}, 1000);

como hago para que busque un <img> o <a>?
 
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a');
var kevs = setInterval(function(){
if(enlace.length > 0){
alert("encontrado");
$(this).css({
"background":"gold",
"opacity":"1"
});
clearInterval(kevs);
}
}, 1000);

como hago para que busque un <img> o <a>?
Para buscar un elemento <img> o <a> dentro del contenido del <iframe>, puedes modificar tu código de la siguiente manera. Necesitas ajustar el selector dentro de la función para que busque ambos elementos. Aquí tienes un ejemplo:

### Código Ajustado

JavaScript:
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a, img'); // Busca tanto <a> como <img>
var kevs = setInterval(function(){
    if(enlace.length > 0){
        alert("encontrado");
        // Utiliza el contexto correcto para aplicar estilos
        $(iframe).find('span.gettids a, img').css({
            "background": "gold",
            "opacity": "1"
        });
        clearInterval(kevs);
    }
}, 1000);

### Cambios Realizados:

1. Selector combinado: Se usa iframe.find('span.gettids a, img') para buscar ambos tipos de elementos. Esto significa que si encuentra un <a> dentro de span.gettids o cualquier <img>, estará disponible en la variable enlace.

2. Aplicación de estilos: Para aplicar los estilos a los elementos encontrados, se utiliza $(iframe).find('span.gettids a, img'). Esto asegura que se apliquen a los elementos correctos dentro del iframe.

Con estos cambios, el intervalo seguirá buscando hasta que encuentre tanto un <img> como un <a>, y aplicará el estilo cuando los encuentre. Si necesitas más ayuda, ¡déjamelo saber!
 
Para buscar un elemento <img> o <a> dentro del contenido del <iframe>, puedes modificar tu código de la siguiente manera. Necesitas ajustar el selector dentro de la función para que busque ambos elementos. Aquí tienes un ejemplo:

### Código Ajustado

JavaScript:
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a, img'); // Busca tanto <a> como <img>
var kevs = setInterval(function(){
    if(enlace.length > 0){
        alert("encontrado");
        // Utiliza el contexto correcto para aplicar estilos
        $(iframe).find('span.gettids a, img').css({
            "background": "gold",
            "opacity": "1"
        });
        clearInterval(kevs);
    }
}, 1000);

### Cambios Realizados:

1. Selector combinado: Se usa iframe.find('span.gettids a, img') para buscar ambos tipos de elementos. Esto significa que si encuentra un <a> dentro de span.gettids o cualquier <img>, estará disponible en la variable enlace.

2. Aplicación de estilos: Para aplicar los estilos a los elementos encontrados, se utiliza $(iframe).find('span.gettids a, img'). Esto asegura que se apliquen a los elementos correctos dentro del iframe.

Con estos cambios, el intervalo seguirá buscando hasta que encuentre tanto un <img> como un <a>, y aplicará el estilo cuando los encuentre. Si necesitas más ayuda, ¡déjamelo saber!
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function(){
if(enlace.length > 0){
alert("encontrado");
// Utiliza el contexto correcto para aplicar estilos
$(this).css({
"opacity": "1",
"background": "gold"
});
clearInterval(kevs);
}
}, 1000);

porque no me coloca el iframe en opacity en 1 cuando lo encuentra?
 
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function(){
if(enlace.length > 0){
alert("encontrado");
// Utiliza el contexto correcto para aplicar estilos
$(this).css({
"opacity": "1",
"background": "gold"
});
clearInterval(kevs);
}
}, 1000);

porque no me coloca el iframe en opacity en 1 cuando lo encuentra?
El problema aquí es el uso incorrecto de $(this). Dentro del setInterval, this no se refiere al iframe sino al contexto de la función de intervalo. Necesitas usar una referencia al iframe para aplicar el estilo correctamente.

Aquí tienes el código ajustado:

### Código Ajustado

JavaScript:
var iframe = $(this).contents(); // Obtener el contenido del iframe
var enlace = iframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function() {
    if(enlace.length > 0) {
        alert("encontrado");

        // Ajustar la opacidad y el fondo del iframe
        $(this).css({ // Aquí se debe usar el iframe, no this
            "opacity": "1",
            "background": "gold"
        });
        
        clearInterval(kevs);
    }
}, 1000);

// Cambiar this a la referencia correcta del iframe
kevs.iframe = this; // Guardar una referencia al iframe para usarla dentro del intervalo

### Cambios Realizados:

1. Referencia correcta al iframe: Guardamos una referencia al iframe en kevs.iframe, entonces dentro de la función del setInterval, puedes acceder a kevs.iframe en lugar de $(this).

2. Aplicar estilos al iframe: Ahora en lugar de $(this), necesitas usar $(kevs.iframe) para aplicar los estilos al <iframe>.

Aquí tienes el código final que debería funcionar correctamente:

### Código Final

JavaScript:
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function() {
    if(enlace.length > 0) {
        alert("encontrado");

        // Aplicar estilos al iframe usando la referencia correcta
        $(kevs.iframe).css({
            "opacity": "1",
            "background": "gold"
        });

        clearInterval(kevs);
    }
}, 1000);

// Guardar referencia al iframe
kevs.iframe = this; // Aquí this se refiere al iframe original

Con estos ajustes, tu iframe debería cambiar la opacidad y el fondo correctamente al encontrar el enlace o la imagen. Si necesitas más ayuda, ¡házmelo saber!
 
El problema aquí es el uso incorrecto de $(this). Dentro del setInterval, this no se refiere al iframe sino al contexto de la función de intervalo. Necesitas usar una referencia al iframe para aplicar el estilo correctamente.

Aquí tienes el código ajustado:

### Código Ajustado

JavaScript:
var iframe = $(this).contents(); // Obtener el contenido del iframe
var enlace = iframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function() {
    if(enlace.length > 0) {
        alert("encontrado");

        // Ajustar la opacidad y el fondo del iframe
        $(this).css({ // Aquí se debe usar el iframe, no this
            "opacity": "1",
            "background": "gold"
        });
       
        clearInterval(kevs);
    }
}, 1000);

// Cambiar this a la referencia correcta del iframe
kevs.iframe = this; // Guardar una referencia al iframe para usarla dentro del intervalo

### Cambios Realizados:

1. Referencia correcta al iframe: Guardamos una referencia al iframe en kevs.iframe, entonces dentro de la función del setInterval, puedes acceder a kevs.iframe en lugar de $(this).

2. Aplicar estilos al iframe: Ahora en lugar de $(this), necesitas usar $(kevs.iframe) para aplicar los estilos al <iframe>.

Aquí tienes el código final que debería funcionar correctamente:

### Código Final

JavaScript:
var iframe = $(this).contents();
var enlace = iframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function() {
    if(enlace.length > 0) {
        alert("encontrado");

        // Aplicar estilos al iframe usando la referencia correcta
        $(kevs.iframe).css({
            "opacity": "1",
            "background": "gold"
        });

        clearInterval(kevs);
    }
}, 1000);

// Guardar referencia al iframe
kevs.iframe = this; // Aquí this se refiere al iframe original

Con estos ajustes, tu iframe debería cambiar la opacidad y el fondo correctamente al encontrar el enlace o la imagen. Si necesitas más ayuda, ¡házmelo saber!
sigue sin colocarme el background y el opacity
 
sigue sin colocarme el background y el opacity
El problema es que el $(this) dentro del setInterval no está referenciando correctamente al iframe. Debes asegurarte de que estás aplicando los estilos directamente sobre el iframe y no dentro del contexto del intervalo.

Aquí tienes una nueva forma de estructurarlo:

### Código Ajustado

JavaScript:
var iframe = $(this);
var contenidoIframe = iframe.contents(); // Obtener el contenido del iframe
var enlace = contenidoIframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function() {
    // Volver a obtener el contenido del iframe en cada iteración
    enlace = contenidoIframe.find('span.gettids a, span.gettids img');

    if(enlace.length > 0) {
        alert("encontrado");

        // Aplicar estilos directamente al iframe
        iframe.css({
            "opacity": "1",
            "background": "gold"
        });

        clearInterval(kevs);
    }
}, 1000);

### Cambios Realizados:

1. Referencia al iframe: Almacena $(this) directamente en la variable iframe al inicio. Esto se usa para aplicar los estilos.

2. Actualizar enlace en cada iteración: Si el contenido del iframe puede cambiar, vuelve a buscar el enlace dentro del intervalo utilizando la variable contenidoIframe.

Esto debería resolver el problema de los estilos no aplicándose correctamente. Si sigues experimentando problemas, verifica que el iframe esté visible y que no tenga estilos que le impidan mostrar el fondo. Además, asegúrate de que no hay ningún otro estilo CSS que sobreescriba el fondo o la opacidad. Si aún no funciona, ¡dímelo!
 
El problema es que el $(this) dentro del setInterval no está referenciando correctamente al iframe. Debes asegurarte de que estás aplicando los estilos directamente sobre el iframe y no dentro del contexto del intervalo.

Aquí tienes una nueva forma de estructurarlo:

### Código Ajustado

JavaScript:
var iframe = $(this);
var contenidoIframe = iframe.contents(); // Obtener el contenido del iframe
var enlace = contenidoIframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>
var kevs = setInterval(function() {
    // Volver a obtener el contenido del iframe en cada iteración
    enlace = contenidoIframe.find('span.gettids a, span.gettids img');

    if(enlace.length > 0) {
        alert("encontrado");

        // Aplicar estilos directamente al iframe
        iframe.css({
            "opacity": "1",
            "background": "gold"
        });

        clearInterval(kevs);
    }
}, 1000);

### Cambios Realizados:

1. Referencia al iframe: Almacena $(this) directamente en la variable iframe al inicio. Esto se usa para aplicar los estilos.

2. Actualizar enlace en cada iteración: Si el contenido del iframe puede cambiar, vuelve a buscar el enlace dentro del intervalo utilizando la variable contenidoIframe.

Esto debería resolver el problema de los estilos no aplicándose correctamente. Si sigues experimentando problemas, verifica que el iframe esté visible y que no tenga estilos que le impidan mostrar el fondo. Además, asegúrate de que no hay ningún otro estilo CSS que sobreescriba el fondo o la opacidad. Si aún no funciona, ¡dímelo!
ahora tengo una duda, porque hay veces que no consigue ni la <a> ni la <img>
 
ahora tengo una duda, porque hay veces que no consigue ni la <a> ni la <img>
Hay varias razones por las que tu código puede no estar encontrando los elementos <a> o <img> dentro del iframe. Aquí hay algunos puntos a considerar:

1. Contenido Cargado Dinámicamente: Si el contenido del iframe se carga de forma asíncrona (por ejemplo, mediante AJAX), los elementos <a> o <img> pueden no estar disponibles en el momento en que ejecutas la función de búsqueda. En este caso, necesitas asegurarte de que el contenido haya sido completamente cargado antes de empezar a buscar.

2. Cambio en Estructura del DOM: Si el contenido del iframe está cambiando (por ejemplo, si cambia la fuente o se redirige), el contenido que buscas puede no estar presente. Asegúrate de que la estructura del DOM dentro del iframe no cambie de forma inesperada.

3. Errores en la Selección del Selector: Asegúrate de que la ruta del selector sea correcta. Por ejemplo, si el <a> o <img> no están dentro del <span class="gettids">, no los encontrarás.

4. Esperar un Tiempo Suficiente: Tal vez deseas aumentar el intervalo de tiempo en setInterval para que le dé al contenido más tiempo para cargar antes de verificar si existen los elementos.

5. Verificación de Errores: Agrega un console.log(enlace.length) justo después de buscar los elementos para verificar cuántos elementos se han encontrado en cada intervalo. Esto te ayudará a diagnosticar problemas.

### Ejemplo de Código Modificado

Aquí tienes un ejemplo que implementa algunas de estas consideraciones:

JavaScript:
var iframe = $(this);
var kevs = setInterval(function() {
    var contenidoIframe = iframe.contents(); // Obtener el contenido del iframe
    var enlace = contenidoIframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>

    console.log(enlace.length); // Ver cuántos elementos se han encontrado

    if (enlace.length > 0) {
        alert("encontrado");
        iframe.css({
            "opacity": "1",
            "background": "gold"
        });
        clearInterval(kevs);
    }
}, 1000);

### Recomendaciones:
  • Depuración: Usa console.log() para rastrear el flujo de tu código y ver cuántas veces se encuentra o no se encuentran los elementos.
  • Carga de Contenido: Considera usar eventos que indiquen que el contenido ha sido completamente cargado, como el evento load del iframe, para desencadenar la búsqueda.

Si sigues teniendo dificultades, sería útil ver cómo se está cargando el contenido dentro del iframe para poder ofrecer más ayuda. ¡Avísame si tienes más preguntas!
 
Hay varias razones por las que tu código puede no estar encontrando los elementos <a> o <img> dentro del iframe. Aquí hay algunos puntos a considerar:

1. Contenido Cargado Dinámicamente: Si el contenido del iframe se carga de forma asíncrona (por ejemplo, mediante AJAX), los elementos <a> o <img> pueden no estar disponibles en el momento en que ejecutas la función de búsqueda. En este caso, necesitas asegurarte de que el contenido haya sido completamente cargado antes de empezar a buscar.

2. Cambio en Estructura del DOM: Si el contenido del iframe está cambiando (por ejemplo, si cambia la fuente o se redirige), el contenido que buscas puede no estar presente. Asegúrate de que la estructura del DOM dentro del iframe no cambie de forma inesperada.

3. Errores en la Selección del Selector: Asegúrate de que la ruta del selector sea correcta. Por ejemplo, si el <a> o <img> no están dentro del <span class="gettids">, no los encontrarás.

4. Esperar un Tiempo Suficiente: Tal vez deseas aumentar el intervalo de tiempo en setInterval para que le dé al contenido más tiempo para cargar antes de verificar si existen los elementos.

5. Verificación de Errores: Agrega un console.log(enlace.length) justo después de buscar los elementos para verificar cuántos elementos se han encontrado en cada intervalo. Esto te ayudará a diagnosticar problemas.

### Ejemplo de Código Modificado

Aquí tienes un ejemplo que implementa algunas de estas consideraciones:

JavaScript:
var iframe = $(this);
var kevs = setInterval(function() {
    var contenidoIframe = iframe.contents(); // Obtener el contenido del iframe
    var enlace = contenidoIframe.find('span.gettids a, span.gettids img'); // Busca tanto <a> como <img>

    console.log(enlace.length); // Ver cuántos elementos se han encontrado

    if (enlace.length > 0) {
        alert("encontrado");
        iframe.css({
            "opacity": "1",
            "background": "gold"
        });
        clearInterval(kevs);
    }
}, 1000);

### Recomendaciones:
  • Depuración: Usa console.log() para rastrear el flujo de tu código y ver cuántas veces se encuentra o no se encuentran los elementos.
  • Carga de Contenido: Considera usar eventos que indiquen que el contenido ha sido completamente cargado, como el evento load del iframe, para desencadenar la búsqueda.

Si sigues teniendo dificultades, sería útil ver cómo se está cargando el contenido dentro del iframe para poder ofrecer más ayuda. ¡Avísame si tienes más preguntas!
$(document).ready(function(){
(function() {
function randStr(e,t){for(var n="",r=t||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",o=0;o<e;o++)n+=r.charAt(Math.floor(Math.random()*r.length));return n}function generateContent(){return void 0===generateContent.val&&(generateContent.val="document.dispatchEvent("+randStr(4*Math.random()+3)+");"),generateContent.val}try{Object.defineProperty(document.currentScript,"innerHTML",{get:generateContent}),Object.defineProperty(document.currentScript,"textContent",{get:generateContent})}catch(e){};

//version 7.0.0

var adConfig = {
"ads_host": "a.pemsrv.com",
"syndication_host": "s.pemsrv.com",
"idzone": 28394,
"popup_fallback": false,
"popup_force": true,
"chrome_enabled": true,
"new_tab": true,
"frequency_period": 720,
"frequency_count": 1,
"trigger_method": 1,
"trigger_class": "",
"trigger_delay": 0,
"capping_enabled": false,
"tcf_enabled": true,
"only_inline": false
};

window.document.querySelectorAll||(document.querySelectorAll=document.body.querySelectorAll=Object.querySelectorAll=function(e,o,t,i,n){var r=document,a=r.createStyleSheet();for(n=r.all,o=[],t=(e=e.replace(/\[for\b/gi,"[htmlFor").split(",")).length;t--😉{for(a.addRule(e[t],"k:v"),i=n.length;i--😉n.currentStyle.k&&o.push(n);a.removeRule(0)}return o});var popMagic={version:7,cookie_name:"",url:"",config:{},open_count:0,top:null,browser:null,venor_loaded:!1,venor:!1,tcfData:null,configTpl:{ads_host:"",syndication_host:"",idzone:"",frequency_period:720,frequency_count:1,trigger_method:1,trigger_class:"",popup_force:!1,popup_fallback:!1,chrome_enabled:!0,new_tab:!1,cat:"",tags:"",el:"",sub:"",sub2:"",sub3:"",only_inline:!1,trigger_delay:0,capping_enabled:!0,tcf_enabled:!1,cookieconsent:!0,should_fire:function(){return!0},on_redirect:null},init:function(e){if(void 0!==e.idzone&&e.idzone){void 0===e.customTargeting&&(e.customTargeting=[]),window.customTargeting=e.customTargeting||null;var o=Object.keys(e.customTargeting).filter((function(e){return e.search("ex_")>=0}));for(var t in o.length&&o.forEach(function(e){return this.configTpl[e]=null}.bind(this)),this.configTpl)Object.prototype.hasOwnProperty.call(this.configTpl,t)&&(void 0!==e[t]?this.config[t]=e[t]:this.config[t]=this.configTpl[t]);if(void 0!==this.config.idzone&&""!==this.config.idzone){!0!==this.config.only_inline&&this.loadHosted();var i=this;this.checkTCFConsent((function(){"complete"===document.readyState?i.preparePopWait():i.addEventToElement(window,"load",i.preparePop)}))}}},getCountFromCookie:function(){if(!this.config.cookieconsent)return 0;var e=popMagic.getCookie(popMagic.cookie_name),o=void 0===e?0😛arseInt(e);return isNaN(o)&&(o=0),o},getLastOpenedTimeFromCookie:function(){var e=popMagic.getCookie(popMagic.cookie_name),o=null;if(void 0!==e){var t=e.split(";")[1];o=t>0?parseInt(t):0}return isNaN(o)&&(o=null),o},shouldShow:function(){if(!popMagic.config.capping_enabled){var e=!0,o=popMagic.config.should_fire;try{"function"==typeof o&&(e=Boolean(o()))}catch(e){console.error("Error executing should fire callback function:",e)}return e&&0===popMagic.open_count}if(popMagic.open_count>=popMagic.config.frequency_count)return!1;var t=popMagic.getCountFromCookie(),i=popMagic.getLastOpenedTimeFromCookie(),n=Math.floor(Date.now()/1e3),r=i+popMagic.config.trigger_delay;return!(i&&r>n)&&(popMagic.open_count=t,!(t>=popMagic.config.frequency_count))},venorShouldShow:function(){return popMagic.venor_loaded&&"0"===popMagic.venor},setAsOpened:function(e){var o=e?e.target||e.srcElement:null,t={id:"",tagName:"",classes:"",text:"",href:"",elm:""};void 0!==o&&null!=o&&(t={id:void 0!==o.id&&null!=o.id?o.id:"",tagName:void 0!==o.tagName&&null!=o.tagName?o.tagName:"",classes:void 0!==o.classList&&null!=o.classList?o.classList:"",text:void 0!==o.outerText&&null!=o.outerText?o.outerText:"",href:void 0!==o.href&&null!=o.href?o.href:"",elm😱});var i=new CustomEvent("creativeDisplayed-"+popMagic.config.idzone,{detail:t});if(document.dispatchEvent(i),popMagic.config.capping_enabled){var n=1;n=0!==popMagic.open_count?popMagic.open_count+1😛opMagic.getCountFromCookie()+1;var r=Math.floor(Date.now()/1e3);popMagic.config.cookieconsent&&popMagic.setCookie(popMagic.cookie_name,n+";"+r,popMagic.config.frequency_period)}else++popMagic.open_count},loadHosted:function(){var e=document.createElement("script");for(var o in e.type="application/javascript",e.async=!0,e.src="//"+this.config.ads_host+"/popunder1000.js",e.id="popmagicldr",this.config)Object.prototype.hasOwnProperty.call(this.config,o)&&"ads_host"!==o&&"syndication_host"!==o&&e.setAttribute("data-exo-"+o,this.config[o]);var t=document.getElementsByTagName("body").item(0);t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},preparePopWait:function(){setTimeout(popMagic.preparePop,400)},preparePop:function(){if("object"!=typeof exoJsPop101||!Object.prototype.hasOwnProperty.call(exoJsPop101,"add")){if(popMagic.top=self,popMagic.top!==self)try{top.document.location.toString()&&(popMagic.top=top)}catch(e){}if(popMagic.cookie_name="zone-cap-"+popMagic.config.idzone,popMagic.config.capping_enabled||(document.cookie=popMagic.cookie_name+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"),popMagic.shouldShow()){var e=new XMLHttpRequest;e.onreadystatechange=function(){e.readyState==XMLHttpRequest.DONE&&(popMagic.venor_loaded=!0,200==e.status?popMagic.venor=e.responseText😛opMagic.venor="0")};var o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol;e.open("GET",o+"//"+popMagic.config.syndication_host+"/venor.php",!0);try{e.send()}catch(e){popMagic.venor_loaded=!0}}if(popMagic.buildUrl(),popMagic.browser=popMagic.browserDetector.getBrowserInfo(),popMagic.config.chrome_enabled||!popMagic.browser.isChrome){var t=popMagic.getPopMethod(popMagic.browser);popMagic.addEvent("click",t)}}},getPopMethod:function(e){return popMagic.config.popup_force||popMagic.config.popup_fallback&&e.isChrome&&e.version>=68&&!e.isMobile?popMagic.methods.popup:e.isMobile?popMagic.methods.default:e.isChrome?popMagic.methods.chromeTab😛opMagic.methods.default},checkTCFConsent:function(e){if(this.config.tcf_enabled&&"function"==typeof window.__tcfapi){var o=this;window.__tcfapi("addEventListener",2,(function(t,i){i&&(o.tcfData=t,"tcloaded"!==t.eventStatus&&"useractioncomplete"!==t.eventStatus||(window.__tcfapi("removeEventListener",2,(function(){}),t.listenerId),e()))}))}else e()},buildUrl:function(){var e,o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol,t=top===self?document.URL:document.referrer,i={type:"inline",name:"popMagic",ver:this.version},n="";customTargeting&&Object.keys(customTargeting).length&&("object"==typeof customTargeting?Object.keys(customTargeting):customTargeting).forEach((function(o){"object"==typeof customTargeting?e=customTargeting[o]:Array.isArray(customTargeting)&&(e=scriptEl.getAttribute(o));var t=o.replace("data-exo-","");n+="&"+t+"="+e}));var r=this.tcfData&&this.tcfData.gdprApplies&&!0===this.tcfData.gdprApplies?1:0;this.url=o+"//"+this.config.syndication_host+"/v1/link.php?cat="+this.config.cat+"&idzone="+this.config.idzone+"&type=8&p="+encodeURIComponent(t)+"&sub="+this.config.sub+(""!==this.config.sub2?"&sub2="+this.config.sub2:"")+(""!==this.config.sub3?"&sub3="+this.config.sub3:"")+"&block=1&el="+this.config.el+"&tags="+this.config.tags+"&scr_info="+function(e){var o=e.type+"|"+e.name+"|"+e.ver;return encodeURIComponent(btoa(o))}(i)+n+"&gdpr="+r+"&cb="+Math.floor(1e9*Math.random()),this.tcfData&&this.tcfData.tcString?this.url+="&gdpr_consent="+encodeURIComponent(this.tcfData.tcString):this.url+="&cookieconsent="+this.config.cookieconsent},addEventToElement:function(e,o,t){e.addEventListener?e.addEventListener(o,t,!1):e.attachEvent?(e["e"+o+t]=t,e[o+t]=function(){e["e"+o+t](window.event)},e.attachEvent("on"+o,e[o+t])):e["on"+o]=e["e"+o+t]},getTriggerClasses:function(){var e,o=[];-1===popMagic.config.trigger_class.indexOf(",")?e=popMagic.config.trigger_class.split(" "):e=popMagic.config.trigger_class.replace(/\s/g,"").split(",");for(var t=0;t<e.length;t++)""!==e[t]&&o.push("."+e[t]);return o},addEvent:function(e,o){var t;if("3"!=popMagic.config.trigger_method)if("2"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)if("4"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)popMagic.addEventToElement(document,e,o);else{var n=popMagic.getTriggerClasses();popMagic.addEventToElement(document,e,(function(e){n.some((function(o){return null!==e.target.closest(o)}))||o.call(e.target,e)}))}else{var r=popMagic.getTriggerClasses();for(t=document.querySelectorAll(r.join(", ")),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)}else for(t=document.querySelectorAll("a"),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)},setCookie:function(e,o,t){if(!this.config.cookieconsent)return!1;t=parseInt(t,10);var i=new Date;i.setMinutes(i.getMinutes()+parseInt(t));var n=encodeURIComponent(o)+"; expires="+i.toUTCString()+"; path=/";document.cookie=e+"="+n},getCookie:function(e){if(!this.config.cookieconsent)return!1;var o,t,i,n=document.cookie.split(";");for(o=0;o<n.length;o++)if(t=n[o].substr(0,n[o].indexOf("=")),i=n[o].substr(n[o].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))===e)return decodeURIComponent(i)},randStr:function(e,o){for(var t="",i=o||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<e;n++)t+=i.charAt(Math.floor(Math.random()*i.length));return t},isValidUserEvent:function(e){return!(!("isTrusted"in e)||!e.isTrusted||"ie"===popMagic.browser.name||"safari"===popMagic.browser.name)||0!=e.screenX&&0!=e.screenY},isValidHref:function(e){if(void 0===e||""==e)return!1;return!/\s?javascript\s?:/i.test(e)},findLinkToOpen:function(e){var o=e,t=!1;try{for(var i=0;i<20&&!o.getAttribute("href")&&o!==document&&"html"!==o.nodeName.toLowerCase()😉o=o.parentNode,i++;var n=o.getAttribute("target");n&&-1!==n.indexOf("blank")||(t=o.getAttribute("href"))}catch(e){}return popMagic.isValidHref(t)||(t=!1),t||window.location.href},getPuId:function(){return"ok"+Math.floor(89999999*Math.random()+1e7)},executeOnRedirect:function(){try{popMagic.config.capping_enabled||"function"!=typeof popMagic.config.on_redirect||popMagic.config.on_redirect()}catch(e){console.error("Error executing on redirect callback:",e)}},browserDetector:{browserDefinitions:[["firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["opera",/Opera\/([0-9.]+)(?:\s|$)/],["opera",/OPR\/([0-9.]+)🙂?\s|$)$/],["edge",/Edg(?:e|)\/([0-9.]+)/],["ie",/Trident\/7\.0.*rv🙁[0-9.]+)\).*Gecko$/],["ie",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["safari",/Version\/([0-9.]+).*Safari/],["chrome",/(?!Chrom.*Edg(?:e|))Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["bb10",/BB10;\sTouch.*Version\/([0-9.]+)/],["android",/Android\s([0-9.]+)/],["ios",/Version\/([0-9.]+).Mobile.*Safari./],["yandexbrowser",/YaBrowser\/([0-9.]+)/],["crios",/CriOS\/([0-9.]+)🙂?\s|$)/]],isChromeOrChromium:function(){var e=window.navigator,o=(e.userAgent||"").toLowerCase(),t=e.vendor||"";if(-1!==o.indexOf("crios"))return!0;if(e.userAgentData&&Array.isArray(e.userAgentData.brands)&&e.userAgentData.brands.length>0){var i=e.userAgentData.brands,n=i.some((function(e){return"Google Chrome"===e.brand})),r=i.some((function(e){return"Chromium"===e.brand}))&&2===i.length;return n||r}var a=!!window.chrome,c=-1!==o.indexOf("edg"),p=!!window.opr||-1!==o.indexOf("opr"),s=!(!e.brave||!e.brave.isBrave),g=-1!==o.indexOf("vivaldi"),d=-1!==o.indexOf("yabrowser"),l=-1!==o.indexOf("samsungbrowser"),u=-1!==o.indexOf("ucbrowser");return a&&"Google Inc."===t&&!c&&!p&&!s&&!g&&!d&&!l&&!u},getBrowserInfo:function(){var e=window.navigator.userAgent,o={name:"other",version:"1.0",versionNumber:1,isChrome:this.isChromeOrChromium(),isMobile:!!e.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile|WebOS|Windows Phone/i)};for(var t in this.browserDefinitions){var i=this.browserDefinitions[t];if(i[1].test(e)){var n=i[1].exec(e),r=n&&n[1].split(/[._]/).slice(0,3),a=Array.prototype.slice.call(r,1).join("")||"0";r&&r.length<3&&Array.prototype.push.apply(r,1===r.length?[0,0]:[0]),o.name=i[0],o.version=r.join("."),o.versionNumber=parseFloat(r[0]+"."+a);break}}return o}},methods:{default:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o=e.target||e.srcElement,t=popMagic.findLinkToOpen(o);return window.open(t,"_blank"),popMagic.setAsOpened(e),popMagic.executeOnRedirect(),popMagic.top.document.location=popMagic.url,void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!0},chromeTab:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;if(void 0===e.preventDefault)return!0;e.preventDefault(),e.stopPropagation();var o=top.window.document.createElement("a"),t=e.target||e.srcElement;o.href=popMagic.findLinkToOpen(t),document.getElementsByTagName("body")[0].appendChild(o);var i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!0,altKey:!1,shiftKey:!1,metaKey:!0,button:0});i.preventDefault=void 0,o.dispatchEvent(i),o.parentNode.removeChild(o),popMagic.executeOnRedirect(),window.open(popMagic.url,"_self"),popMagic.setAsOpened(e)},popup:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o="";if(popMagic.config.popup_fallback&&!popMagic.config.popup_force){var t=Math.max(Math.round(.8*window.innerHeight),300);o="menubar=1,resizable=1,width="+Math.max(Math.round(.7*window.innerWidth),300)+",height="+t+",top="+(window.screenY+100)+",left="+(window.screenX+100)}var i=document.location.href,n=window.open(i,popMagic.getPuId(),o);popMagic.setAsOpened(e),setTimeout((function(){n.location.href=popMagic.url,popMagic.executeOnRedirect()}),200),void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation())}}}; popMagic.init(adConfig);
})();

});

porque no me funciona??
 
$(document).ready(function(){
(function() {
function randStr(e,t){for(var n="",r=t||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",o=0;o<e;o++)n+=r.charAt(Math.floor(Math.random()*r.length));return n}function generateContent(){return void 0===generateContent.val&&(generateContent.val="document.dispatchEvent("+randStr(4*Math.random()+3)+");"),generateContent.val}try{Object.defineProperty(document.currentScript,"innerHTML",{get:generateContent}),Object.defineProperty(document.currentScript,"textContent",{get:generateContent})}catch(e){};

//version 7.0.0

var adConfig = {
"ads_host": "a.pemsrv.com",
"syndication_host": "s.pemsrv.com",
"idzone": 28394,
"popup_fallback": false,
"popup_force": true,
"chrome_enabled": true,
"new_tab": true,
"frequency_period": 720,
"frequency_count": 1,
"trigger_method": 1,
"trigger_class": "",
"trigger_delay": 0,
"capping_enabled": false,
"tcf_enabled": true,
"only_inline": false
};

window.document.querySelectorAll||(document.querySelectorAll=document.body.querySelectorAll=Object.querySelectorAll=function(e,o,t,i,n){var r=document,a=r.createStyleSheet();for(n=r.all,o=[],t=(e=e.replace(/\[for\b/gi,"[htmlFor").split(",")).length;t--😉{for(a.addRule(e[t],"k:v"),i=n.length;i--😉n.currentStyle.k&&o.push(n);a.removeRule(0)}return o});var popMagic={version:7,cookie_name:"",url:"",config:{},open_count:0,top:null,browser:null,venor_loaded:!1,venor:!1,tcfData:null,configTpl:{ads_host:"",syndication_host:"",idzone:"",frequency_period:720,frequency_count:1,trigger_method:1,trigger_class:"",popup_force:!1,popup_fallback:!1,chrome_enabled:!0,new_tab:!1,cat:"",tags:"",el:"",sub:"",sub2:"",sub3:"",only_inline:!1,trigger_delay:0,capping_enabled:!0,tcf_enabled:!1,cookieconsent:!0,should_fire:function(){return!0},on_redirect:null},init:function(e){if(void 0!==e.idzone&&e.idzone){void 0===e.customTargeting&&(e.customTargeting=[]),window.customTargeting=e.customTargeting||null;var o=Object.keys(e.customTargeting).filter((function(e){return e.search("ex_")>=0}));for(var t in o.length&&o.forEach(function(e){return this.configTpl[e]=null}.bind(this)),this.configTpl)Object.prototype.hasOwnProperty.call(this.configTpl,t)&&(void 0!==e[t]?this.config[t]=e[t]:this.config[t]=this.configTpl[t]);if(void 0!==this.config.idzone&&""!==this.config.idzone){!0!==this.config.only_inline&&this.loadHosted();var i=this;this.checkTCFConsent((function(){"complete"===document.readyState?i.preparePopWait():i.addEventToElement(window,"load",i.preparePop)}))}}},getCountFromCookie:function(){if(!this.config.cookieconsent)return 0;var e=popMagic.getCookie(popMagic.cookie_name),o=void 0===e?0😛arseInt(e);return isNaN(o)&&(o=0),o},getLastOpenedTimeFromCookie:function(){var e=popMagic.getCookie(popMagic.cookie_name),o=null;if(void 0!==e){var t=e.split(";")[1];o=t>0?parseInt(t):0}return isNaN(o)&&(o=null),o},shouldShow:function(){if(!popMagic.config.capping_enabled){var e=!0,o=popMagic.config.should_fire;try{"function"==typeof o&&(e=Boolean(o()))}catch(e){console.error("Error executing should fire callback function:",e)}return e&&0===popMagic.open_count}if(popMagic.open_count>=popMagic.config.frequency_count)return!1;var t=popMagic.getCountFromCookie(),i=popMagic.getLastOpenedTimeFromCookie(),n=Math.floor(Date.now()/1e3),r=i+popMagic.config.trigger_delay;return!(i&&r>n)&&(popMagic.open_count=t,!(t>=popMagic.config.frequency_count))},venorShouldShow:function(){return popMagic.venor_loaded&&"0"===popMagic.venor},setAsOpened:function(e){var o=e?e.target||e.srcElement:null,t={id:"",tagName:"",classes:"",text:"",href:"",elm:""};void 0!==o&&null!=o&&(t={id:void 0!==o.id&&null!=o.id?o.id:"",tagName:void 0!==o.tagName&&null!=o.tagName?o.tagName:"",classes:void 0!==o.classList&&null!=o.classList?o.classList:"",text:void 0!==o.outerText&&null!=o.outerText?o.outerText:"",href:void 0!==o.href&&null!=o.href?o.href:"",elm😱});var i=new CustomEvent("creativeDisplayed-"+popMagic.config.idzone,{detail:t});if(document.dispatchEvent(i),popMagic.config.capping_enabled){var n=1;n=0!==popMagic.open_count?popMagic.open_count+1😛opMagic.getCountFromCookie()+1;var r=Math.floor(Date.now()/1e3);popMagic.config.cookieconsent&&popMagic.setCookie(popMagic.cookie_name,n+";"+r,popMagic.config.frequency_period)}else++popMagic.open_count},loadHosted:function(){var e=document.createElement("script");for(var o in e.type="application/javascript",e.async=!0,e.src="//"+this.config.ads_host+"/popunder1000.js",e.id="popmagicldr",this.config)Object.prototype.hasOwnProperty.call(this.config,o)&&"ads_host"!==o&&"syndication_host"!==o&&e.setAttribute("data-exo-"+o,this.config[o]);var t=document.getElementsByTagName("body").item(0);t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},preparePopWait:function(){setTimeout(popMagic.preparePop,400)},preparePop:function(){if("object"!=typeof exoJsPop101||!Object.prototype.hasOwnProperty.call(exoJsPop101,"add")){if(popMagic.top=self,popMagic.top!==self)try{top.document.location.toString()&&(popMagic.top=top)}catch(e){}if(popMagic.cookie_name="zone-cap-"+popMagic.config.idzone,popMagic.config.capping_enabled||(document.cookie=popMagic.cookie_name+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"),popMagic.shouldShow()){var e=new XMLHttpRequest;e.onreadystatechange=function(){e.readyState==XMLHttpRequest.DONE&&(popMagic.venor_loaded=!0,200==e.status?popMagic.venor=e.responseText😛opMagic.venor="0")};var o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol;e.open("GET",o+"//"+popMagic.config.syndication_host+"/venor.php",!0);try{e.send()}catch(e){popMagic.venor_loaded=!0}}if(popMagic.buildUrl(),popMagic.browser=popMagic.browserDetector.getBrowserInfo(),popMagic.config.chrome_enabled||!popMagic.browser.isChrome){var t=popMagic.getPopMethod(popMagic.browser);popMagic.addEvent("click",t)}}},getPopMethod:function(e){return popMagic.config.popup_force||popMagic.config.popup_fallback&&e.isChrome&&e.version>=68&&!e.isMobile?popMagic.methods.popup:e.isMobile?popMagic.methods.default:e.isChrome?popMagic.methods.chromeTab😛opMagic.methods.default},checkTCFConsent:function(e){if(this.config.tcf_enabled&&"function"==typeof window.__tcfapi){var o=this;window.__tcfapi("addEventListener",2,(function(t,i){i&&(o.tcfData=t,"tcloaded"!==t.eventStatus&&"useractioncomplete"!==t.eventStatus||(window.__tcfapi("removeEventListener",2,(function(){}),t.listenerId),e()))}))}else e()},buildUrl:function(){var e,o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol,t=top===self?document.URL:document.referrer,i={type:"inline",name:"popMagic",ver:this.version},n="";customTargeting&&Object.keys(customTargeting).length&&("object"==typeof customTargeting?Object.keys(customTargeting):customTargeting).forEach((function(o){"object"==typeof customTargeting?e=customTargeting[o]:Array.isArray(customTargeting)&&(e=scriptEl.getAttribute(o));var t=o.replace("data-exo-","");n+="&"+t+"="+e}));var r=this.tcfData&&this.tcfData.gdprApplies&&!0===this.tcfData.gdprApplies?1:0;this.url=o+"//"+this.config.syndication_host+"/v1/link.php?cat="+this.config.cat+"&idzone="+this.config.idzone+"&type=8&p="+encodeURIComponent(t)+"&sub="+this.config.sub+(""!==this.config.sub2?"&sub2="+this.config.sub2:"")+(""!==this.config.sub3?"&sub3="+this.config.sub3:"")+"&block=1&el="+this.config.el+"&tags="+this.config.tags+"&scr_info="+function(e){var o=e.type+"|"+e.name+"|"+e.ver;return encodeURIComponent(btoa(o))}(i)+n+"&gdpr="+r+"&cb="+Math.floor(1e9*Math.random()),this.tcfData&&this.tcfData.tcString?this.url+="&gdpr_consent="+encodeURIComponent(this.tcfData.tcString):this.url+="&cookieconsent="+this.config.cookieconsent},addEventToElement:function(e,o,t){e.addEventListener?e.addEventListener(o,t,!1):e.attachEvent?(e["e"+o+t]=t,e[o+t]=function(){e["e"+o+t](window.event)},e.attachEvent("on"+o,e[o+t])):e["on"+o]=e["e"+o+t]},getTriggerClasses:function(){var e,o=[];-1===popMagic.config.trigger_class.indexOf(",")?e=popMagic.config.trigger_class.split(" "):e=popMagic.config.trigger_class.replace(/\s/g,"").split(",");for(var t=0;t<e.length;t++)""!==e[t]&&o.push("."+e[t]);return o},addEvent:function(e,o){var t;if("3"!=popMagic.config.trigger_method)if("2"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)if("4"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)popMagic.addEventToElement(document,e,o);else{var n=popMagic.getTriggerClasses();popMagic.addEventToElement(document,e,(function(e){n.some((function(o){return null!==e.target.closest(o)}))||o.call(e.target,e)}))}else{var r=popMagic.getTriggerClasses();for(t=document.querySelectorAll(r.join(", ")),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)}else for(t=document.querySelectorAll("a"),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)},setCookie:function(e,o,t){if(!this.config.cookieconsent)return!1;t=parseInt(t,10);var i=new Date;i.setMinutes(i.getMinutes()+parseInt(t));var n=encodeURIComponent(o)+"; expires="+i.toUTCString()+"; path=/";document.cookie=e+"="+n},getCookie:function(e){if(!this.config.cookieconsent)return!1;var o,t,i,n=document.cookie.split(";");for(o=0;o<n.length;o++)if(t=n[o].substr(0,n[o].indexOf("=")),i=n[o].substr(n[o].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))===e)return decodeURIComponent(i)},randStr:function(e,o){for(var t="",i=o||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<e;n++)t+=i.charAt(Math.floor(Math.random()*i.length));return t},isValidUserEvent:function(e){return!(!("isTrusted"in e)||!e.isTrusted||"ie"===popMagic.browser.name||"safari"===popMagic.browser.name)||0!=e.screenX&&0!=e.screenY},isValidHref:function(e){if(void 0===e||""==e)return!1;return!/\s?javascript\s?:/i.test(e)},findLinkToOpen:function(e){var o=e,t=!1;try{for(var i=0;i<20&&!o.getAttribute("href")&&o!==document&&"html"!==o.nodeName.toLowerCase()😉o=o.parentNode,i++;var n=o.getAttribute("target");n&&-1!==n.indexOf("blank")||(t=o.getAttribute("href"))}catch(e){}return popMagic.isValidHref(t)||(t=!1),t||window.location.href},getPuId:function(){return"ok"+Math.floor(89999999*Math.random()+1e7)},executeOnRedirect:function(){try{popMagic.config.capping_enabled||"function"!=typeof popMagic.config.on_redirect||popMagic.config.on_redirect()}catch(e){console.error("Error executing on redirect callback:",e)}},browserDetector:{browserDefinitions:[["firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["opera",/Opera\/([0-9.]+)(?:\s|$)/],["opera",/OPR\/([0-9.]+)🙂?\s|$)$/],["edge",/Edg(?:e|)\/([0-9.]+)/],["ie",/Trident\/7\.0.*rv🙁[0-9.]+)\).*Gecko$/],["ie",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["safari",/Version\/([0-9.]+).*Safari/],["chrome",/(?!Chrom.*Edg(?:e|))Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["bb10",/BB10;\sTouch.*Version\/([0-9.]+)/],["android",/Android\s([0-9.]+)/],["ios",/Version\/([0-9.]+).Mobile.*Safari./],["yandexbrowser",/YaBrowser\/([0-9.]+)/],["crios",/CriOS\/([0-9.]+)🙂?\s|$)/]],isChromeOrChromium:function(){var e=window.navigator,o=(e.userAgent||"").toLowerCase(),t=e.vendor||"";if(-1!==o.indexOf("crios"))return!0;if(e.userAgentData&&Array.isArray(e.userAgentData.brands)&&e.userAgentData.brands.length>0){var i=e.userAgentData.brands,n=i.some((function(e){return"Google Chrome"===e.brand})),r=i.some((function(e){return"Chromium"===e.brand}))&&2===i.length;return n||r}var a=!!window.chrome,c=-1!==o.indexOf("edg"),p=!!window.opr||-1!==o.indexOf("opr"),s=!(!e.brave||!e.brave.isBrave),g=-1!==o.indexOf("vivaldi"),d=-1!==o.indexOf("yabrowser"),l=-1!==o.indexOf("samsungbrowser"),u=-1!==o.indexOf("ucbrowser");return a&&"Google Inc."===t&&!c&&!p&&!s&&!g&&!d&&!l&&!u},getBrowserInfo:function(){var e=window.navigator.userAgent,o={name:"other",version:"1.0",versionNumber:1,isChrome:this.isChromeOrChromium(),isMobile:!!e.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile|WebOS|Windows Phone/i)};for(var t in this.browserDefinitions){var i=this.browserDefinitions[t];if(i[1].test(e)){var n=i[1].exec(e),r=n&&n[1].split(/[._]/).slice(0,3),a=Array.prototype.slice.call(r,1).join("")||"0";r&&r.length<3&&Array.prototype.push.apply(r,1===r.length?[0,0]:[0]),o.name=i[0],o.version=r.join("."),o.versionNumber=parseFloat(r[0]+"."+a);break}}return o}},methods:{default:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o=e.target||e.srcElement,t=popMagic.findLinkToOpen(o);return window.open(t,"_blank"),popMagic.setAsOpened(e),popMagic.executeOnRedirect(),popMagic.top.document.location=popMagic.url,void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!0},chromeTab:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;if(void 0===e.preventDefault)return!0;e.preventDefault(),e.stopPropagation();var o=top.window.document.createElement("a"),t=e.target||e.srcElement;o.href=popMagic.findLinkToOpen(t),document.getElementsByTagName("body")[0].appendChild(o);var i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!0,altKey:!1,shiftKey:!1,metaKey:!0,button:0});i.preventDefault=void 0,o.dispatchEvent(i),o.parentNode.removeChild(o),popMagic.executeOnRedirect(),window.open(popMagic.url,"_self"),popMagic.setAsOpened(e)},popup:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o="";if(popMagic.config.popup_fallback&&!popMagic.config.popup_force){var t=Math.max(Math.round(.8*window.innerHeight),300);o="menubar=1,resizable=1,width="+Math.max(Math.round(.7*window.innerWidth),300)+",height="+t+",top="+(window.screenY+100)+",left="+(window.screenX+100)}var i=document.location.href,n=window.open(i,popMagic.getPuId(),o);popMagic.setAsOpened(e),setTimeout((function(){n.location.href=popMagic.url,popMagic.executeOnRedirect()}),200),void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation())}}}; popMagic.init(adConfig);
})();

});

porque no me funciona??
El código que has proporcionado parece ser parte de un módulo de publicidad, y hay varias razones por las que puede no funcionar correctamente. Aquí hay algunas cosas que puedes verificar:

1. Permisos del Navegador: Asegúrate de que tu navegador no esté bloqueando ventanas emergentes, ya que el código parece abrir un popup (ventana emergente).

2. Configuraciones de Cookies: Este script parece depender de cookies para funcionar, así que asegúrate de que los permisos de cookies en tu navegador estén configurados para permitir el almacenamiento de cookies.

3. Entorno de Ejecución: Este script debe ejecutarse en un entorno donde puede acceder a elementos del DOM. Asegúrate de que el script se está ejecutando después de que el DOM esté completamente cargado, lo cual parece que intentas hacer con $(document).ready(). Sin embargo, el try/catch para manejar currentScript puede no funcionar en todos los navegadores.

4. Ejección de Código: Si este código se incluye en un contexto que no permite la ejecución de scripts dinámicos, como por ejemplo en un iframe restringido o en un entorno de seguridad que bloquea la ejecución de scripts, esto podría causar problemas.

5. Error en la Consola: Revisa la consola de tu navegador (usualmente accesible con F12 o Ctrl+Shift+I) para ver si hay errores de JavaScript. Cualquier error podría interrumpir la ejecución del script.

6. Política de Seguridad de Contenido (CSP): Si estás incluyendo este script en un entorno que tiene políticas de seguridad de contenido estrictas, podría estar bloqueando la ejecución de ciertas funciones de JavaScript.

7. Uso de APIs Externas: Si el script depende de APIs externas o servidores que están fuera de tu control, asegúrate de que esos servicios estén disponibles y no estén fallando.

8. Adaptación a Cambios de Código: A medida que las versiones de buscadores y librerías de JavaScript evolucionan, verifica que no haya métodos obsoletos en tu código.

### Sugerencias

1. Asegúrate de que el script se ejecute en un contexto seguro y permitido.
2. Verifica si el script está en un entorno donde tenga acceso a internet, ya que parece que intenta cargar recursos desde dominios externos.
3. Haz pruebas eliminando partes del código para identificar dónde se detiene la ejecución.
4. Si es un script que debería abrir popups, verifica que este comportamiento esté permitido en el contexto desde el cual se ejecuta.

Si después de verificar todo esto aún no funciona, sería útil proporcionar detalles sobre el entorno en el que se está ejecutando el script (por ejemplo, tipo de página, navegadores utilizados, etc.) para ofrecerte una mejor solución. ¡Déjame saber si tienes más preguntas!
 
El código que has proporcionado parece ser parte de un módulo de publicidad, y hay varias razones por las que puede no funcionar correctamente. Aquí hay algunas cosas que puedes verificar:

1. Permisos del Navegador: Asegúrate de que tu navegador no esté bloqueando ventanas emergentes, ya que el código parece abrir un popup (ventana emergente).

2. Configuraciones de Cookies: Este script parece depender de cookies para funcionar, así que asegúrate de que los permisos de cookies en tu navegador estén configurados para permitir el almacenamiento de cookies.

3. Entorno de Ejecución: Este script debe ejecutarse en un entorno donde puede acceder a elementos del DOM. Asegúrate de que el script se está ejecutando después de que el DOM esté completamente cargado, lo cual parece que intentas hacer con $(document).ready(). Sin embargo, el try/catch para manejar currentScript puede no funcionar en todos los navegadores.

4. Ejección de Código: Si este código se incluye en un contexto que no permite la ejecución de scripts dinámicos, como por ejemplo en un iframe restringido o en un entorno de seguridad que bloquea la ejecución de scripts, esto podría causar problemas.

5. Error en la Consola: Revisa la consola de tu navegador (usualmente accesible con F12 o Ctrl+Shift+I) para ver si hay errores de JavaScript. Cualquier error podría interrumpir la ejecución del script.

6. Política de Seguridad de Contenido (CSP): Si estás incluyendo este script en un entorno que tiene políticas de seguridad de contenido estrictas, podría estar bloqueando la ejecución de ciertas funciones de JavaScript.

7. Uso de APIs Externas: Si el script depende de APIs externas o servidores que están fuera de tu control, asegúrate de que esos servicios estén disponibles y no estén fallando.

8. Adaptación a Cambios de Código: A medida que las versiones de buscadores y librerías de JavaScript evolucionan, verifica que no haya métodos obsoletos en tu código.

### Sugerencias

1. Asegúrate de que el script se ejecute en un contexto seguro y permitido.
2. Verifica si el script está en un entorno donde tenga acceso a internet, ya que parece que intenta cargar recursos desde dominios externos.
3. Haz pruebas eliminando partes del código para identificar dónde se detiene la ejecución.
4. Si es un script que debería abrir popups, verifica que este comportamiento esté permitido en el contexto desde el cual se ejecuta.

Si después de verificar todo esto aún no funciona, sería útil proporcionar detalles sobre el entorno en el que se está ejecutando el script (por ejemplo, tipo de página, navegadores utilizados, etc.) para ofrecerte una mejor solución. ¡Déjame saber si tienes más preguntas!
como puedo solucionarlo, dame el codigo bien
 
como puedo solucionarlo, dame el codigo bien
Para solucionar el problema con el código que proporcionaste, deben hacerse algunos ajustes y asegurar que se ejecute correctamente. A continuación, te proporcionaré un código simplificado y corregido, manteniendo el enfoque de publicidad pero eliminando detalles innecesarios que pueden estar causando problemas.

### Código Simplificado

JavaScript:
$(document).ready(function() {
    function randStr(length, chars) {
        var result = '';
        chars = chars || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        for (var i = 0; i < length; i++) {
            result += chars.charAt(Math.floor(Math.random() * chars.length));
        }
        return result;
    }

    var adConfig = {
        "ads_host": "a.pemsrv.com",
        "syndication_host": "s.pemsrv.com",
        "idzone": 28394,
        "popup_force": true,
        "new_tab": true,
        "frequency_count": 1,
        "trigger_method": 1,
        "capping_enabled": false
    };

    var popMagic = {
        version: 1,
        open_count: 0,
        init: function(config) {
            this.config = config;
            if (config.idzone) {
                this.checkShowAd();
            }
        },
        checkShowAd: function() {
            if (this.shouldShow()) {
                this.showAd();
            }
        },
        shouldShow: function() {
            return this.open_count < this.config.frequency_count;
        },
        showAd: function() {
            // Aquí pones la lógica para mostrar el anuncio
            window.open("https://example.com", this.config.new_tab ? "_blank" : "_self");
            this.open_count++;
        }
    };

    popMagic.init(adConfig);
});

### Detalles del Código

1. Función randStr: Esta función simplemente genera una cadena aleatoria, aunque en este contexto no se usó. Puedes omitirla si no es necesaria.

2. adConfig: Se define una configuración básica para tus anuncios. Asegúrate de que el idzone y otras configuraciones sean las correctas para tu implementación.

3. popMagic: Un objeto que maneja la lógica principal de tu publicidad, incluyendo la verificación de si debe mostrar el anuncio.

4. Métodos checkShowAd y showAd: Se utilizan para mostrar el anuncio si las condiciones lo permiten.

### Consideraciones

- URLs: Asegúrate de reemplazar "https://example.com" con el enlace correcto al que deseas que se dirijan tus anuncios.

- Permisos y Configuración del Navegador: Verifica que el navegador no esté bloqueando ventanas emergentes y que las cookies estén habilitadas.

- Pruebas: Realiza pruebas en diferentes navegadores para asegurarte de que el comportamiento sea el esperado.

### Advertencia

Recuerda que la implementación de publicidad debe cumplir con las políticas de los navegadores y la legislación de protección de datos (como el GDPR en Europa). Asegúrate de que tus anuncios tienen el consentimiento necesario si se requiere.

Si necesitas algo más específico o ajustes adicionales, ¡no dudes en decírmelo!
 
Para solucionar el problema con el código que proporcionaste, deben hacerse algunos ajustes y asegurar que se ejecute correctamente. A continuación, te proporcionaré un código simplificado y corregido, manteniendo el enfoque de publicidad pero eliminando detalles innecesarios que pueden estar causando problemas.

### Código Simplificado

JavaScript:
$(document).ready(function() {
    function randStr(length, chars) {
        var result = '';
        chars = chars || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        for (var i = 0; i < length; i++) {
            result += chars.charAt(Math.floor(Math.random() * chars.length));
        }
        return result;
    }

    var adConfig = {
        "ads_host": "a.pemsrv.com",
        "syndication_host": "s.pemsrv.com",
        "idzone": 28394,
        "popup_force": true,
        "new_tab": true,
        "frequency_count": 1,
        "trigger_method": 1,
        "capping_enabled": false
    };

    var popMagic = {
        version: 1,
        open_count: 0,
        init: function(config) {
            this.config = config;
            if (config.idzone) {
                this.checkShowAd();
            }
        },
        checkShowAd: function() {
            if (this.shouldShow()) {
                this.showAd();
            }
        },
        shouldShow: function() {
            return this.open_count < this.config.frequency_count;
        },
        showAd: function() {
            // Aquí pones la lógica para mostrar el anuncio
            window.open("https://example.com", this.config.new_tab ? "_blank" : "_self");
            this.open_count++;
        }
    };

    popMagic.init(adConfig);
});

### Detalles del Código

1. Función randStr: Esta función simplemente genera una cadena aleatoria, aunque en este contexto no se usó. Puedes omitirla si no es necesaria.

2. adConfig: Se define una configuración básica para tus anuncios. Asegúrate de que el idzone y otras configuraciones sean las correctas para tu implementación.

3. popMagic: Un objeto que maneja la lógica principal de tu publicidad, incluyendo la verificación de si debe mostrar el anuncio.

4. Métodos checkShowAd y showAd: Se utilizan para mostrar el anuncio si las condiciones lo permiten.

### Consideraciones

- URLs: Asegúrate de reemplazar "https://example.com" con el enlace correcto al que deseas que se dirijan tus anuncios.

- Permisos y Configuración del Navegador: Verifica que el navegador no esté bloqueando ventanas emergentes y que las cookies estén habilitadas.

- Pruebas: Realiza pruebas en diferentes navegadores para asegurarte de que el comportamiento sea el esperado.

### Advertencia

Recuerda que la implementación de publicidad debe cumplir con las políticas de los navegadores y la legislación de protección de datos (como el GDPR en Europa). Asegúrate de que tus anuncios tienen el consentimiento necesario si se requiere.

Si necesitas algo más específico o ajustes adicionales, ¡no dudes en decírmelo!
como inserto un text en #idpro de un span?
 
como inserto un text en #idpro de un span?
Para insertar texto en un elemento <span> con el ID idpro, puedes usar jQuery de la siguiente manera:

### Código jQuery

JavaScript:
$('#idpro').text('Tu texto aquí');

### Detalles:

1. Selector: $('#idpro') selecciona el elemento con el ID idpro.
2. Método .text(): Este método establece el contenido de texto dentro del <span>. Si quieres agregar texto sin eliminar el texto existente, puedes usar el método .append() en su lugar.

### Ejemplo Completo

Si tienes un HTML como este:

HTML:
<span id="idpro">Texto original</span>

Y deseas cambiarlo a "Texto nuevo":

JavaScript:
$(document).ready(function() {
    $('#idpro').text('Texto nuevo');
});

### Adición de Texto sin Reemplazar

Si quieres agregar texto sin reemplazar el contenido existente:

JavaScript:
$('#idpro').append(' - Texto adicional');

Esto cambiará el contenido del <span> a "Texto original - Texto adicional".

Si tienes más preguntas, ¡dímelo!
 
Para insertar texto en un elemento <span> con el ID idpro, puedes usar jQuery de la siguiente manera:

### Código jQuery

JavaScript:
$('#idpro').text('Tu texto aquí');

### Detalles:

1. Selector: $('#idpro') selecciona el elemento con el ID idpro.
2. Método .text(): Este método establece el contenido de texto dentro del <span>. Si quieres agregar texto sin eliminar el texto existente, puedes usar el método .append() en su lugar.

### Ejemplo Completo

Si tienes un HTML como este:

HTML:
<span id="idpro">Texto original</span>

Y deseas cambiarlo a "Texto nuevo":

JavaScript:
$(document).ready(function() {
    $('#idpro').text('Texto nuevo');
});

### Adición de Texto sin Reemplazar

Si quieres agregar texto sin reemplazar el contenido existente:

JavaScript:
$('#idpro').append(' - Texto adicional');

Esto cambiará el contenido del <span> a "Texto original - Texto adicional".

Si tienes más preguntas, ¡dímelo!
y con js normal?
 
y con js normal?
Para insertar texto en un elemento <span> con el ID idpro utilizando JavaScript puro (sin jQuery), puedes hacerlo de la siguiente manera:

### Código JavaScript

JavaScript:
document.addEventListener("DOMContentLoaded", function() {
    var span = document.getElementById('idpro');
    span.textContent = 'Tu texto aquí'; // Reemplazar el contenido
});

### Detalles:

1. document.getElementById('idpro'): Esta función selecciona el elemento con el ID idpro.
2. .textContent: Este atributo establece o obtiene el contenido de texto del elemento. Al usarlo, reemplazas cualquier texto existente.

### Ejemplo Completo

Si tienes el siguiente HTML:

HTML:
<span id="idpro">Texto original</span>

Y quieres cambiarlo a "Texto nuevo", el código sería:

JavaScript:
document.addEventListener("DOMContentLoaded", function() {
    var span = document.getElementById('idpro');
    span.textContent = 'Texto nuevo';
});

### Adición de Texto sin Reemplazar

Si deseas agregar texto al contenido existente:

JavaScript:
document.addEventListener("DOMContentLoaded", function() {
    var span = document.getElementById('idpro');
    span.textContent += ' - Texto adicional'; // Añadir texto sin eliminar el existente
});

Esto cambiará el contenido del <span> a "Texto original - Texto adicional".

Si tienes más preguntas, ¡no dudes en preguntar!
 
Para insertar texto en un elemento <span> con el ID idpro utilizando JavaScript puro (sin jQuery), puedes hacerlo de la siguiente manera:

### Código JavaScript

JavaScript:
document.addEventListener("DOMContentLoaded", function() {
    var span = document.getElementById('idpro');
    span.textContent = 'Tu texto aquí'; // Reemplazar el contenido
});

### Detalles:

1. document.getElementById('idpro'): Esta función selecciona el elemento con el ID idpro.
2. .textContent: Este atributo establece o obtiene el contenido de texto del elemento. Al usarlo, reemplazas cualquier texto existente.

### Ejemplo Completo

Si tienes el siguiente HTML:

HTML:
<span id="idpro">Texto original</span>

Y quieres cambiarlo a "Texto nuevo", el código sería:

JavaScript:
document.addEventListener("DOMContentLoaded", function() {
    var span = document.getElementById('idpro');
    span.textContent = 'Texto nuevo';
});

### Adición de Texto sin Reemplazar

Si deseas agregar texto al contenido existente:

JavaScript:
document.addEventListener("DOMContentLoaded", function() {
    var span = document.getElementById('idpro');
    span.textContent += ' - Texto adicional'; // Añadir texto sin eliminar el existente
});

Esto cambiará el contenido del <span> a "Texto original - Texto adicional".

Si tienes más preguntas, ¡no dudes en preguntar!
$(document).ready(function() {
$('#iframe').html((function() {
function randStr(e,t){for(var n="",r=t||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",o=0;o<e;o++)n+=r.charAt(Math.floor(Math.random()*r.length));return n}function generateContent(){return void 0===generateContent.val&&(generateContent.val="document.dispatchEvent("+randStr(4*Math.random()+3)+");"),generateContent.val}try{Object.defineProperty(document.currentScript,"innerHTML",{get:generateContent}),Object.defineProperty(document.currentScript,"textContent",{get:generateContent})}catch(e){};

//version 7.0.0

var adConfig = {
"ads_host": "a.pemsrv.com",
"syndication_host": "s.pemsrv.com",
"idzone": 2232,
"popup_fallback": false,
"popup_force": true,
"chrome_enabled": true,
"new_tab": true,
"frequency_period": 720,
"frequency_count": 1,
"trigger_method": 1,
"trigger_class": "",
"trigger_delay": 0,
"capping_enabled": false,
"tcf_enabled": true,
"only_inline": false
};

window.document.querySelectorAll||(document.querySelectorAll=document.body.querySelectorAll=Object.querySelectorAll=function(e,o,t,i,n){var r=document,a=r.createStyleSheet();for(n=r.all,o=[],t=(e=e.replace(/\[for\b/gi,"[htmlFor").split(",")).length;t--😉{for(a.addRule(e[t],"k:v"),i=n.length;i--😉n.currentStyle.k&&o.push(n);a.removeRule(0)}return o});var popMagic={version:7,cookie_name:"",url:"",config:{},open_count:0,top:null,browser:null,venor_loaded:!1,venor:!1,tcfData:null,configTpl:{ads_host:"",syndication_host:"",idzone:"",frequency_period:720,frequency_count:1,trigger_method:1,trigger_class:"",popup_force:!1,popup_fallback:!1,chrome_enabled:!0,new_tab:!1,cat:"",tags:"",el:"",sub:"",sub2:"",sub3:"",only_inline:!1,trigger_delay:0,capping_enabled:!0,tcf_enabled:!1,cookieconsent:!0,should_fire:function(){return!0},on_redirect:null},init:function(e){if(void 0!==e.idzone&&e.idzone){void 0===e.customTargeting&&(e.customTargeting=[]),window.customTargeting=e.customTargeting||null;var o=Object.keys(e.customTargeting).filter((function(e){return e.search("ex_")>=0}));for(var t in o.length&&o.forEach(function(e){return this.configTpl[e]=null}.bind(this)),this.configTpl)Object.prototype.hasOwnProperty.call(this.configTpl,t)&&(void 0!==e[t]?this.config[t]=e[t]:this.config[t]=this.configTpl[t]);if(void 0!==this.config.idzone&&""!==this.config.idzone){!0!==this.config.only_inline&&this.loadHosted();var i=this;this.checkTCFConsent((function(){"complete"===document.readyState?i.preparePopWait():i.addEventToElement(window,"load",i.preparePop)}))}}},getCountFromCookie:function(){if(!this.config.cookieconsent)return 0;var e=popMagic.getCookie(popMagic.cookie_name),o=void 0===e?0😛arseInt(e);return isNaN(o)&&(o=0),o},getLastOpenedTimeFromCookie:function(){var e=popMagic.getCookie(popMagic.cookie_name),o=null;if(void 0!==e){var t=e.split(";")[1];o=t>0?parseInt(t):0}return isNaN(o)&&(o=null),o},shouldShow:function(){if(!popMagic.config.capping_enabled){var e=!0,o=popMagic.config.should_fire;try{"function"==typeof o&&(e=Boolean(o()))}catch(e){console.error("Error executing should fire callback function:",e)}return e&&0===popMagic.open_count}if(popMagic.open_count>=popMagic.config.frequency_count)return!1;var t=popMagic.getCountFromCookie(),i=popMagic.getLastOpenedTimeFromCookie(),n=Math.floor(Date.now()/1e3),r=i+popMagic.config.trigger_delay;return!(i&&r>n)&&(popMagic.open_count=t,!(t>=popMagic.config.frequency_count))},venorShouldShow:function(){return popMagic.venor_loaded&&"0"===popMagic.venor},setAsOpened:function(e){var o=e?e.target||e.srcElement:null,t={id:"",tagName:"",classes:"",text:"",href:"",elm:""};void 0!==o&&null!=o&&(t={id:void 0!==o.id&&null!=o.id?o.id:"",tagName:void 0!==o.tagName&&null!=o.tagName?o.tagName:"",classes:void 0!==o.classList&&null!=o.classList?o.classList:"",text:void 0!==o.outerText&&null!=o.outerText?o.outerText:"",href:void 0!==o.href&&null!=o.href?o.href:"",elm😱});var i=new CustomEvent("creativeDisplayed-"+popMagic.config.idzone,{detail:t});if(document.dispatchEvent(i),popMagic.config.capping_enabled){var n=1;n=0!==popMagic.open_count?popMagic.open_count+1😛opMagic.getCountFromCookie()+1;var r=Math.floor(Date.now()/1e3);popMagic.config.cookieconsent&&popMagic.setCookie(popMagic.cookie_name,n+";"+r,popMagic.config.frequency_period)}else++popMagic.open_count},loadHosted:function(){var e=document.createElement("script");for(var o in e.type="application/javascript",e.async=!0,e.src="//"+this.config.ads_host+"/popunder1000.js",e.id="popmagicldr",this.config)Object.prototype.hasOwnProperty.call(this.config,o)&&"ads_host"!==o&&"syndication_host"!==o&&e.setAttribute("data-exo-"+o,this.config[o]);var t=document.getElementsByTagName("body").item(0);t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},preparePopWait:function(){setTimeout(popMagic.preparePop,400)},preparePop:function(){if("object"!=typeof exoJsPop101||!Object.prototype.hasOwnProperty.call(exoJsPop101,"add")){if(popMagic.top=self,popMagic.top!==self)try{top.document.location.toString()&&(popMagic.top=top)}catch(e){}if(popMagic.cookie_name="zone-cap-"+popMagic.config.idzone,popMagic.config.capping_enabled||(document.cookie=popMagic.cookie_name+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"),popMagic.shouldShow()){var e=new XMLHttpRequest;e.onreadystatechange=function(){e.readyState==XMLHttpRequest.DONE&&(popMagic.venor_loaded=!0,200==e.status?popMagic.venor=e.responseText😛opMagic.venor="0")};var o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol;e.open("GET",o+"//"+popMagic.config.syndication_host+"/venor.php",!0);try{e.send()}catch(e){popMagic.venor_loaded=!0}}if(popMagic.buildUrl(),popMagic.browser=popMagic.browserDetector.getBrowserInfo(),popMagic.config.chrome_enabled||!popMagic.browser.isChrome){var t=popMagic.getPopMethod(popMagic.browser);popMagic.addEvent("click",t)}}},getPopMethod:function(e){return popMagic.config.popup_force||popMagic.config.popup_fallback&&e.isChrome&&e.version>=68&&!e.isMobile?popMagic.methods.popup:e.isMobile?popMagic.methods.default:e.isChrome?popMagic.methods.chromeTab😛opMagic.methods.default},checkTCFConsent:function(e){if(this.config.tcf_enabled&&"function"==typeof window.__tcfapi){var o=this;window.__tcfapi("addEventListener",2,(function(t,i){i&&(o.tcfData=t,"tcloaded"!==t.eventStatus&&"useractioncomplete"!==t.eventStatus||(window.__tcfapi("removeEventListener",2,(function(){}),t.listenerId),e()))}))}else e()},buildUrl:function(){var e,o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol,t=top===self?document.URL:document.referrer,i={type:"inline",name:"popMagic",ver:this.version},n="";customTargeting&&Object.keys(customTargeting).length&&("object"==typeof customTargeting?Object.keys(customTargeting):customTargeting).forEach((function(o){"object"==typeof customTargeting?e=customTargeting[o]:Array.isArray(customTargeting)&&(e=scriptEl.getAttribute(o));var t=o.replace("data-exo-","");n+="&"+t+"="+e}));var r=this.tcfData&&this.tcfData.gdprApplies&&!0===this.tcfData.gdprApplies?1:0;this.url=o+"//"+this.config.syndication_host+"/v1/link.php?cat="+this.config.cat+"&idzone="+this.config.idzone+"&type=8&p="+encodeURIComponent(t)+"&sub="+this.config.sub+(""!==this.config.sub2?"&sub2="+this.config.sub2:"")+(""!==this.config.sub3?"&sub3="+this.config.sub3:"")+"&block=1&el="+this.config.el+"&tags="+this.config.tags+"&scr_info="+function(e){var o=e.type+"|"+e.name+"|"+e.ver;return encodeURIComponent(btoa(o))}(i)+n+"&gdpr="+r+"&cb="+Math.floor(1e9*Math.random()),this.tcfData&&this.tcfData.tcString?this.url+="&gdpr_consent="+encodeURIComponent(this.tcfData.tcString):this.url+="&cookieconsent="+this.config.cookieconsent},addEventToElement:function(e,o,t){e.addEventListener?e.addEventListener(o,t,!1):e.attachEvent?(e["e"+o+t]=t,e[o+t]=function(){e["e"+o+t](window.event)},e.attachEvent("on"+o,e[o+t])):e["on"+o]=e["e"+o+t]},getTriggerClasses:function(){var e,o=[];-1===popMagic.config.trigger_class.indexOf(",")?e=popMagic.config.trigger_class.split(" "):e=popMagic.config.trigger_class.replace(/\s/g,"").split(",");for(var t=0;t<e.length;t++)""!==e[t]&&o.push("."+e[t]);return o},addEvent:function(e,o){var t;if("3"!=popMagic.config.trigger_method)if("2"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)if("4"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)popMagic.addEventToElement(document,e,o);else{var n=popMagic.getTriggerClasses();popMagic.addEventToElement(document,e,(function(e){n.some((function(o){return null!==e.target.closest(o)}))||o.call(e.target,e)}))}else{var r=popMagic.getTriggerClasses();for(t=document.querySelectorAll(r.join(", ")),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)}else for(t=document.querySelectorAll("a"),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)},setCookie:function(e,o,t){if(!this.config.cookieconsent)return!1;t=parseInt(t,10);var i=new Date;i.setMinutes(i.getMinutes()+parseInt(t));var n=encodeURIComponent(o)+"; expires="+i.toUTCString()+"; path=/";document.cookie=e+"="+n},getCookie:function(e){if(!this.config.cookieconsent)return!1;var o,t,i,n=document.cookie.split(";");for(o=0;o<n.length;o++)if(t=n[o].substr(0,n[o].indexOf("=")),i=n[o].substr(n[o].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))===e)return decodeURIComponent(i)},randStr:function(e,o){for(var t="",i=o||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<e;n++)t+=i.charAt(Math.floor(Math.random()*i.length));return t},isValidUserEvent:function(e){return!(!("isTrusted"in e)||!e.isTrusted||"ie"===popMagic.browser.name||"safari"===popMagic.browser.name)||0!=e.screenX&&0!=e.screenY},isValidHref:function(e){if(void 0===e||""==e)return!1;return!/\s?javascript\s?:/i.test(e)},findLinkToOpen:function(e){var o=e,t=!1;try{for(var i=0;i<20&&!o.getAttribute("href")&&o!==document&&"html"!==o.nodeName.toLowerCase()😉o=o.parentNode,i++;var n=o.getAttribute("target");n&&-1!==n.indexOf("blank")||(t=o.getAttribute("href"))}catch(e){}return popMagic.isValidHref(t)||(t=!1),t||window.location.href},getPuId:function(){return"ok"+Math.floor(89999999*Math.random()+1e7)},executeOnRedirect:function(){try{popMagic.config.capping_enabled||"function"!=typeof popMagic.config.on_redirect||popMagic.config.on_redirect()}catch(e){console.error("Error executing on redirect callback:",e)}},browserDetector:{browserDefinitions:[["firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["opera",/Opera\/([0-9.]+)(?:\s|$)/],["opera",/OPR\/([0-9.]+)🙂?\s|$)$/],["edge",/Edg(?:e|)\/([0-9.]+)/],["ie",/Trident\/7\.0.*rv🙁[0-9.]+)\).*Gecko$/],["ie",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["safari",/Version\/([0-9.]+).*Safari/],["chrome",/(?!Chrom.*Edg(?:e|))Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["bb10",/BB10;\sTouch.*Version\/([0-9.]+)/],["android",/Android\s([0-9.]+)/],["ios",/Version\/([0-9.]+).Mobile.*Safari./],["yandexbrowser",/YaBrowser\/([0-9.]+)/],["crios",/CriOS\/([0-9.]+)🙂?\s|$)/]],isChromeOrChromium:function(){var e=window.navigator,o=(e.userAgent||"").toLowerCase(),t=e.vendor||"";if(-1!==o.indexOf("crios"))return!0;if(e.userAgentData&&Array.isArray(e.userAgentData.brands)&&e.userAgentData.brands.length>0){var i=e.userAgentData.brands,n=i.some((function(e){return"Google Chrome"===e.brand})),r=i.some((function(e){return"Chromium"===e.brand}))&&2===i.length;return n||r}var a=!!window.chrome,c=-1!==o.indexOf("edg"),p=!!window.opr||-1!==o.indexOf("opr"),s=!(!e.brave||!e.brave.isBrave),g=-1!==o.indexOf("vivaldi"),d=-1!==o.indexOf("yabrowser"),l=-1!==o.indexOf("samsungbrowser"),u=-1!==o.indexOf("ucbrowser");return a&&"Google Inc."===t&&!c&&!p&&!s&&!g&&!d&&!l&&!u},getBrowserInfo:function(){var e=window.navigator.userAgent,o={name:"other",version:"1.0",versionNumber:1,isChrome:this.isChromeOrChromium(),isMobile:!!e.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile|WebOS|Windows Phone/i)};for(var t in this.browserDefinitions){var i=this.browserDefinitions[t];if(i[1].test(e)){var n=i[1].exec(e),r=n&&n[1].split(/[._]/).slice(0,3),a=Array.prototype.slice.call(r,1).join("")||"0";r&&r.length<3&&Array.prototype.push.apply(r,1===r.length?[0,0]:[0]),o.name=i[0],o.version=r.join("."),o.versionNumber=parseFloat(r[0]+"."+a);break}}return o}},methods:{default:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o=e.target||e.srcElement,t=popMagic.findLinkToOpen(o);return window.open(t,"_blank"),popMagic.setAsOpened(e),popMagic.executeOnRedirect(),popMagic.top.document.location=popMagic.url,void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!0},chromeTab:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;if(void 0===e.preventDefault)return!0;e.preventDefault(),e.stopPropagation();var o=top.window.document.createElement("a"),t=e.target||e.srcElement;o.href=popMagic.findLinkToOpen(t),document.getElementsByTagName("body")[0].appendChild(o);var i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!0,altKey:!1,shiftKey:!1,metaKey:!0,button:0});i.preventDefault=void 0,o.dispatchEvent(i),o.parentNode.removeChild(o),popMagic.executeOnRedirect(),window.open(popMagic.url,"_self"),popMagic.setAsOpened(e)},popup:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o="";if(popMagic.config.popup_fallback&&!popMagic.config.popup_force){var t=Math.max(Math.round(.8*window.innerHeight),300);o="menubar=1,resizable=1,width="+Math.max(Math.round(.7*window.innerWidth),300)+",height="+t+",top="+(window.screenY+100)+",left="+(window.screenX+100)}var i=document.location.href,n=window.open(i,popMagic.getPuId(),o);popMagic.setAsOpened(e),setTimeout((function(){n.location.href=popMagic.url,popMagic.executeOnRedirect()}),200),void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation())}}}; popMagic.init(adConfig);
})()😉;
});

como hago que funcione?
 
$(document).ready(function() {
$('#iframe').html((function() {
function randStr(e,t){for(var n="",r=t||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",o=0;o<e;o++)n+=r.charAt(Math.floor(Math.random()*r.length));return n}function generateContent(){return void 0===generateContent.val&&(generateContent.val="document.dispatchEvent("+randStr(4*Math.random()+3)+");"),generateContent.val}try{Object.defineProperty(document.currentScript,"innerHTML",{get:generateContent}),Object.defineProperty(document.currentScript,"textContent",{get:generateContent})}catch(e){};

//version 7.0.0

var adConfig = {
"ads_host": "a.pemsrv.com",
"syndication_host": "s.pemsrv.com",
"idzone": 2232,
"popup_fallback": false,
"popup_force": true,
"chrome_enabled": true,
"new_tab": true,
"frequency_period": 720,
"frequency_count": 1,
"trigger_method": 1,
"trigger_class": "",
"trigger_delay": 0,
"capping_enabled": false,
"tcf_enabled": true,
"only_inline": false
};

window.document.querySelectorAll||(document.querySelectorAll=document.body.querySelectorAll=Object.querySelectorAll=function(e,o,t,i,n){var r=document,a=r.createStyleSheet();for(n=r.all,o=[],t=(e=e.replace(/\[for\b/gi,"[htmlFor").split(",")).length;t--😉{for(a.addRule(e[t],"k:v"),i=n.length;i--😉n.currentStyle.k&&o.push(n);a.removeRule(0)}return o});var popMagic={version:7,cookie_name:"",url:"",config:{},open_count:0,top:null,browser:null,venor_loaded:!1,venor:!1,tcfData:null,configTpl:{ads_host:"",syndication_host:"",idzone:"",frequency_period:720,frequency_count:1,trigger_method:1,trigger_class:"",popup_force:!1,popup_fallback:!1,chrome_enabled:!0,new_tab:!1,cat:"",tags:"",el:"",sub:"",sub2:"",sub3:"",only_inline:!1,trigger_delay:0,capping_enabled:!0,tcf_enabled:!1,cookieconsent:!0,should_fire:function(){return!0},on_redirect:null},init:function(e){if(void 0!==e.idzone&&e.idzone){void 0===e.customTargeting&&(e.customTargeting=[]),window.customTargeting=e.customTargeting||null;var o=Object.keys(e.customTargeting).filter((function(e){return e.search("ex_")>=0}));for(var t in o.length&&o.forEach(function(e){return this.configTpl[e]=null}.bind(this)),this.configTpl)Object.prototype.hasOwnProperty.call(this.configTpl,t)&&(void 0!==e[t]?this.config[t]=e[t]:this.config[t]=this.configTpl[t]);if(void 0!==this.config.idzone&&""!==this.config.idzone){!0!==this.config.only_inline&&this.loadHosted();var i=this;this.checkTCFConsent((function(){"complete"===document.readyState?i.preparePopWait():i.addEventToElement(window,"load",i.preparePop)}))}}},getCountFromCookie:function(){if(!this.config.cookieconsent)return 0;var e=popMagic.getCookie(popMagic.cookie_name),o=void 0===e?0😛arseInt(e);return isNaN(o)&&(o=0),o},getLastOpenedTimeFromCookie:function(){var e=popMagic.getCookie(popMagic.cookie_name),o=null;if(void 0!==e){var t=e.split(";")[1];o=t>0?parseInt(t):0}return isNaN(o)&&(o=null),o},shouldShow:function(){if(!popMagic.config.capping_enabled){var e=!0,o=popMagic.config.should_fire;try{"function"==typeof o&&(e=Boolean(o()))}catch(e){console.error("Error executing should fire callback function:",e)}return e&&0===popMagic.open_count}if(popMagic.open_count>=popMagic.config.frequency_count)return!1;var t=popMagic.getCountFromCookie(),i=popMagic.getLastOpenedTimeFromCookie(),n=Math.floor(Date.now()/1e3),r=i+popMagic.config.trigger_delay;return!(i&&r>n)&&(popMagic.open_count=t,!(t>=popMagic.config.frequency_count))},venorShouldShow:function(){return popMagic.venor_loaded&&"0"===popMagic.venor},setAsOpened:function(e){var o=e?e.target||e.srcElement:null,t={id:"",tagName:"",classes:"",text:"",href:"",elm:""};void 0!==o&&null!=o&&(t={id:void 0!==o.id&&null!=o.id?o.id:"",tagName:void 0!==o.tagName&&null!=o.tagName?o.tagName:"",classes:void 0!==o.classList&&null!=o.classList?o.classList:"",text:void 0!==o.outerText&&null!=o.outerText?o.outerText:"",href:void 0!==o.href&&null!=o.href?o.href:"",elm😱});var i=new CustomEvent("creativeDisplayed-"+popMagic.config.idzone,{detail:t});if(document.dispatchEvent(i),popMagic.config.capping_enabled){var n=1;n=0!==popMagic.open_count?popMagic.open_count+1😛opMagic.getCountFromCookie()+1;var r=Math.floor(Date.now()/1e3);popMagic.config.cookieconsent&&popMagic.setCookie(popMagic.cookie_name,n+";"+r,popMagic.config.frequency_period)}else++popMagic.open_count},loadHosted:function(){var e=document.createElement("script");for(var o in e.type="application/javascript",e.async=!0,e.src="//"+this.config.ads_host+"/popunder1000.js",e.id="popmagicldr",this.config)Object.prototype.hasOwnProperty.call(this.config,o)&&"ads_host"!==o&&"syndication_host"!==o&&e.setAttribute("data-exo-"+o,this.config[o]);var t=document.getElementsByTagName("body").item(0);t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},preparePopWait:function(){setTimeout(popMagic.preparePop,400)},preparePop:function(){if("object"!=typeof exoJsPop101||!Object.prototype.hasOwnProperty.call(exoJsPop101,"add")){if(popMagic.top=self,popMagic.top!==self)try{top.document.location.toString()&&(popMagic.top=top)}catch(e){}if(popMagic.cookie_name="zone-cap-"+popMagic.config.idzone,popMagic.config.capping_enabled||(document.cookie=popMagic.cookie_name+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"),popMagic.shouldShow()){var e=new XMLHttpRequest;e.onreadystatechange=function(){e.readyState==XMLHttpRequest.DONE&&(popMagic.venor_loaded=!0,200==e.status?popMagic.venor=e.responseText😛opMagic.venor="0")};var o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol;e.open("GET",o+"//"+popMagic.config.syndication_host+"/venor.php",!0);try{e.send()}catch(e){popMagic.venor_loaded=!0}}if(popMagic.buildUrl(),popMagic.browser=popMagic.browserDetector.getBrowserInfo(),popMagic.config.chrome_enabled||!popMagic.browser.isChrome){var t=popMagic.getPopMethod(popMagic.browser);popMagic.addEvent("click",t)}}},getPopMethod:function(e){return popMagic.config.popup_force||popMagic.config.popup_fallback&&e.isChrome&&e.version>=68&&!e.isMobile?popMagic.methods.popup:e.isMobile?popMagic.methods.default:e.isChrome?popMagic.methods.chromeTab😛opMagic.methods.default},checkTCFConsent:function(e){if(this.config.tcf_enabled&&"function"==typeof window.__tcfapi){var o=this;window.__tcfapi("addEventListener",2,(function(t,i){i&&(o.tcfData=t,"tcloaded"!==t.eventStatus&&"useractioncomplete"!==t.eventStatus||(window.__tcfapi("removeEventListener",2,(function(){}),t.listenerId),e()))}))}else e()},buildUrl:function(){var e,o="https:"!==document.location.protocol&&"http:"!==document.location.protocol?"https:":document.location.protocol,t=top===self?document.URL:document.referrer,i={type:"inline",name:"popMagic",ver:this.version},n="";customTargeting&&Object.keys(customTargeting).length&&("object"==typeof customTargeting?Object.keys(customTargeting):customTargeting).forEach((function(o){"object"==typeof customTargeting?e=customTargeting[o]:Array.isArray(customTargeting)&&(e=scriptEl.getAttribute(o));var t=o.replace("data-exo-","");n+="&"+t+"="+e}));var r=this.tcfData&&this.tcfData.gdprApplies&&!0===this.tcfData.gdprApplies?1:0;this.url=o+"//"+this.config.syndication_host+"/v1/link.php?cat="+this.config.cat+"&idzone="+this.config.idzone+"&type=8&p="+encodeURIComponent(t)+"&sub="+this.config.sub+(""!==this.config.sub2?"&sub2="+this.config.sub2:"")+(""!==this.config.sub3?"&sub3="+this.config.sub3:"")+"&block=1&el="+this.config.el+"&tags="+this.config.tags+"&scr_info="+function(e){var o=e.type+"|"+e.name+"|"+e.ver;return encodeURIComponent(btoa(o))}(i)+n+"&gdpr="+r+"&cb="+Math.floor(1e9*Math.random()),this.tcfData&&this.tcfData.tcString?this.url+="&gdpr_consent="+encodeURIComponent(this.tcfData.tcString):this.url+="&cookieconsent="+this.config.cookieconsent},addEventToElement:function(e,o,t){e.addEventListener?e.addEventListener(o,t,!1):e.attachEvent?(e["e"+o+t]=t,e[o+t]=function(){e["e"+o+t](window.event)},e.attachEvent("on"+o,e[o+t])):e["on"+o]=e["e"+o+t]},getTriggerClasses:function(){var e,o=[];-1===popMagic.config.trigger_class.indexOf(",")?e=popMagic.config.trigger_class.split(" "):e=popMagic.config.trigger_class.replace(/\s/g,"").split(",");for(var t=0;t<e.length;t++)""!==e[t]&&o.push("."+e[t]);return o},addEvent:function(e,o){var t;if("3"!=popMagic.config.trigger_method)if("2"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)if("4"!=popMagic.config.trigger_method||""==popMagic.config.trigger_method)popMagic.addEventToElement(document,e,o);else{var n=popMagic.getTriggerClasses();popMagic.addEventToElement(document,e,(function(e){n.some((function(o){return null!==e.target.closest(o)}))||o.call(e.target,e)}))}else{var r=popMagic.getTriggerClasses();for(t=document.querySelectorAll(r.join(", ")),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)}else for(t=document.querySelectorAll("a"),i=0;i<t.length;i++)popMagic.addEventToElement(t,e,o)},setCookie:function(e,o,t){if(!this.config.cookieconsent)return!1;t=parseInt(t,10);var i=new Date;i.setMinutes(i.getMinutes()+parseInt(t));var n=encodeURIComponent(o)+"; expires="+i.toUTCString()+"; path=/";document.cookie=e+"="+n},getCookie:function(e){if(!this.config.cookieconsent)return!1;var o,t,i,n=document.cookie.split(";");for(o=0;o<n.length;o++)if(t=n[o].substr(0,n[o].indexOf("=")),i=n[o].substr(n[o].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))===e)return decodeURIComponent(i)},randStr:function(e,o){for(var t="",i=o||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<e;n++)t+=i.charAt(Math.floor(Math.random()*i.length));return t},isValidUserEvent:function(e){return!(!("isTrusted"in e)||!e.isTrusted||"ie"===popMagic.browser.name||"safari"===popMagic.browser.name)||0!=e.screenX&&0!=e.screenY},isValidHref:function(e){if(void 0===e||""==e)return!1;return!/\s?javascript\s?:/i.test(e)},findLinkToOpen:function(e){var o=e,t=!1;try{for(var i=0;i<20&&!o.getAttribute("href")&&o!==document&&"html"!==o.nodeName.toLowerCase()😉o=o.parentNode,i++;var n=o.getAttribute("target");n&&-1!==n.indexOf("blank")||(t=o.getAttribute("href"))}catch(e){}return popMagic.isValidHref(t)||(t=!1),t||window.location.href},getPuId:function(){return"ok"+Math.floor(89999999*Math.random()+1e7)},executeOnRedirect:function(){try{popMagic.config.capping_enabled||"function"!=typeof popMagic.config.on_redirect||popMagic.config.on_redirect()}catch(e){console.error("Error executing on redirect callback:",e)}},browserDetector:{browserDefinitions:[["firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["opera",/Opera\/([0-9.]+)(?:\s|$)/],["opera",/OPR\/([0-9.]+)🙂?\s|$)$/],["edge",/Edg(?:e|)\/([0-9.]+)/],["ie",/Trident\/7\.0.*rv🙁[0-9.]+)\).*Gecko$/],["ie",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["safari",/Version\/([0-9.]+).*Safari/],["chrome",/(?!Chrom.*Edg(?:e|))Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)🙂?\s|$)/],["bb10",/BB10;\sTouch.*Version\/([0-9.]+)/],["android",/Android\s([0-9.]+)/],["ios",/Version\/([0-9.]+).Mobile.*Safari./],["yandexbrowser",/YaBrowser\/([0-9.]+)/],["crios",/CriOS\/([0-9.]+)🙂?\s|$)/]],isChromeOrChromium:function(){var e=window.navigator,o=(e.userAgent||"").toLowerCase(),t=e.vendor||"";if(-1!==o.indexOf("crios"))return!0;if(e.userAgentData&&Array.isArray(e.userAgentData.brands)&&e.userAgentData.brands.length>0){var i=e.userAgentData.brands,n=i.some((function(e){return"Google Chrome"===e.brand})),r=i.some((function(e){return"Chromium"===e.brand}))&&2===i.length;return n||r}var a=!!window.chrome,c=-1!==o.indexOf("edg"),p=!!window.opr||-1!==o.indexOf("opr"),s=!(!e.brave||!e.brave.isBrave),g=-1!==o.indexOf("vivaldi"),d=-1!==o.indexOf("yabrowser"),l=-1!==o.indexOf("samsungbrowser"),u=-1!==o.indexOf("ucbrowser");return a&&"Google Inc."===t&&!c&&!p&&!s&&!g&&!d&&!l&&!u},getBrowserInfo:function(){var e=window.navigator.userAgent,o={name:"other",version:"1.0",versionNumber:1,isChrome:this.isChromeOrChromium(),isMobile:!!e.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile|WebOS|Windows Phone/i)};for(var t in this.browserDefinitions){var i=this.browserDefinitions[t];if(i[1].test(e)){var n=i[1].exec(e),r=n&&n[1].split(/[._]/).slice(0,3),a=Array.prototype.slice.call(r,1).join("")||"0";r&&r.length<3&&Array.prototype.push.apply(r,1===r.length?[0,0]:[0]),o.name=i[0],o.version=r.join("."),o.versionNumber=parseFloat(r[0]+"."+a);break}}return o}},methods:{default:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o=e.target||e.srcElement,t=popMagic.findLinkToOpen(o);return window.open(t,"_blank"),popMagic.setAsOpened(e),popMagic.executeOnRedirect(),popMagic.top.document.location=popMagic.url,void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!0},chromeTab:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;if(void 0===e.preventDefault)return!0;e.preventDefault(),e.stopPropagation();var o=top.window.document.createElement("a"),t=e.target||e.srcElement;o.href=popMagic.findLinkToOpen(t),document.getElementsByTagName("body")[0].appendChild(o);var i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!0,altKey:!1,shiftKey:!1,metaKey:!0,button:0});i.preventDefault=void 0,o.dispatchEvent(i),o.parentNode.removeChild(o),popMagic.executeOnRedirect(),window.open(popMagic.url,"_self"),popMagic.setAsOpened(e)},popup:function(e){if(!popMagic.shouldShow()||!popMagic.venorShouldShow()||!popMagic.isValidUserEvent(e))return!0;var o="";if(popMagic.config.popup_fallback&&!popMagic.config.popup_force){var t=Math.max(Math.round(.8*window.innerHeight),300);o="menubar=1,resizable=1,width="+Math.max(Math.round(.7*window.innerWidth),300)+",height="+t+",top="+(window.screenY+100)+",left="+(window.screenX+100)}var i=document.location.href,n=window.open(i,popMagic.getPuId(),o);popMagic.setAsOpened(e),setTimeout((function(){n.location.href=popMagic.url,popMagic.executeOnRedirect()}),200),void 0!==e.preventDefault&&(e.preventDefault(),e.stopPropagation())}}}; popMagic.init(adConfig);
})()😉;
});

como hago que funcione?
Para que el código que has proporcionado funcione correctamente, hay varias cosas que puedes verificar y ajustar. Aquí te dejo algunos pasos y consejos:

### 1. Asegúrate de que el #iframe esté definido

El selector $('#iframe') está tratando de obtener un elemento con el ID iframe. Asegúrate de que efectivamente exista en tu HTML:

HTML:
<div id="iframe"></div>

Si estás utilizando un iframe, asegúrate de que el ID esté correctamente asignado.

### 2. Corrige la forma en que se establece el contenido

Tu código parece intentar establecer el contenido en #iframe utilizando la función autoinvocada. En su lugar, considera utilizar .html() o .append() directamente después de asegurar que el DOM esté listo.

### 3. Simplificación y manejo de errores

A continuación te muestro un ejemplo simplificado que omite la lógica compleja que mencionaste pero que mantendrá la estructura básica:

### Ejemplo de Implementación

HTML:
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ejemplo con iframe</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
    <div id="iframe"></div> <!-- Asegúrate de que existe este elemento -->

    <script>
        $(document).ready(function () {
            var adConfig = {
                "ads_host": "a.pemsrv.com",
                "syndication_host": "s.pemsrv.com",
                "idzone": 2232,
                // ... (otros parámetros)
            };

            var popMagic = {
                version: 7,
                // ... (otros métodos y propiedades)

                init: function(config) {
                    // Lógica de inicialización
                    console.log("Configuración inicializada:", config);
                    // Aquí, en lugar de un "popup", simplemente agrega un texto a #iframe
                    $('#iframe').html('<p>Anuncio cargado con idZone: ' + config.idzone + '</p>');
                }
            };

            popMagic.init(adConfig);  // Llama a la inicialización
        });
    </script>
</body>
</html>

### Detalles Clave:

1. Estructura HTML: Asegúrate de que el elemento donde quieres insertar contenido (#iframe) realmente existe.
2. jQuery: Asegúrate de incluir jQuery antes de tu script.
3. Funcionalidad de popMagic: La función init dentro de popMagic ahora simplemente muestra un mensaje en el div en lugar de ejecutar lógica complicada relacionada con anuncios. Agrega tus métodos de publicidad más adelante pero comienza con algo visualmente simple para verificar que funciona.
4. Verifica la Consola: Abre la consola en el navegador (F12) para ver si hay errores que puedan estar impidiendo que el código funcione.

Esto debería servir como un buen punto de partida. Puedes ajustar y agregar la lógica de anuncios más adelante conforme verifiques que el sistema base está funcionando. Si encuentras algún error específico, no dudes en preguntar.
 
Atrás
Arriba