PageSourceSearch

https://domod.ru/bitrix/components/awz/cookies.sett/templates/.default/script.js?17909230427309

js domod.ru collected 2026-10-02 09:53:55 UTC 7,309 bytes, 185 lines download raw bytes

1(function() {
2    'use strict';
3
4    if (!!window.AwzCookiesSettComponent) {
5        return;
6    }
7    window.AwzCookiesSettComponent_Instances = {};
8    window.AwzCookiesSettComponent = function(options) {
9        if(typeof options !== 'object') {
10            throw new Error('options is not object');
11        }
12        if(!options.hasOwnProperty('siteId')) {
13            throw new Error('options.siteId is required');
14        }
15        if(!options.hasOwnProperty('cmpId')) {
16            throw new Error('options.cmpId is required');
17        }
18        if(!options.hasOwnProperty('templateName')) {
19            throw new Error('options.templateName is required');
20        }
21        if(!options.hasOwnProperty('templateFolder')) {
22            throw new Error('options.templateFolder is required');
23        }
24        if(!options.hasOwnProperty('signedParameters')) {
25            throw new Error('options.signedParameters is required');
26        }
27        if(!options.hasOwnProperty('componentName')) {
28            throw new Error('options.componentName is required');
29        }
30        this.cmpId = options.cmpId;
31        this.siteId = options.siteId;
32        this.templateName = options.templateName;
33        this.templateFolder = options.templateFolder;
34        this.componentName = options.componentName;
35        this.signedParameters = options.signedParameters;
36        this.ajaxTimer = (!!options.ajaxTimer ? options.ajaxTimer : false) || 100;
37        this.debug = !!options.debug ? true : false;
38        this.lang = (!!options.lang ? options.lang : false) || {};
39        window.AwzCookiesSettComponent_Instances[this.cmpId] = this;
40
41        let parent = this;
42
43        BX.bind(BX('awz_cookies_sett__all'), 'click', function(e) {
44            if(!!e) e.preventDefault();
45            parent.allowAll();
46        });
47        BX.bind(BX('awz_cookies_sett__all_decline'), 'click', function(e) {
48            if(!!e) e.preventDefault();
49            parent.declineAll();
50        });
51        BX.bind(BX('awz_cookies_sett__settings'), 'click', function(e) {
52            if(!!e) e.preventDefault();
53            parent.settings();
54        });
55        BX.ready(function(){
56            BX.bind(BX('awz_cookies_sett__settings_custom'), 'click', function(e) {
57                if(!!e) e.preventDefault();
58                parent.settings();
59            });
60        });
61    };
62    window.AwzCookiesSettComponent.prototype = {
63        getInstance: function (cmpId) {
64            if (!cmpId) {
65                cmpId = 'default';
66            }
67            if (!window.AwzCookiesSettComponent_Instances.hasOwnProperty(cmpId)) {
68                window.AwzCookiesSettComponent_Instances[cmpId] = this;
69            }
70            return window.AwzCookiesSettComponent_Instances[cmpId];
71        },
72        loc: function(code){
73            return this.lang.hasOwnProperty(code) ? this.lang[code] : code;
74        },
75        getModal: function(content)
76        {
77            if(!!this._modal){
78                return this._modal;
79            }
80            this._modal = BX.PopupWindowManager.create("popup-window-content-awz_cmp_cookies", null, {
81                content: content,
82                closeIcon : false,
83                lightShadow : true,
84                destroyed : true,
85                fixed : true,
86                maxWidth : 580,
87                overlay: {
88                    backgroundColor: '#000000', opacity: '80'
89                }
90            });
91            return this._modal;
92        },
93        settings: function(){
94            let parent = this;
95            let formData = {};
96            formData['SITE_ID'] = parent.siteId;
97            formData['signedParameters'] = parent.signedParameters;
98            formData['method'] = 'POST';
99            formData['componentName'] = parent.componentName;
100            formData['templateName'] = parent.templateName;
101            let elements = document.getElementsByClassName("awz_cookies_sett__message");
102            if(elements && elements.length){
103                elements[0].remove();
104            }
105            setTimeout(function(){
106                BX.ajax.runComponentAction('awz:cookies.sett', 'getSett', {
107                    mode: 'class',
108                    data: formData
109                }).then(function (response) {
110                    if(response && response.hasOwnProperty('data') &&
111                        response.hasOwnProperty('status') && response['status'] === 'success'){
112                        parent.getModal(response['data']).show();
113
114                        BX.bind(BX('awz_cookies_sett__save'), 'click', function(e) {
115                            if(!!e) e.preventDefault();
116                            parent.sendForm();
117                        });
118
119                    }
120                }, function (response) {
121                    console.error(response);
122                });
123            },this.ajaxTimer);
124        },
125        allowAll: function(){
126            let formData = {
127                'awz_cookies_mode1':'Y',
128                'awz_cookies_mode2':'Y',
129                'awz_cookies_mode3':'Y',
130                'awz_cookies_mode_all':'Y'
131            };
132            formData['signedParameters'] = this.signedParameters;
133            formData['method'] = 'POST';
134            formData['SITE_ID'] = this.siteId;
135            let elements = document.getElementsByClassName("awz_cookies_sett__message");
136            if(elements && elements.length){
137                elements[0].remove();
138            }
139            setTimeout(function(){
140                BX.ajax.runComponentAction('awz:cookies.sett', 'allow', {
141                    mode: 'class',
142                    data: formData
143                });
144            },this.ajaxTimer);
145        },
146        declineAll: function(){
147            let formData = {
148                'awz_cookies_mode1':'N',
149                'awz_cookies_mode2':'N',
150                'awz_cookies_mode3':'N',
151                'awz_cookies_mode_all':'N'
152            };
153            formData['signedParameters'] = this.signedParameters;
154            formData['method'] = 'POST';
155            formData['SITE_ID'] = this.siteId;
156            document.getElementsByClassName("awz_cookies_sett__message")[0].remove();
157            setTimeout(function(){
158                BX.ajax.runComponentAction('awz:cookies.sett', 'allow', {
159                    mode: 'class',
160                    data: formData
161                });
162            },this.ajaxTimer);
163        },
164        sendForm: function(){
165            let formData = new FormData(
166                document.getElementById('awz_cookies_sett__detail-form'),
167                document.getElementById('awz_cookies_sett__save')
168            );
169            formData.append('signedParameters', this.signedParameters);
170            formData.append('method', 'POST');
171            formData.append('SITE_ID', this.siteId);
172
173            this.getModal().close();
174
175            setTimeout(function(){
176                BX.ajax.runComponentAction('awz:cookies.sett', 'allow', {
177                    mode: 'class',
178                    data: formData
179                });
180            },this.ajaxTimer);
181
182        },
183    };
184
185})();

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.