PageSourceSearch

https://www.diarioestrategia.cl/style/js/cookies.js

js diarioestrategia.cl collected 2026-09-26 01:42:44 UTC 14,320 bytes, 289 lines download raw bytes

1if (!window['_avisoPC']) {
2    (function () {
3        var _urlMasInformacion = '/estatica/cookies/';
4        var _idUrlMasInformacion = 'id_enlace_politica_privacidad_cookies';
5        var _delayMostradoAviso = 1 * 1000;
6        var _nombreCookie = 'avisopc';
7        var _hostPeticion = window.location.hostname;
8        var _idDivAviso = 'capaAvisoPoliticaCookies_superior_mensajes';
9        var _idBotonCerrarAviso = 'id_boton_cerrar_aviso_pc';
10        var _idObjetosNoCookie = Array(
11            _idUrlMasInformacion
12        );
13        var _idObjetosPubli = Array(
14            'elpais_gpt',
15            'gtp_diarioas',
16            'cds_gpt',
17            'mainAdContent',
18            _idDivAviso
19        );
20        var _availableY = 0;
21        var _altoDivAviso = 0;
22        var _esVersionMovil = false;
23        var _hayInter = false;
24        var _cssStyleComun = '';
25        var _cssStyleNormal = '';
26        var _cssStyleMovil = '';
27        _cssStyleNormal += '.capaAvisoPoliticaCookies_superior_mensajes { padding-top: 6px; background-color: #CCCCCC; width: 100%; z-index: 2147483647; bottom: 0px; position: fixed; }\n';
28        _cssStyleNormal += '.capaAvisoPoliticaCookies_superior_mensajes .inner { background-color: #f8f8f8; border-top: 1px solid #fff; padding: 10px 0; }\n';
29        _cssStyleMovil += '.capaAvisoPoliticaCookies_superior_mensajes { padding-bottom: 6px; background-color: #CCCCCC; width: 100%; z-index: 2147483647; }\n';
30        _cssStyleMovil += '.capaAvisoPoliticaCookies_superior_mensajes .inner { background-color: #f8f8f8; border-bottom: 1px solid #fff; padding: 10px 0; }\n';
31        _cssStyleComun += '.capaAvisoPoliticaCookies_superior_mensajes .contenidoAvisoPoliticaCookies { max-width: 930px; margin: 0 auto; padding: 7px 37px 7px 17px; vertical-align: middle; background-color: #f1f1f1; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, 0.2); box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, 0.2); border: 1px solid #ddd; outline: 1px solid #fff; position: relative; }\n';
32        _cssStyleComun += '.capaAvisoPoliticaCookies_superior_mensajes .contenidoAvisoPoliticaCookies p { font: normal 11px/16px Tahoma, Arial, Helvetica, Garuda, sans-serif; color: #333; text-shadow: 0 1px 0 #fff; margin: 0;}\n';
33        _cssStyleComun += '.capaAvisoPoliticaCookies_superior_mensajes .contenidoAvisoPoliticaCookies p strong { background:url(/style/images/cookies/aviso.png) 0 3px no-repeat; display:block; padding-left:19px; margin-bottom:3px; line-height:19px; font-weight:bold;}\n';
34        _cssStyleComun += '.capaAvisoPoliticaCookies_superior_mensajes .contenidoAvisoPoliticaCookies p a { border-bottom:1px solid #0097C7; font-weight:bold; color:#0097c8; }\n';
35        _cssStyleComun += '.capaAvisoPoliticaCookies_superior_mensajes .contenidoAvisoPoliticaCookies p a:hover { border-bottom-style:dotted; border-bottom-color:#333; }\n'
36        _cssStyleComun += '.capaAvisoPoliticaCookies_superior_mensajes .contenidoAvisoPoliticaCookies a.cerrarAvisoPoliticaCookies { display: block; width: 16px; height: 16px; background: transparent url(/style/images/cookies/cerrar.png) no-repeat 0 0; text-indent: 100%; white-space: nowrap; overflow: hidden; position: absolute; right: 8px; top: 12px; }\n';
37        var _htmlDivAviso = '';
38        _htmlDivAviso += '<div class="inner">\n';
39        _htmlDivAviso += '<div class="contenidoAvisoPoliticaCookies">\n';
40        _htmlDivAviso += '<p><strong>Uso de cookies</strong></p>\n';
41        _htmlDivAviso += '<p>Utilizamos cookies propias y de terceros para mejorar la experiencia de navegación, y ofrecer contenidos y publicidad de interés. Al continuar con la navegación entendemos que se acepta nuestra <a target="_blank" id="' + _idUrlMasInformacion + '" href="' + _urlMasInformacion + '">política de cookies</a>.</p>\n';
42        _htmlDivAviso += '<a id="' + _idBotonCerrarAviso + '" title="Cerrar" class="cerrarAvisoPoliticaCookies" href="javascript:void(0);"></a></div>\n';
43        _htmlDivAviso += '</div>';
44        window['_avisoPC'] = __gestionarEventoAvisoPC;
45        domready(function () {
46            setTimeout(__init, _delayMostradoAviso);
47        });
48        function __init() {
49            try {
50                if (typeof top.location.href == 'undefined' || top.location.href != location.href) {
51                    return false;
52                }
53            } catch (e) {
54                return false;
55            }
56            var _hayCookie = getcookie(_nombreCookie);
57            if (_hayCookie) {
58                return false;
59            }
60            if (document.getElementById('mainAdContent')) {
61                _hayInter = true;
62            }
63            if (document.getElementById("taptap_superior")) {
64                _esVersionMovil = true;
65            }
66            var _head = document.head || document.getElementsByTagName('head')[0];
67            var _style = document.createElement('style');
68            var _cssStyle = _cssStyleComun;
69            if (_esVersionMovil) {
70                _cssStyle = _cssStyleMovil + _cssStyle;
71            } else {
72                _cssStyle = _cssStyleNormal + _cssStyle;
73            }
74            _style.type = 'text/css';
75            if (_style.styleSheet) {
76                _style.styleSheet.cssText = _cssStyle;
77            } else {
78                _style.appendChild(document.createTextNode(_cssStyle));
79            }
80            _head.appendChild(_style);
81            var _divAviso = document.createElement('div');
82            _divAviso.id = _idDivAviso;
83            _divAviso.className = 'capaAvisoPoliticaCookies_superior_mensajes';
84            _divAviso.innerHTML = _htmlDivAviso;
85            if (_hayInter) {
86                var _objInter = document.getElementById('mainAdContent');
87                if (typeof _objInter.style.zIndex != 'undefined' && _objInter.style.zIndex) {
88                    _divAviso.style.zIndex = parseInt(_objInter.style.zIndex) - 1;
89                }
90            }
91            if (!_esVersionMovil) {
92                document.body.appendChild(_divAviso);
93            } else {
94                document.body.insertBefore(_divAviso, document.body.childNodes[0]);
95            }
96            if (document.documentElement.clientHeight >= 0) {
97                _availableY = document.documentElement.clientHeight;
98            } else if (document.body && document.body.clientHeight >= 0) {
99                _availableY = document.body.clientHeight;
100            } else if (window.innerHeight >= 0) {
101                _availableY = window.innerHeight;
102            }
103            _altoDivAviso = document.getElementById(_idDivAviso).offsetHeight;
104
105            addEvent(document, 'mousedown', window['_avisoPC']);
106            addEvent(document, 'click', window['_avisoPC']);
107            addEvent(window, 'scroll', window['_avisoPC']);
108            addEvent(document, 'touchstart', window['_avisoPC']);
109        }
110
111        function __gestionarEventoAvisoPC(e) {
112            if (!e) e = window.event;
113            var objEvento;
114            if (e.srcElement) {
115                objEvento = e.srcElement;
116            } else {
117                objEvento = e.target;
118            }
119            if (e.type == 'mousedown' || e.type == 'click' || e.type == 'touchstart') {
120                if (objEvento.id && objEvento.id == _idBotonCerrarAviso) {
121                    document.getElementById(_idDivAviso).style.display = 'none';
122                    if (document.getElementById("mainAdContent")) {
123                        document.getElementById("mainAdContent").style.top = "0px";
124                    }
125                }
126                for (var i = 0; i != _idObjetosNoCookie.length; i++) {
127                    if (objEvento.id && objEvento.id == _idObjetosNoCookie[
127i]) {
128                        return true;
129                    }
130                }
131                if (objEvento.id != _idBotonCerrarAviso) {
132                    for (var i = 0; i != _idObjetosPubli.length; i++) {
133                        var _objTmp = objEvento;
134                        while (_objTmp.parentNode) {
135                            if (_objTmp.id && typeof _objTmp.id.indexOf == 'function' && _objTmp.id.indexOf(_idObjetosPubli[i]) != -1) {
136                                return true;
137                            }
138                            _objTmp = _objTmp.parentNode;
139                        }
140                    }
141                }
142            }
143            if (e.type == 'scroll') {
144                var newAvailableY = 0;
145                if (document.documentElement.clientHeight >= 0) {
146                    newAvailableY = document.documentElement.clientHeight;
147                } else if (document.body && document.body.clientHeight >= 0) {
148                    newAvailableY = document.body.clientHeight;
149                } else if (window.innerHeight >= 0) {
150                    newAvailableY = window.innerHeight;
151                }
152                if (_availableY != newAvailableY) {
153                    _availableY = newAvailableY;
154                    return true;
155                }
156            }
157            var _partesHost = _hostPeticion.split('.');
158            if (_partesHost.length < 2) {
159                return true;
160            }
161            var _dominioCookie = '.' +
162                _partesHost[_partesHost.length - 2] + '.' +
163                _partesHost[_partesHost.length - 1];
164            if (_partesHost.length > 3) {
165                _dominioCookie = '.' + _partesHost[_partesHost.length - 3] + _dominioCookie;
166            }
167            setcookie(_nombreCookie, '1', _dominioCookie, 365 * 2);
168            removeEvent(document, 'mousedown', window['_avisoPC']);
169            removeEvent(document, 'click', window['_avisoPC']);
170            removeEvent(document, 'touchstart', window['_avisoPC']);
171            consentGrantedAdStorage();
172            setTimeout(function () {
173                var _intervalAnima;
174                var _objDivAviso = document.getElementById(_idDivAviso);
175                var _altoFin = 0;
176                _objDivAviso.style.overflow = 'hidden';
177                if (_intervalAnima) clearInterval(_intervalAnima);
178                _intervalAnima = setInterval(
179                    function () {
180                        var alto = ((_objDivAviso.offsetHeight > _objDivAviso.style.height) ?
181                            _objDivAviso.offsetHeight : parseInt(_objDivAviso.style.height));
182                        var incremento = ( _altoFin - alto ) / 2;
183                        if ((incremento > 0) && (incremento < 1)) incremento = 1;
184                        if ((incremento < 0) && (incremento > -1)) incremento = -1;
185                        if (_altoFin >= alto) {
186                            removeEvent(window, 'scroll', window['_avisoPC']);
187                            clearInterval(_intervalAnima);
188                            _objDivAviso.style.display = 'none';
189                        }
190                        alto += incremento;
191                        _objDivAviso.style.height = alto + "px";
192                    },
193                    100);
194            }, 1 * 1000);
195        }
196
197
198        function consentGrantedAdStorage() {
199            window.dataLayer = window.dataLayer || [];
200            function gtag(){dataLayer.push(arguments);}
201            gtag('consent', 'update', {
202                'security_storage': 'granted',
203                'functionality_storage': 'granted',
204                'personalization_storage': 'granted',
205                'analytics_storage': 'granted',
206                'ad_storage': 'granted',
207                'ad_user_data': 'granted',
208                'ad_personalization': 'granted',
209            });
210        }
211
212        function addEvent(el, type, fn) {
213            if (el.attachEvent) {
214                el.attachEvent && el.attachEvent('on' + type, fn);
215            } else {
216                el.addEventListener(type, fn, false);
217            }
218        }
219
220        function removeEvent(el, type, fn) {
221            if (el.detachEvent) {
222                el.detachEvent && el.detachEvent('on' + type, fn);
223            } else {
224                el.removeEventListener(type, fn, false);
225            }
226        }
227
228        function domready(callback) {
229            var
230                done = false,
231                top = true;
232
233            function init(e) {
234                if (e.type === 'readystatechange' && document.readyState !== 'complete') return;
235                removeEvent((e.type === 'load' ? window : document), e.type, init);
236                if (!done) {
237                    done = true;
238                    callback();
239                }
240            }
241
242            function poll() {
243                try {
244                    document.documentElement.doScroll('left');
245                }
246                catch (e) {
247                    setTimeout(poll, 50);
248                    return;
249                }
250                init('poll');
251            }
252
253            if (document.readyState === 'complete') callback();
254            else {
255                if (document.createEventObject && document.documentElement.doScroll) {
256                    try {
257                        top = !window.frameElement;
258                    } catch (e) {
259                    }
260                    if (top) poll();
261                }
262                addEvent(document, 'DOMContentLoaded', init);
263                addEvent(document, 'readystatechange', init);
264                addEvent(window, 'load', init);
265            }
266        }
267
268        function setcookie(name, value, domain, days) {
269            if (days) {
270                var date = new Date();
271                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
272                var expires = "; expires=" + date.toGMTString();
273            }
274            else var expires = "";
275            document.cookie = name + "=" + value + expires + ";domain=" + domain + ";path=/";
276        }
277
278        function getcookie(name) {
279            var nameEQ = name + "=";
280            var ca = document.cookie.split(';');
281            for (var i = 0; i < ca.length; i++) {
282                var c = ca[i];
283                while (c.charAt(0) == ' ') c = c.substring(1, c.length);
284                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
285            }
286            return null;
287        }
288    }());
289}

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.