var ismobile,mensaje_confirmacion_suscripcion_gdpr,googletag_existe,opciones_ads_gdpr,dominio_qn,expira_cookie; document.addEventListener("DOMContentLoaded", function () { ismobile = QN_mobile_device; googletag_existe = (typeof googletag != "undefined") ? true : false; opciones_ads_gdpr = ['personalizedAds', 'unpersonalizedAds', 'payForContent', 'noAds']; dominio_qn = window.location.hostname.replace(/[a-z0-9_\-]+/,''); expira_cookie = 20*365; //20 años //Obtenemos las cookies que necesitamos var consentimiento = Cookies.get("cookie_consentimiento", {domain: dominio_qn }); var google_ad = Cookies.get("pubads", { domain: dominio_qn }); var link_qn_gdpr = window.location.protocol+"//"+window.location.hostname; //Si nos faltan alguna de estas dos cookies, procedemos if ( typeof consentimiento == "undefined" || (typeof google_ad == "undefined" && googletag_existe==true ) ) { carga_js('/my/tema_1874/pluginsmy/modalmy/modalQN.js', function () { carga_css('/my/tema_1874/pluginsmy/modalmy/modalQN.css'); mensaje_confirmacion_suscripcion_gdpr = $('
').modalQN({ contenido: '
'+ '
'+ '
'+ '
'+ '

Valoramos tu privacidad

'+ '
'+ ''+ '
' + '

'+((googletag_existe)?'ACEPTO VER ANUNCIOS PERSONALIZADOS':'ACEPTO')+'

' + '
' + ((googletag_existe) ? '
'+ '
' + ' Ver otras opciones '+ '
'+ '
'+ '

' + '

' + '

Guardar

'+ '
'+ '
':'')+ '
Revisar las tecnologías que se utilizan en el servicio
'+ '
', altura: 500, ancho: 700, cerrar:false, tituloDOM : "", modalDOM: jQuery('
', { id: "modalQn", class: "contenedorModal modal_gdpr" }), }); var div_logo_gdpr = document.getElementsByClassName("QN_logo_gdpr")[0]; var logos_principales = document.querySelectorAll(".logo-principal"+((typeof QN_interfaz_gdpr == "undefined ")?((ismobile)? ".visible-xs" : ".hidden-xs"):""))[0].cloneNode(); logos_principales.className = ''; div_logo_gdpr.appendChild(logos_principales); }); } else { //Tengo las cookies necesarias, gestiono los anuncios var indice_valor_gdpr; var google_ad_index = opciones_ads_gdpr.find(function(value, index) { if( value == google_ad ) { indice_valor_gdpr = index; return true; } return false; }); googleAds(indice_valor_gdpr); } }); // Funciones Locales function opciones_gdpr_extras (boton) { if(boton != "undefined") { $(boton).hide(); } $(".opciones_gdpr_adicionales").show(); } function gestionar_respuesta_gdpr_ue (opcion) { var opcion_gdpr = (typeof opcion != "undefined" && parseInt(opcion,10)==0)?0:$("input[name='opcion_gdpr']:checked").val(); escribir_cookies_gdpr(opcion_gdpr); googleAds(opcion_gdpr); if(typeof mensaje_confirmacion_suscripcion_gdpr != "undefined") { mensaje_confirmacion_suscripcion_gdpr.cerrar(); } } // Funciones generales function escribir_cookies_gdpr (opcion_gdpr) { //Si el cookie de consentimiento no existe, lo escribimos if( typeof consentimiento == "undefined" ) { var hoy = new Date(); Cookies.set('cookie_consentimiento', hoy.toISOString(), { expires: expira_cookie, domain: dominio_qn }); } //Si existe el objeto de google, escribimos la cookie de google if(typeof opcion_gdpr != "undefined") { if (googletag_existe) { //Si no quiere ver anuncios, la cookie solo durará la sesión activa, de lo contrario lo dejamos por mucho tiempo Cookies.set('pubads', opciones_ads_gdpr[opcion_gdpr], (parseInt(opcion_gdpr,10)==2)? {domain: dominio_qn} : { expires: expira_cookie, domain: dominio_qn }); } } } // Función para gestionar los anuncios function googleAds(opcion) { contador = 0; opcion = parseInt(opcion,10); //Si fue alguna de las primeras dos opciones, podemos mostrar if(opcion == 1 || opcion ==0) { var intervalo_gdpr = setInterval(function(){ if(contador>4) { clearInterval(intervalo_gdpr); } if(googletag_existe && googletag.pubadsReady) { try{ googletag.pubads().setRequestNonPersonalizedAds(opcion); googletag.pubads().refresh(); clearInterval(intervalo_gdpr); } catch(e){} } contador ++; }, 500); } }