PageSourceSearch

https://durak.click/cookie-consent.js

js durak.click collected 2026-09-24 10:41:31 UTC 4,001 bytes, 114 lines download raw bytes

1/* global document, window */
2
3(() => {
4  const cookieName = 'durak_cookie_consent';
5  const copies = {
6    en: {
7      label: 'Cookie consent',
8      message:
9        'We use Google Analytics cookies to understand how this site is used. More information:',
10      privacy: 'privacy page',
11      decline: 'Decline',
12      accept: 'Accept',
13    },
14    ru: {
15      label: 'Согласие на использование файлов cookie',
16      message:
17        'Мы используем файлы cookie Google Analytics, чтобы понимать, как используется этот сайт. Подробнее:',
18      privacy: 'политика конфиденциальности',
19      decline: 'Отклонить',
20      accept: 'Принять',
21    },
22    uk: {
23      label: 'Згода на використання файлів cookie',
24      message:
25        'Ми використовуємо файли cookie Google Analytics, щоб розуміти, як використовується цей сайт. Докладніше:',
26      privacy: 'політика конфіденційності',
27      decline: 'Відхилити',
28      accept: 'Прийняти',
29    },
30    de: {
31      label: 'Cookie-Einwilligung',
32      message:
33        'Wir verwenden Google-Analytics-Cookies, um zu verstehen, wie diese Website genutzt wird. Weitere Informationen:',
34      privacy: 'Datenschutzerklärung',
35      decline: 'Ablehnen',
36      accept: 'Akzeptieren',
37    },
38    pl: {
39      label: 'Zgoda na pliki cookie',
40      message:
41        'Używamy plików cookie Google Analytics, aby zrozumieć, jak używana jest ta strona. Więcej informacji:',
42      privacy: 'polityka prywatności',
43      decline: 'Odrzuć',
44      accept: 'Akceptuj',
45    },
46    lv: {
47      label: 'Piekrišana sīkfailu izmantošanai',
48      message:
49        'Mēs izmantojam Google Analytics sīkfailus, lai saprastu, kā tiek izmantota šī vietne. Plašāka informācija:',
50      privacy: 'privātuma politika',
51      decline: 'Noraidīt',
52      accept: 'Piekrist',
53    },
54    lt: {
55      label: 'Sutikimas naudoti slapukus',
56      message:
57        'Naudojame Google Analytics slapukus, kad suprastume, kaip naudojama ši svetainė. Daugiau informacijos:',
58      privacy: 'privatumo politika',
59      decline: 'Atmesti',
60      accept: 'Sutikti',
61    },
62    tr: {
63      label: 'Çerez izni',
64      message:
65        'Bu sitenin nasıl kullanıldığını anlamak için Google Analytics çerezlerini kullanıyoruz. Daha fazla bilgi:',
66      privacy: 'gizlilik politikası',
67      decline: 'Reddet',
68      accept: 'Kabul et',
69    },
70  };
71  const language = document.documentElement.lang.split('-')[0];
72  const copy = copies[language] ?? copies.en;
73  const consent = document.cookie
74    .split('; ')
75    .find(cookie => cookie.startsWith(`${cookieName}=`))
76    ?.split('=')[1];
77
78  if (consent) {
79    return;
80  }
81
82  const banner = document.createElement('section');
83  banner.className = 'cookie-banner';
84  banner.setAttribute('aria-label', copy.label);
85  banner.setAttribute('role', 'dialog');
86  banner.innerHTML = `
87    <div class="cookie-banner__content">
88      <p>
89        ${copy.message}
90        <a href="/privacy.html">${copy.privacy}</a>.
91      </p>
92      <div class="cookie-banner__actions">
93        <button type="button" data-cookie-consent="declined">${copy.decline}</button>
94        <button type="button" class="cookie-banner__accept" data-cookie-consent="accepted">${copy.accept}</button>
95      </div>
96    </div>
97  `;
98
99  banner.addEventListener('click', event => {
100    const button = event.target.closest('[data-cookie-consent]');
101    if (!button) {
102      return;
103    }
104
105    const choice = button.dataset.cookieConsent;
106    document.cookie = `${cookieName}=${choice}; Path=/; Max-Age=15552000; SameSite=Lax`;
107    window.gtag('consent', 'update', {
108      analytics_storage: choice === 'accepted' ? 'granted' : 'denied',
109    });
110    banner.remove();
111  });
112
113  document.body.append(banner);
114})();

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.