1class AddonsGcookie extends HTMLElement { 2 constructor() { 3 super(); 4 5 } 6 7 connectedCallback() { 8 if (!Cookies.get('addons_gcookie_status')) { 9 setTimeout(() => { 10 this.showCookieWindow(); 11 }, 1500); 12 } 13 let approvedButton = this.querySelector(".approved-button") 14 if (approvedButton) { 15 approvedButton.addEventListener("click", (e) => { 16 this.acceptCookie(); 17 }); 18 } 19 20 let rejectButton = this.querySelector(".reject-button") 21 if (rejectButton) { 22 rejectButton.addEventListener("click", (e) => { 23 this.rejectCookie(); 24 }) 25 } 26 27 } 28 29 showCookieWindow() { 30 let visit_country_code = Cookies.get('visit_country_code');//CFè¿åæç¨æ·æå¨æ´æ¹çå½å®¶Code 31 if (!visit_country_code || visit_country_code === 'null') {//CF没æè¿åå½å®¶é£ä¹ç´æ¥æ¾ç¤ºåºæ¥ 32 this.openWindow(); 33 34 return; 35 } 36 visit_country_code = visit_country_code.toUpperCase(); 37 let countryType = this.dataset.countryType; 38 let countryCodes = this.dataset.countryCodes; 39 if (countryType != 2) {//1ä»£è¡¨å ¨é¨å½å®¶ 齿¾ç¤º 2 å说ææè®¿å®¢å½å®¶éå¶ï¼é£ä¹éè¦å è·å访客å½åçå½å®¶ 40 this.openWindow(); 41 42 return; 43 } 44 let countryCodeArr = safeJsonStringToArray(countryCodes); 45 if (countryCodeArr.length > 0 && countryCodeArr.includes(visit_country_code)) { 46 this.openWindow(); 47 48 return; 49 } 50 } 51 52 acceptCookie() { 53 try { 54 window.consentAccept() 55 } catch (e) { 56 } 57 this.closeWindow(); 58 Cookies.set('addons_gcookie_status', 1, {expires: 30, path: '/'}); 59 } 60 61 rejectCookie() { 62 let refuse_logic_type = this.dataset.refuseLogicType; 63 try { 64 if (refuse_logic_type == 1) { 65 window.consentRefuse(); 66 } else if (refuse_logic_type == 2) { 67 window.consentAccept(); 68 } else if (refuse_logic_type == 3) { 69 window.consentCustom(); 70 } 71 } catch (e) { 72 } 73 this.closeWindow(); 74 Cookies.set('addons_gcookie_status', 1, {expires: 30, path: '/'}); 75 } 76 77 openWindow() { 78 this.classList.remove("!m:hidden"); 79 this.classList.remove('hidden'); 80 } 81 82 closeWindow() { 83 this.classList.add('hidden'); 84 setTimeout(() => { 85 this.classList.add("!m:hidden"); 86 }, 800) 87 } 88} 89 90customElements.define('addons-gcookie', AddonsGcookie);
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.