PageSourceSearch

https://kitayskiy-chay.ru/bitrix/templates/sotbit_b2c/components/b…/cookies/script.js?17631762344950

js kitayskiy-chay.ru collected 2026-10-05 22:48:46 UTC 4,950 bytes, 143 lines download raw bytes

1class UserConsent {
2    constructor(params) {
3        this.params = params;
4        this.init();
5    }
6
7    init() {
8        this.showPopup();
9
10        // @TODO
11        // if (this.params.isLoaded === 'N') {
12        //     this.fetchAgreementText();
13        // }
14    }
15
16    showPopup() {
17        BX.Sotbit.B2C.showPopup({
18            title: BX.message('MAIN_USER_CONSENT_REQUEST_TITLE_COOKIES'),
19            html: `
20                <p class="mb-1">${BX.message('MAIN_USER_CONSENT_REQUEST_PREVIEW_TEXT')}</p>
21                <button type="button" data-show-argeement>${BX.message('MAIN_USER_CONSENT_REQUEST_URL_CONFIRM')}</button>
22            `,
23            showCancelButton: true,
24            confirmButtonText: BX.message('MAIN_USER_CONSENT_REQUEST_BTN_ACCEPT'),
25            cancelButtonText: BX.message('MAIN_USER_CONSENT_REQUEST_BTN_REJECT'),
26            width: '413px',
27            position: 'bottom-end',
28            backdrop: BX.Sotbit.B2C.isTablet(),
29            willOpen: (popup) => {
30                popup.querySelector('[data-show-argeement]').addEventListener('click', this.showFullTextPopup.bind(this));
31            },
32            showClass: {
33                popup: `
34                  animate__animated
35                  ${BX.Sotbit.B2C.isTablet() ? 'animate__fadeInUp' : 'animate__fadeInRight'}
36                  animate__faster
37                `
38            },
39            hideClass: {
40                popup: `
41                  animate__animated
42                  ${BX.Sotbit.B2C.isTablet() ? 'animate__fadeOutDown' : 'animate__fadeOutRight'}
43                  animate__faster
44                `
45            },
46            fixBodyScroll: BX.Sotbit.B2C.isTablet(),
47            customClass: {
48                container: 'cookies-form',
49                confirmButton: 'btn',
50                cancelButton: 'btn btn-secondary',
51                closeButton: 'text-secondary-500',
52                actions: 'd-sm-flex flex-sm-column',
53            },
54        }).then(async results => {
55            const result = await results[0];
56
57            if (result.isConfirmed) {
58                this.accept();
59            }
60        });
61    }
62
63    getAgreementTitle() {
64        // set title from a first line from text.
65        let titleBar = '';
66        let textTitlePos = this.params.text.indexOf("\n");
67        let textTitleDotPos = this.params.text.indexOf(".");
68
69        textTitlePos = textTitlePos < textTitleDotPos ? textTitlePos : textTitleDotPos;
70
71        if (textTitlePos >= 0 && textTitlePos <= 100) {
72            titleBar = this.params.text.substr(0, textTitlePos).trim();
73            titleBar = titleBar.split(".").map(Function.prototype.call, String.prototype.trim).filter(String)[0];
74        }
75
76        return titleBar ? titleBar : BX.message('MAIN_USER_CONSENT_REQUEST_TITLE_FULL_COOKIES');
77    }
78
79    showFullTextPopup() {
80        const agreementTitle = this.getAgreementTitle();
81
82        BX.Sotbit.B2C.showPopup({
83            title: agreementTitle,
84            html: this.params.text,
85            showCancelButton: true,
86            confirmButtonText: BX.message('MAIN_USER_CONSENT_REQUEST_BTN_ACCEPT'),
87            cancelButtonText: BX.message('MAIN_USER_CONSENT_REQUEST_BTN_REJECT'),
88            width: '1000px',
89            position: 'center',
90            backdrop: true,
91            showClass: {
92                popup: `
93                  animate__animated
94                  ${BX.Sotbit.B2C.isTablet() ? 'animate__fadeInUp' : 'animate__fadeIn'}
95                  animate__faster
96                `
97            },
98            hideClass: {
99                popup: `
100                  animate__animated
101                  ${BX.Sotbit.B2C.isTablet() ? 'animate__fadeOutDown' : 'animate__fadeOut'}
102                  animate__faster
103                `
104            },
105            customClass: {
106                container: 'user-consent',
107                confirmButton: 'btn',
108                cancelButton: 'btn btn-secondary',
109                closeButton: 'text-secondary-500',
110            },
111        }).then(async results => {
112            const result = await results[0];
113
114            if (result.isConfirmed) {
115                this.accept();
116            }
117        });
118    }
119
120    accept() {
121        const data = {
122            'id': this.params.id,
123            'sec': this.params.sec,
124            'url': window.location.href,
125            'action': 'saveConsent',
126            'sessid': BX.bitrix_sessid()
127        };
128        const date = new Date();
129        date.setTime(date.getTime() + (7 * 24 * 60 * 60 * 1000)); // Set the cookie expiration date to 7 days
130
131        BX.ajax({
132            url: this.params.actionUrl,
133            method: 'POST',
134            data: data,
135            timeout: 10,
136            dataType: 'json',
137            processData: true,
138            onsuccess: () => {
139                BX.setCookie('BITRIX_SM_SOTBIT_B2C_USERCONSENT_COOKIES', 'all', {path: '/', expires: date.toGMTString()});
140            },
141        });
142    }
143}

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.