1 2// Resolve the configured GA property id from the script tag attribute. 3var stayCreativeScript = document.currentScript; 4if (!stayCreativeScript) { 5 var scripts = document.getElementsByTagName('script'); 6 for (var i = 0; i < scripts.length; i++) { 7 if (scripts[i].src && scripts[i].src.indexOf('stay-creative.js') !== -1) { 8 stayCreativeScript = scripts[i]; 9 break; 10 } 11 } 12} 13 14var googleAnalyticsId = null; 15if (stayCreativeScript) { 16 var googleAnalyticsIdAttr = stayCreativeScript.getAttribute('data-google-analytics-id'); 17 if (googleAnalyticsIdAttr && googleAnalyticsIdAttr.trim().length > 0) { 18 googleAnalyticsId = googleAnalyticsIdAttr.trim(); 19 } 20} 21 22var gaDisableKey = googleAnalyticsId ? 'ga-disable-' + googleAnalyticsId : null; 23 24 25$(window).on('load', function () { 26 $('.preloader').slideUp(); 27}); 28// detect IE 29var IEversion = detectIE(); 30 31if (IEversion !== false) { 32 $(window).on('load', function() { 33 $(".overlayed").append("<div class='overlay'></div>"); 34 }); 35} 36 37function detectIE() { 38 var ua = window.navigator.userAgent; 39 40 var msie = ua.indexOf('MSIE '); 41 if (msie > 0) { 42 // IE 10 or older => return version number 43 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 44 } 45 46 var trident = ua.indexOf('Trident/'); 47 if (trident > 0) { 48 // IE 11 => return version number 49 var rv = ua.indexOf('rv:'); 50 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 51 } 52 53 var edge = ua.indexOf('Edge/'); 54 if (edge > 0) { 55 // Edge (IE 12+) => return version number 56 return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 57 } 58 59 // other browser 60 return false; 61} 62 63/* Cookies */ 64 65$(document).ready(function() { 66 67 var strCookieName = "cookie-compliance"; 68 var strApprovedVal = "enabled"; 69 var strDisabledVal = "disabled"; 70 71 var cookieVal = readCookie(strCookieName); 72 var displayMsg = $('#cookieMessageWrapper'); 73 74 checkIfCookiesEnabled(cookieVal); 75 76 if (cookieVal == strApprovedVal || cookieVal == strDisabledVal) { 77 displayMsg.hide(200); 78 } 79 80 $('#btn-accept-all').on('click', function() { 81 displayMsg.slideUp(); 82 createCookie(strCookieName, strApprovedVal, 30); // dias que dura la cookie 83 }); 84 $('#btn-accept-some').on('click', function() { 85 displayMsg.slideUp(); 86 createCookie(strCookieName, strApprovedVal, 30); // dias que dura la cookie 87 }); 88 $('#btn-reject-all').on('click', function() { 89 displayMsg.slideUp(); 90 createCookie(strCookieName, strDisabledVal, 30); // dias que dura la cookie 91 }); 92}); 93 94//Cookie functions 95function createCookie(name, value, days) { 96 if (days) { 97 var date = new Date(); 98 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 99 var expires = "; expires=" + date.toGMTString(); 100 } 101 else var expires = ""; 102 document.cookie = name + "=" + value + expires + "; path=/"; 103} 104 105function readCookie(name) { 106 var nameEQ = name + "="; 107 var ca = document.cookie.split(';'); 108 for (var i = 0; i < ca.length; i++) { 109 var c = ca[i]; 110 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 111 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 112 } 113 return null; 114} 115 116function eraseCookie(name) { 117 createCookie(name, "", -1); 118} 119 120function checkIfCookiesEnabled(cookieVal){ 121 if(!gaDisableKey){ 122 return; 123 } 124 125 if(cookieVal == null || cookieVal == "disabled"){ 126 window[gaDisableKey] = true; //inhabilitar cookies analytics 127 } else { 128 window[gaDisableKey] = false; //habilitar cookies analytics 129 } 130} 131 132function saveCookieDisabled(){ 133 var disable = $(document).find('#disable-cookies:checked').length > 0; 134 if(disable == true){ 135 createCookie('cookie-compliance', 'enabled', 365); 136 } else { 137 createCookie('cookie-compliance', 'disabled', 365); 138 } 139 $('#cookieMessageWrapper').hide(); 140} 141 142// end cookies 143 144/* NEW BANNER COOKIES */ 145document.addEventListener('DOMContentLoaded', function() { 146 function hideBanner() { 147 var el = document.getElementById('cookieMessageWrapper'); 148 if (el) el.style.display = 'none'; 149 } 150 151 152 if(localStorage.getItem('consentMode') === null) { 153 var btnAcceptAll = document.getElementById('btn-accept-all'); 154 var btnAcceptSome = document.getElementById('btn-accept-some'); 155 if (btnAcceptAll) { 156 btnAcceptAll.addEventListener('click', function() { 157 setConsent({ 158 necessary: true, 159 analytics: true, 160 preferences: true, 161 marketing: true 162 }); 163 hideBanner(); 164 }); 165 } 166 if (btnAcceptSome) { 167 btnAcceptSome.addEventListener('click', function() { 168 setConsent({ 169 necessary: true, 170 analytics: document.getElementById('consent-analytics').checked, 171 preferences: document.getElementById('consent-preferences').checked, 172 marketing: document.getElementById('consent-marketing').checked 173 }); 174 hideBanner(); 175 }); 176 } 177 var btnRejectAll = document.getElementById('btn-reject-all'); 178 if (btnRejectAll) { 179 btnRejectAll.addEventListener('click', function() { 180 setConsent({ 181 necessary: false,
182 analytics: false, 183 preferences: false, 184 marketing: false 185 }); 186 hideBanner(); 187 }); 188 } 189 var cookieWrapper = document.getElementById('cookieMessageWrapper'); 190 if (cookieWrapper) { 191 cookieWrapper.style.display = 'block'; 192 } 193 } 194}); 195 196function setConsent(consent) { 197 198 var consentMode = { 199 'functionality_storage': consent.necessary ? 'granted' : 'denied', 200 'security_storage': consent.necessary ? 'granted' : 'denied', 201 'ad_storage': consent.marketing ? 'granted' : 'denied', 202 'analytics_storage': consent.analytics ? 'granted' : 'denied', 203 'ad_user_data': consent.analytics ? 'granted' : 'denied', 204 'ad_personalization': consent.preferences ? 'granted' : 'denied', 205 206 }; 207 208 gtag('consent', 'update', consentMode); 209 localStorage.setItem('consentMode', JSON.stringify(consentMode)); 210 211 if (googleAnalyticsId && typeof gtag === 'function') { 212 gtag('config', googleAnalyticsId, { 213 'anonymize_ip': true, //anonimizar ips 214 'allow_google_signals': false, // Desactiva Google Signals. 215 'allow_ad_personalization_signals': false // Desactiva personalizacion. 216 }); 217 } 218 219} 220 221/* END NEW BANNER COOKIES */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.