PageSourceSearch

https://www.salon-stone.ru/js/cookieNew.js

js salon-stone.ru collected 2026-10-09 23:27:40 UTC 4,590 bytes, 109 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2    function hasCookie(name) {
3        return document.cookie.split('; ').some(cookie => cookie.startsWith(name + '='));
4    }
5
6    function initYandexMetrika() {
7    	console.log('1');
8    }
9
10    // Åñëè ñîãëàñèå óæå äàíî - ñðàçó èíèöèàëèçèðóåì ìåòðèêó
11    if (hasCookie('cookieConsent')) {
12        initYandexMetrika();
13    } else {
14        // Ïîêàçûâàåì áàííåð, åñëè ñîãëàñèÿ íåò
15        const wrapper = document.createElement('div');
16        wrapper.innerHTML = `
17            <div id="cookies-notify">
18                <span>Ìû èñïîëüçóåì cookies.
19Èñïîëüçóÿ ñàéò, âû ñîãëàøàåòåñü ñ <a href="/soglashenie-na-obrabotku-personalnyh-dannyh.html">îáðàáîòêîé äàííûõ</a> ñ öåëüþ ñáîðà àíàëèòèêè. Cookies ìîæíî îòêëþ÷èòü â ëþáîé ìîìåíò â íàñòðîéêàõ âàøåãî áðàóçåðà.</span>
20                <button type="button" name="accept">ÎÊ</button>
21                <style>
22                    #cookies-notify {
23                        max-width: 90%;
24                        width: 100%;
25                        margin: 0 auto;
26                        padding: 15px 20px;
27                        display: flex;
28                        flex-direction: column;
29                        align-items: center;
30                        gap: 15px;
31                        position: fixed;
32                        left: 50%;
33                        bottom: 15px;
34                        font-size: 14px;
35                        background: #fff;
36                        border-radius: 10px;
37                        box-shadow: 0 0 15px 0 rgba(0,0,0,.3);
38                        transform: translateX(-50%);
39                        z-index: 900;
40                    }
41                    #cookies-notify a {
42                        text-decoration: underline;
43                        color: inherit;
44                    }
45                    #cookies-notify a:hover {
46                        text-decoration: none;
47                    }
48                    #cookies-notify button {
49                        padding: 10px 20px;
50                        display: block;
51                        flex-shrink: 0;
52                        font-size: 12px;
53                        color: #fff;
54                        background: url(/img/menu_f.gif) right repeat;
55                        border: none;
56                        cursor: pointer;
57                    }
58                    @media (min-width: 768px) {
59                        #cookies-notify {
60                            max-width: 900px;
61                            width: unset;
62                            flex-direction: row;
63                        }
64                    }
65                </style>
66            </div>
67        `;
68        document.body.appendChild(wrapper);
69
70        document.querySelector('#cookies-notify button[name="accept"]')?.addEventListener('click', function(e) {
71            // Óñòàíàâëèâàåì êóêè íà 1 ãîä
72            //const expires = new Date(Date.now() + 365 * 864e5).toUTCString();
73        	const days = 1;
74        	const expires = new Date(Date.now() + days * 864e5).toUTCString();
75            document.cookie = `cookieConsent=true; expires=${expires}; path=/`;
76            
77            // Èíèöèàëèçèðóåì ìåòðèêó ïîñëå ñîãëàñèÿ
78            initYandexMetrika();
79            
80            e.currentTarget.closest('#cookies-notify').remove();
81            
82            //Ïåðåçàãðóæàåì ñòðàíèöó ÷åðåç 100 ìñ (äàåì âðåìÿ íà óñòàíîâêó cookie)
83            setTimeout(() => {
84                window.location.reload();
85            }, 100);
86        });
87
88        // Áëîêèðóåì ôóíêöèîíàë ñàéòà äî ïðèíÿòèÿ êóêè
89        document.addEventListener('click', function(e) {
90        	//if (e.target.closest('.js-modal-1, .js-modal-2, a[href^="/orders.html"], input[type="button"], .btn, button, a.link_to_order, #filter_link, a[data-toggle="modal"], a[data-role="form"], div[data-role="item.order"], div[data-action="forms.call.open"], #header-call-button, #header-callback-button, a[href^="#"], a[href^="/cart"], button[type="submit"], input[type="submit"], .header__callback, .header__order, a.bbottom_basket, a.open-modal')) {
91        	if (e.target.closest('')) {
92                e.preventDefault();
93                alert('Äëÿ ïðîäîëæåíèÿ íåîáõîäèìî ïðèíÿòü íàøó ïîëèòèêó èñïîëüçîâàíèÿ cookies.');
94                setTimeout(() => {
95                    window.location.reload();
96                }, 100);
97            }
98        }, true);
99    }
100});
101
102// Äîáàâëÿåì noscript ÷àñòü òîëüêî åñëè cookies ïðèíÿòû èëè åñëè JS îòêëþ÷åí 
103document.write(`
104	    <noscript>
105	        
106	    </noscript>
107	`);
108
109

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.