PageSourceSearch

https://www.nayeef.com/dist/front/static/new_default_theme/addons_gcookie.js?v=640

js nayeef.com collected 2026-09-24 14:49:18 UTC 2,760 bytes, 90 lines download raw bytes

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.