PageSourceSearch

https://dvorce.cz/public/js/cookieconsent-init.js?v=1776163688

js dvorce.cz collected 2026-09-26 12:51:14 UTC 10,138 bytes, 262 lines download raw bytes

1(function () {
2  function persistConsentState(snapshot) {
3    try {
4      localStorage.setItem('dvorce-cookie-consent-state', JSON.stringify(snapshot));
5    } catch (error) {
6      // Ignore storage failures.
7    }
8  }
9
10  function updateGoogleConsent(snapshot) {
11    window.dataLayer = window.dataLayer || [];
12    window.gtag = window.gtag || function () {
13      window.dataLayer.push(arguments);
14    };
15
16    window.gtag('consent', 'update', {
17      analytics_storage: snapshot.analytics ? 'granted' : 'denied',
18      ad_storage: snapshot.marketing ? 'granted' : 'denied',
19      ad_user_data: snapshot.marketing ? 'granted' : 'denied',
20      ad_personalization: snapshot.marketing ? 'granted' : 'denied'
21    });
22
23    // Push update_consent event for non-Google tags in GTM
24    window.dataLayer.push({ event: 'update_consent' });
25  }
26
27  function hasAcceptedCategory(cc, cookie, category) {
28    if (cc && typeof cc.acceptedCategory === 'function') {
29      try {
30        return !!cc.acceptedCategory(category);
31      } catch (error) {
32        // Ignore and try cookie fallback below.
33      }
34    }
35
36    if (cookie && cookie.categories) {
37      if (Array.isArray(cookie.categories)) {
38        return cookie.categories.indexOf(category) !== -1;
39      }
40
41      if (typeof cookie.categories === 'object') {
42        return !!cookie.categories[category];
43      }
44    }
45
46    return false;
47  }
48
49  function getConsentSnapshot(cc, cookie) {
50    return {
51      analytics: hasAcceptedCategory(cc, cookie, 'analytics'),
52      marketing: hasAcceptedCategory(cc, cookie, 'marketing')
53    };
54  }
55
56  // Only fire consent update + events when user actively interacts with the banner
57  function pushConsentEvent(cc, cookie, isUserAction) {
58    window.dataLayer = window.dataLayer || [];
59
60    var snapshot = getConsentSnapshot(cc, cookie);
61
62    persistConsentState(snapshot);
63
64    // Only fire consent update command and dataLayer events on actual user action
65    // (first consent or preference change), not on every page load
66    if (isUserAction) {
67      updateGoogleConsent(snapshot);
68
69      if (snapshot.analytics || snapshot.marketing) {
70        window.dataLayer.push({ event: 'cookies_accepted' });
71        return;
72      }
73
74      window.dataLayer.push({ event: 'cookies_rejected' });
75    }
76  }
77
78  function initCookieConsent() {
79    var cc = null;
80
81    if (typeof window.initCookieConsent === 'function') {
82      cc = window.initCookieConsent();
83    } else if (window.CookieConsent && typeof window.CookieConsent.run === 'function') {
84      cc = window.CookieConsent;
85    }
86
87    if (!cc || typeof cc.run !== 'function') {
88      return;
89    }
90
91    window.dataLayer = window.dataLayer || [];
92
93    cc.run({
94      mode: 'opt-in',
95      autoShow: true,
96      disablePageInteraction: false,
97      guiOptions: {
98        consentModal: {
99          layout: 'box',
100          position: 'middle center',
101          equalWeightButtons: true,
102          flipButtons: false
103        },
104        preferencesModal: {
105          layout: 'box',
106          equalWeightButtons: true,
107          flipButtons: false
108        }
109      },
110      categories: {
111        necessary: {
112          enabled: true,
113          readOnly: true
114        },
115        analytics: {},
116        marketing: {}
117      },
118      language: {
119        default: 'cs',
120        autoDetect: 'document',
121        translations: {
122          cs: {
123            consentModal: {
124              title: 'Používáme cookies',
125              description: 'Používáme cookies pro základní funkce webu a k anonymnímu měření návštěvnosti. Nastavení můžete kdykoliv změnit.',
126              acceptAllBtn: 'Přijmout vše',
127              acceptNecessaryBtn: 'Odmítnout nepovinné',
128              showPreferencesBtn: 'Upravit nastavení'
129            },
130            preferencesModal: {
131              title: 'Nastavení cookies',
132              acceptAllBtn: 'Přijmout vše',
133              acceptNecessaryBtn: 'Odmítnout nepovinné',
134              savePreferencesBtn: 'Uložit nastavení',
135              closeIconLabel: 'Zavřít',
136              sections: [
137                {
138                  title: 'Používáme cookies',
139                  description: 'Některé cookies jsou nezbytné pro správné fungování webu. Ostatní používáme pouze s vaším souhlasem pro anonymní měření návštěvnosti a marketing.'
140                },
141                {
142                  title: 'Nezbytné cookies',
143                  description: 'Tyto cookies zajišťují základní funkce webu, bezpečnost a správné zobrazení obsahu. Bez nich web nemůže fungovat správně.',
144                  linkedCategory: 'necessary'
145                },
146                {
147                  title: 'Analytické cookies',
148                  description: 'Pomáhají nám anonymně měřit návštěvnost a porozumět tomu, jak návštěvníci web používají.',
149                  linkedCategory: 'analytics'
150                },
151                {
152                  title: 'Marketingové cookies',
153                  description: 'Umožňují vyhodnocovat kampaně a zobrazovat relevantnější marketingová sdělení a reklamu.',
154                  linkedCategory: 'marketing'
155                }
156              ]
157            }
158          },
159          en: {
160            consentModal: {
161              title: 'We use cookies',
162              description: 'We use cookies for basic website functionality and anonymous traffic measurement. You can change your settings at any time.',
163              acceptAllBtn: 'Accept all',
164              acceptNecessaryBtn: 'Reject optional',
165              showPreferencesBtn: 'Adjust settings'
166            },
167            preferencesModal: {
168              title: 'Cookie settings',
169              acceptAllBtn: 'Accept all',
170              acceptNecessaryBtn: 'Reject optional',
171              savePreferencesBtn: 'Save settings',
172              closeIconLabel: 'Close',
173              sections: [
174                {
175                  title: 'We use cookies',
176                  description: 'Some cookies are essential for the website to function properly. We only use others with your consent for anonymous traffic measurement and marketing.'
177                },
178                {
179                  title: 'Essential cookies',
180                  description: 'These cookies ensure basic website functionality, security, and correct display of content. The website cannot function properly without them.',
181                  linkedCategory: 'necessary'
182                },
183                {
184                  title: 'Analytics cookies',
185                  description: 'They help us anonymously measure traffic and understand how visitors use the website.',
186                  linkedCategory: 'analytics'
187                },
188                {
189                  title: 'Marketing cookies',
190                  description: 'They allow us to evaluate campaigns and display more relevant marketing messages and advertisements.',
191                  linkedCategory: 'marketing'
192                }
193              ]
194            }
195          },
196          de: {
197            consentModal: {
198              title: 'Wir verwenden Cookies',
199              description: 'Wir verwenden Cookies für grundlegende Website-Funktionen und anonyme Besuchermessung. Sie können Ihre Einstellungen jederzeit ändern.',
200              acceptAllBtn: 'Alle akzeptieren',
201              acceptNecessaryBtn: 'Optionale ablehnen',
202              showPreferencesBtn: 'Einstellungen anpassen'
203            },
204            preferencesModal: {
205              title: 'Cookie-Einstellungen',
206              acceptAllBtn: 'Alle akzeptieren',
207              acceptNecessaryBtn: 'Optionale ablehnen',
208              savePreferencesBtn: 'Einstellungen speichern',
209              closeIconLabel: 'Schließen',
210              sections: [
211                {
212                  title: 'Wir verwenden Cookies',
213                  description: 'Einige Cookies sind für das ordnungsgemäße Funktionieren der Website unerlässlich. Andere verwenden wir nur mit Ihrer Zustimmung für anonyme Besuchermessung und Marketing.'
214                },
215                {
216                  title: 'Notwendige Cookies',
217                  description: 'Diese Cookies gewährleisten grundlegende Website-Funktionen, Sicherheit und die korrekte Anzeige von Inhalten. Ohne sie kann die Website nicht richtig funktionieren.',
218                  linkedCategory: 'necessary'
219                },
220                {
221                  title: 'Analytische Cookies',
222                  description: 'Sie helfen uns, den Datenverkehr anonym zu messen und zu verstehen, wie Besucher die Website nutzen.',
223                  linkedCategory: 'analytics'
224                },
225                {
226                  title: 'Marketing-Cookies',
227                  description: 'Sie ermöglichen es uns, Kampagnen auszuwerten und relevantere Marketingbotschaften und Werbung anzuzeigen.',
228                  linkedCategory: 'marketing'
229                }
230              ]
231            }
232          }
233        }
234      },
235      onFirstConsent: function (context) {
236        // User clicked accept/reject for the first time
237        pushConsentEvent(cc, context && context.cookie ? context.cookie : null, true);
238      },
239      onConsent: function (context) {
240        // Fires on every page load for returning visitors — do NOT fire update
241        pushConsentEvent(cc, context && context.cookie ? context.cookie : null, false);
242      },
243      onChange: function (context) {
244        // User changed preferences — fire update
245        pushConsentEvent(cc, context && context.cookie ? context.cookie : null, true);
246      }
247    });
248
249    /*
250      Google Tag Manager:
251      V GTM nepoužívejte pro GA4, Google Ads ani jiné měřicí/marketingové tagy trigger "All Pages".
252      Všechny měřicí tagy mají být navázané pouze na Custom Event trigger s názvem "cookies_accepted".
253      Tím zajistíte, že se žádné nepovinné měření nespustí bez souhlasu návštěvníka.
254    */
255  }
256
257  if (document.readyState === 'loading') {
258    document.addEventListener('DOMContentLoaded', initCookieConsent);
259  } else {
260    initCookieConsent();
261  }
262}());

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.