PageSourceSearch

https://www.posta-romana.ro/cnpr-app/skins/js/cnpr_ate_cookie.js?v=6

js posta-romana.ro collected 2026-10-02 04:51:39 UTC 22,194 bytes, 635 lines download raw bytes

1/**
2 * Minified by jsDelivr using Terser v3.14.1.
3 * Original file: /npm/[email protected]/src/js.cookie.js
4 * 
5 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 */
7
8!function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var o=arguments[e];for(var t in o)n[t]=o[t]}return n}return function n(o){function t(n,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(e){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var s="";for(var f in i)i[f]&&(s+="; "+f,!0!==i[f]&&(s+="="+i[f]));return document.cookie=n+"="+r+s}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u<p.length;u++){var l=p[u].split("="),C=l.slice(1).join("=");this.json||'"'!==C.charAt(0)||(C=C.slice(1,-1));try{var g=l[0].replace(d,decodeURIComponent);if(C=o.read?o.read(C,g):o(C,g)||C.replace(d,decodeURIComponent),this.json)try{C=JSON.parse(C)}catch(e){}if(n===g){c=C;break}n||(c[g]=C)}catch(e){}}return c}}return t.set=t,t.get=function(e){return t.call(t,e)},t.getJSON=function(){return t.apply({json:!0},[].slice.call(arguments))},t.defaults={},t.remove=function(n,o){t(n,"",e(o,{expires:-1}))},t.withConverter=n,t}(function(){})});
9//# sourceMappingURL=/sm/203d9606ffea7a776ef56994ac4d4a1ab0a18611bf5f22fd2f82e9b682eea54f.map
10if (!('remove' in Element.prototype)) {
11    Element.prototype.remove = function() {
12        if (this.parentNode) {
13            this.parentNode.removeChild(this);
14        }
15    };
16} 
17/*
18var vp_selected_language = 'ro';
19if (typeof lang === "undefined") {
20  var lang = vp_selected_language;
21}
22*/
23var lang = cnpr_ate_cookie_lang;
24var vp_selected_language = cnpr_ate_cookie_lang;
25
26if (lang === "ro") vp_selected_language = "ro";
27if(document.getElementById('ate_cookie_dialog')){
28    function injectScripts(Consent, cookies_scripts, type, cookie_type) {
29        
30        //parse all cookie scripts and activate them if selected by user on button click
31        for (var i = 0; i < cookies_scripts.length; i++) {
32
33            if (cookies_scripts[i] != null && cookies_scripts[i].getAttribute('data-cookieconsent') == cookie_type) {
34                var container = document.getElementsByTagName(cookies_scripts[i].getAttribute('data-position'))[0];
35                var script = document.createElement('script');
36				
37				
38				
39                if (type === 'add') {
40                    script.type = Consent[cookies_scripts[i].getAttribute('data-cookieconsent')] === true ? 'text/javascript' : 'text/plain';
41                } else {
42                    script.type = 'text/plain';
43                }
44
45                script.text = cookies_scripts[i].text;
46                if (cookies_scripts[i].src) {
47                    script.src = cookies_scripts[i].src;
48                }
49
50                script.setAttribute('data-position', cookies_scripts[i].getAttribute('data-position'));
51                script.setAttribute('data-cookieconsent', cookies_scripts[i].getAttribute('data-cookieconsent'));
52
53                cookies_scripts[i].remove();
54                //delete old scripts
55                container.appendChild(script);
56                //add and execute new scripts
57                document.getElementById('ate_cookie_dialog').style.display = 'none'
58            }
59        }
60    }
61
62    
63
64    function removeScripts(Consent, cookies_scripts) {
65
66        for (var i = 0; i < cookies_scripts.length; i++) {
67
68            if (cookies_scripts[i] != null) {
69                var container = document.getElementsByTagName(cookies_scripts[i].getAttribute('data-position'))[0];
70                var script = document.createElement('script');
71
72                script.type = 'text/plain';
73                script.text = cookies_scripts[i].text;
74
75                if (cookies_scripts[i].src) {
76                    script.src = cookies_scripts[i].src;
77                }
78
79                script.setAttribute('data-position', cookies_scripts[i].getAttribute('data-position'));
80                script.setAttribute('data-cookieconsent', cookies_scripts[i].getAttribute('data-cookieconsent'));
81
82                cookies_scripts[i].remove();
83                //delete old scripts
84                container.appendChild(script);
85                //add and execute new scripts
86                document.getElementById('ate_cookie_dialog').style.display = 'block'
87            }
88        }
89    }
90
91    //handle cookie accept
92
93    var Consent = Cookies.getJSON('CookieConsent')
94    if (!Consent) {
95        document.getElementById('ate_cookie_dialog').style.display = 'block'
96    }
97
98    if(document.getElementById('ate_cookie_ButtonStatistici')){
99        document.getElementById('ate_cookie_ButtonStatistici').checked = !Consent ? false : Consent.statistics;
100    }
101    
102    if(document.getElementById('ate_cookie_ButtonMarketing')){
103        document.getElementById('ate_cookie_ButtonMarketing').checked = !Consent ? false : Consent.marketing;
104    }
105
106    //document.getElementById('ate_cookie_ButtonMarketing').checked = !Consent ? false : Consent.marketing;
107
108    var cookies_scripts = document.querySelectorAll('[data-cookieconsent]')
109
110    //handle button click
111    document.getElementById('ate_accept_all_button').addEventListener('click', function(e) {
112        e.preventDefault();
113        //getting selected options values to be set on consent cookie
114        var statistics_checked = document.getElementById('ate_cookie_ButtonStatistici').checked;
115        var marketing_checked = document.getElementById('ate_cookie_ButtonMarketing').checked;
116        
117        var all_cookies = Cookies.get();
118
119        for (var k in all_cookies) {
120            if (k != 'CookieConsent') {
121               Cookies.remove(k, {
122                    path : '/',
123                    domain : 'dev.posta-romana.ro'
124                });
125            } 
126        }
127
128        //setting consent cookie
129        Cookies.set('CookieConsent', {
130            necessary : true,
131            statistics : statistics_checked,
132            marketing: marketing_checked
133           
134        }, {
135            expires : 365
136        });
137
138
139        Consent = Cookies.getJSON('CookieConsent')
140        cookies_scripts = document.querySelectorAll('[data-cookieconsent]')
141        //create scripts for cookies and inject them into page/execute them
142		
143		
144        
145        if(statistics_checked === false){
146            injectScripts(Consent, cookies_scripts, 'delete', 'statistics')
147        }else{
148            injectScripts(Consent, cookies_scripts, 'add', 'statistics')
149        }
150        
151        if(marketing_checked === false){
152            injectScripts(Consent, cookies_scripts, 'delete', 'marketing')
153        }else{
154            injectScripts(Consent, cookies_scripts, 'add', 'marketing')
155        }
156       
157    })
158	
159	var element =  document.getElementById('vp_realy_ate_accept_all_button');
160	if (typeof(element) != 'undefined' && element != null)
161	{
162	  	document.getElementById('vp_realy_ate_accept_all_button').addEventListener('click', function(e) {
163	        e.preventDefault();
164	        //getting selected options values to be set on consent cookie
165	        var statistics_checked = true;
166	        var marketing_checked = true;
167	        document.getElementById('ate_cookie_ButtonStatistici').checked = true;
168        	document.getElementById('ate_cookie_ButtonMarketing').checked = true;
169	        var all_cookies = Cookies.get();
170	        
171	        for (var k in all_cookies) {
172	            if (k != 'CookieConsent') {
173	               Cookies.remove(k, {
174	                    path : '/',
175	                    domain : 'dev.posta-romana.ro'
176	                });
177	            } 
178	        }
179	
180	        //setting consent cookie
181	        Cookies.set('CookieConsent', {
182	            necessary : true,
183	            statistics : statistics_checked,
184              marketing: marketing_checked
185	           
186	        }, {
187	            expires : 365
188	        });
189	
190	        Consent = Cookies.getJSON('CookieConsent')
191	        cookies_scripts = document.querySelectorAll('[data-cookieconsent]')
192	        //create scripts for cookies and inject them into page/execute them
193	        
194	        if(statistics_checked === false){
195	            injectScripts(Consent, cookies_scripts, 'delete', 'statistics')
196	        }else{
197	            injectScripts(Consent, cookies_scripts, 'add', 'statistics')
198	        }
199			
200			    if(marketing_checked === false){
201	            injectScripts(Consent, cookies_scripts, 'delete', 'marketing')
202	        }else{
203	            injectScripts(Consent, cookies_scripts, 'add', 'marketing')
204	        }
205	    })
206	}
207	
208
209
210
211    function check_all_onscroll(){
212
213            //document.getElementById('ate_cookie_ButtonStatistici').checked = true;
214
215            Cookies.set('CookieConsent', {
216
217                necessary : true,
218
219                statistics : document.getElementById('ate_cookie_ButtonStatistici').checked,
220
221                marketing : document.getElementById('ate_cookie_ButtonMarketing').checked,
222
223            }, {
224
225                expires : 365
226
227            });
228
229            Consent = Cookies.getJSON('CookieConsent')
230
231            cookies_scripts = document.querySelectorAll('[data-cookieconsent]')
232
233            //create scripts for cookies and inject them into page/execute them
234
235            injectScripts(Consent, cookies_scripts, 'add')
236
237    }
238
239    if (Consent) {//means cookie settings have been modified by the user so now we can handle them and change the script type to "type/javascript" or not
240		
241		  if (Consent['statistics'] == true)
242        	injectScripts(Consent, cookies_scripts, 'add', 'statistics');
243    	else
244    		injectScripts(Consent, cookies_scripts, 'delete', 'statistics');
245        
246      if (Consent['marketing'] == true)
247        	injectScripts(Consent, cookies_scripts, 'add', 'marketing');
248    	else
249    		injectScripts(Consent, cookies_scripts, 'delete', 'marketing');
250
251    }
252
253
254    
255	if (vp_selected_language === "en"){
256	//EN LANG
257
258					    var obj = {
259					        "Necesare" : {
260					            'descriere' : ' Required',	
261					            'tip' : 'mandatory',	
262					          'cookies' : [{"nume":"CookieConsent","expira":"1 an"},
263{"nume":"_GRECAPTCHA","expira":"180 zile"},
264{"nume":"PHPSESSID","expira":"sesiune"},
265{"nume":"last_shown_newsletter","expira":"sesiune"},
266{"nume":"rc::a","expira":"Persistent"},
267{"nume":"rc::b","expira":"sesiune"},
268{"nume":"rc::c","expira":"sesiune"}]		
269					        },	
270					        "Statistici" : {	
271					            'descriere' : ' Statistics',	
272					            'tip' : 'optional',	
273					            'cookies' : [{"nume":"_ga","expira":"2 ani"},
274{"nume":"_gat","expira":"1 zi"},
275{"nume":"_gid","expira":"1 zi"},
276{"nume":"collect","expira":"sesiune"}]	
277					        },
278                  "Marketing" : {	
279                      'descriere' : ' Marketing',	
280                      'tip' : 'optional',	
281                      'cookies' : [
282//{"nume":"__atrfs","expira":"sesiune"},
283//{"nume":"__atuvc","expira":"13 luni"},
284//{"nume":"__atuvs","expira":"1 zi"},
285{"nume":"_fbp","expira":"3 luni"},
286{"nume":"ads/ga-audiences","expira":"sesiune"},
287{"nume":"ads/ga-audiences","expira":"sesiune"},
288//{"nume":"at-lojson-cache-#","expira":"persistent"},
289//{"nume":"at-rand","expira":"persistent"},
290//{"nume":"loc","expira":"13 luni"},
291//{"nume":"uvc","expira":"13 luni"},
292//{"nume":"xtc","expira":"13 luni"}
293]
294                  },
295                  
296					    }; 
297				} else {
298	//RO LANG
299					    var obj = {
300					        "Necesare" : {
301					            'descriere' : ' Necesare',	
302					            'tip' : 'mandatory',	
303					            'cookies' : [{"nume":"CookieConsent","expira":"1 an"},
304{"nume":"_GRECAPTCHA","expira":"180 zile"},
305{"nume":"PHPSESSID","expira":"sesiune"},
306{"nume":"last_shown_newsletter","expira":"sesiune"},
307{"nume":"rc::a","expira":"Persistent"},
308{"nume":"rc::b","expira":"sesiune"},
309{"nume":"rc::c","expira":"sesiune"}]	
310					        },	
311					        "Statistici" : {	
312					            'descriere' : ' Statistici',	
313					            'tip' : 'optional',	
314					            'cookies' : [{"nume":"_ga","expira":"2 ani"},
315{"nume":"_gat","expira":"1 zi"},
316{"nume":"_gid","expira":"1 zi"},
317{"nume":"collect","expira":"sesiune"}]	
318					        },
319                  "Marketing" : {	
320                      'descriere' : ' Marketing',	
321                      'tip' : 'optional',	
322                      'cookies' : [
323//{"nume":"__atrfs","expira":"sesiune"},
324//{"nume":"__atuvc","expira":"13 luni"},
325//{"nume":"__atuvs","expira":"1 zi"},
326{"nume":"_fbp","expira":"3 luni"},
327{"nume":"ads/ga-audiences","expira":"sesiune"},
328{"nume":"ads/ga-audiences","expira":"sesiune"},
329//{"nume":"at-lojson-cache-#","expira":"persistent"},
330//{"nume":"at-rand","expira":"persistent"},
331//{"nume":"loc","expira":"13 luni"},
332//{"nume":"uvc","expira":"13 luni"},
333//{"nume":"xtc","expira":"13 luni"}
334]	
335                  },
336					    }; 	
337	
338	
339	}
340
341    var tabs_elem = document.getElementById('ate_cookie_selectPane');
342
343    var ContainerTypes_elem = document.getElementById('ate_cookie_ContentCookieContainerTypes');
344
345    var ContainerTypesDetails_elem = document.getElementById('ate_cookie_ContentCookieContainerTypeDetails');
346
347    
348
349    for (i in obj) {
350
351        var tip_cookie  = i;
352
353        var cookie_det = obj[i].cookies;
354
355        var cookie_option = obj[i].tip;
356
357        var cookie_desc = obj[i].descriere;
358
359        
360		
361		
362        var data = "<div class='ate_cookie_ButtonWrapper'>";
363
364        var data_ContainerTypes = '';
365
366        if (cookie_option == 'mandatory'){
367
368                data +=  "<input type='checkbox' id='ate_cookie_Button" + tip_cookie +"' class='ate_cookie_Button ate_cookie_ButtonDisabled' disabled='disabled' checked='checked'>";
369
370                //data_ContainerTypes += "<a id='ate_cookie_ContentCookieContainer" + tip_cookie + "' onclick='javascript: ate_showCookieType('"+tip_cookie+"');' class='ate_cookie_ContentCookieContainerTypes ate_cookie_ContentCookieContainerTypesSelected'>";
371
372                data_ContainerTypes += '<a class="ate_cookie_ContentCookieContainerTypes ate_cookie_ContentCookieContainerTypesSelected" id="ate_cookie_ContentCookieContainer' + tip_cookie + '" onClick="javascript: ate_showCookieType(\'' + tip_cookie + '\')">';
373
374            }
375
376            else if (cookie_option == 'optional'){
377				
378                if(Consent){
379                	if (tip_cookie == 'Statistici')
380                    	checked_custom_optional = Consent && Consent.statistics === true ? "checked='checked'" : '';
381                   	else if (tip_cookie == 'Marketing')
382                   		checked_custom_optional = Consent && Consent.marketing === true ? "checked='checked'" : '';
383                }else{
384//                    checked_custom_optional = "checked='checked'";
385                    checked_custom_optional = "";
386
387                }
388
389                data +=  "<input type='checkbox' id='ate_cookie_Button" + tip_cookie +"' class='ate_cookie_Button' " + checked_custom_optional + ">";
390
391                //data_ContainerTypes += "<a id='ate_cookie_ContentCookieContainer" + tip_cookie + "' onclick='javascript: ate_showCookieType('"+ tip_cookie + "');' class='ate_cookie_ContentCookieContainerTypes'>";
392
393            data_ContainerTypes += '<a class="ate_cookie_ContentCookieContainerTypes" id="ate_cookie_ContentCookieContainer' + tip_cookie + '" onClick="javascript: ate_showCookieType(\'' + tip_cookie + '\')">';
394
395                
396
397            }
398
399        
400
401        data +=  "<label for='ate_cookie_Button" + tip_cookie +"'>" + cookie_desc +"</label>";
402
403        data +=  "</div>";
404
405        
406
407        data_ContainerTypes += " <label>&nbsp;</label>" + cookie_desc + " (" + cookie_det.length + ") </a>"; 
408
409        
410        tabs_elem.insertAdjacentHTML('beforeend', data);
411
412        ContainerTypes_elem.insertAdjacentHTML('beforeend', data_ContainerTypes);
413
414        
415
416        var html_rows = '';
417
418        for (j in cookie_det) {
419
420            html_rows += '<tr>';
421
422               html_rows += '<td width="50%">' + cookie_det[j].nume +'</td>';
423
424               html_rows += '<td width="50%">' + cookie_det[j].expira +'</td>';
425
426               html_rows += '</tr>';
427
428            
429
430        }
431
432        if (tip_cookie == 'Necesare'){
433
434               var html_cookies = '<div id="ate_cookie_ContentCookieTabs' + tip_cookie +'" class="ate_cookie_ContentCookieTabs ate_cookie_ContentCookieTabsSelected">';
435
436            }
437
438            else {
439
440                var html_cookies = '<div id="ate_cookie_ContentCookieTabs' + tip_cookie +'" class="ate_cookie_ContentCookieTabs">';
441
442                
443
444            }
445
446            html_cookies += '<div class="CybotCookiebotDialogDetailBodyContentCookieTypeIntro">';
447
448                html_cookies += cookie_desc;
449
450            html_cookies += '</div>';
451
452            html_cookies += '<div class="ate_cookie_ContentCookieTypeTableContainer">';
453
454                html_cookies += '<table id="ate_cookie_DetailTable' + tip_cookie +'" class="ate_cookie_DialogDetailBodyContentCookieTypeTable">';
455
456                     html_cookies += '<thead>';
457
458                        html_cookies += '<tr>';
459							if (vp_selected_language === "ro"){
460                            html_cookies += '<th>Nume</th>';
461
462                            html_cookies += '<th>Expira</th>';
463                            }
464                            else{//default to english
465	                        html_cookies += '<th>
465Name</th>';
466
467                            html_cookies += '<th>Lifespan</th>';    
468                            }
469
470                        html_cookies += '</tr>';
471
472                    html_cookies += '</thead>';
473
474                    html_cookies += '<tbody>';
475
476                             html_cookies += html_rows;
477
478                   html_cookies += '</tbody>';
479
480               html_cookies += '</table> ';
481
482           html_cookies += '</div>';
483
484       html_cookies += '</div>';
485
486        
487
488       ContainerTypesDetails_elem.insertAdjacentHTML('beforeend', html_cookies);
489
490    }
491
492    
493
494    function ate_showTab(tab){
495
496            
497
498        var detaliiContentTab = document.getElementsByClassName('ate_cookie_TabsItem'); 
499
500        var i;
501
502        for (i = 0; i < detaliiContentTab.length; i++) {
503
504          detaliiContentTab[i].classList.remove("ate_cookie_TabsItemSelected");
505
506        }
507
508        
509
510        var detaliiContent= document.getElementsByClassName('ate_cookie_ContentText'); 
511
512        var i;
513
514        for (i = 0; i < detaliiContent.length; i++) {
515
516          detaliiContent[i].classList.remove("ate_cookie_ContentTextSelected");
517
518        }
519
520        document.getElementById('ate_cookie_Tabs' + tab).classList.add("ate_cookie_TabsItemSelected");
521
522        document.getElementById('ate_cookie_ContentText' + tab).classList.add("ate_cookie_ContentTextSelected");
523
524    } 
525
526    
527
528    function ate_showCookieType(tab){
529
530        var detaliiCookie = document.getElementsByClassName('ate_cookie_ContentCookieTabs'); 
531
532        var i;
533
534        for (i = 0; i < detaliiCookie.length; i++) {
535
536          detaliiCookie[i].classList.remove("ate_cookie_ContentCookieTabsSelected");
537
538        }
539
540        
541
542        var tabsCookie = document.getElementsByClassName('ate_cookie_ContentCookieContainerTypes'); 
543
544        var i;
545
546        for (i = 0; i < tabsCookie.length; i++) {
547
548          tabsCookie[i].classList.remove("ate_cookie_ContentCookieContainerTypesSelected");
549
550        }
551
552        document.getElementById('ate_cookie_ContentCookieContainer' + tab).classList.add("ate_cookie_ContentCookieContainerTypesSelected");
553
554        document.getElementById('ate_cookie_ContentCookieTabs' + tab).classList.add("ate_cookie_ContentCookieTabsSelected");
555
556    } 
557
558    
559
560    function ate_showDetails(element){
561
562        //ButtonExpanded
563
564        var detaliiContainer = document.getElementById("ate_cookie_wrapper_DialogDetail");
565
566        //element.classList.remove("ButtonExpanded");
567
568        if (element.classList.contains("ButtonExpanded")) {
569
570            // Has my-class in it
571
572            element.classList.remove("ButtonExpanded");
573
574            detaliiContainer.style.display = "none";
575            /*
576            var buttonLabel = document.getElementById("ate_cookie_show_details_label");
577            element.innerHTML = buttonLabel.value;
578            */
579            element.innerHTML = cnpr_ate_cookie_texts[cnpr_ate_cookie_lang]["showDetails"];
580        } else {
581
582            // No my-class :(
583
584            element.classList.add("ButtonExpanded");
585
586            detaliiContainer.style.display = "block";
587            /*
588            var buttonLabel = document.getElementById("ate_cookie_hide_details_label");
589            element.innerHTML = buttonLabel.value;
590            */
591            element.innerHTML = cnpr_ate_cookie_texts[cnpr_ate_cookie_lang]["hideDetails"];
592        }
593
594    }
595
596    if(document.getElementById('ate_modify_cookie_settings')){
597
598        document.getElementById('ate_modify_cookie_settings').addEventListener('click', function(e){
599            e.preventDefault();
600
601            document.getElementById('ate_cookie_dialog').style.display = 'block'
602
603        })
604
605    }
606
607    var cookie_set = false;
608
609   /* setTimeout(function(){
610
611        window.onscroll = function(){
612
613            if(window.pageYOffset >= 200){
614
615                if(cookie_set === false){
616
617                    //document.getElementById('ate_accept_all_button').click();
618
619                    check_all_onscroll();
620
621                    document.getElementById('ate_cookie_dialog').style.display = 'none'
622
623                    cookie_set = true;
624
625                }
626
627            }
628
629        }
630
631    }, 2000)*/
632
633    
634
635}

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.