PageSourceSearch

https://gronde.eu/js/deferred-loaders.js

js gronde.eu collected 2026-10-06 12:51:18 UTC 4,443 bytes, 103 lines download raw bytes

1(function () {
2        var injected = false;
3        function injectCmp() {
4          if (injected) return;
5          injected = true;
6          var loader = document.createElement('script');
7          loader.id = 'usercentrics-cmp';
8          loader.async = true;
9          loader.setAttribute('data-settings-id', 'SDyeKKwxObHp0f');
10          loader.setAttribute('data-language', 'de');
11          loader.src = 'https://web.cmp.usercentrics.eu/ui/loader.js';
12          document.head.appendChild(loader);
13
14          var block = document.createElement('script');
15          block.async = true;
16          block.src = 'https://privacy-proxy.usercentrics.eu/latest/uc-block.bundle.js';
17          document.head.appendChild(block);
18        }
19        // Expose a manual trigger for app code (consent.ts, GoogleMap, etc.).
20        window.__loadCmp = injectCmp;
21
22        // Brevo SDK — CONSENT-GATED (TTDSG § 25 / GDPR Art. 6). The SDK sets
23        // tracking identifiers, so it must never load before the visitor has
24        // granted external-services consent in the CMP. It is injected only
25        // when src/lib/consent.ts calls window.__loadBrevo() after consent.
26        // Do NOT re-add interaction/idle auto-injection here.
27        var brevoInjected = false;
28        function injectBrevo() {
29          if (brevoInjected) return;
30          brevoInjected = true;
31          var s = document.createElement('script');
32          s.async = true;
33          s.src = 'https://cdn.brevo.com/js/sdk-loader.js';
34          document.head.appendChild(s);
35        }
36        window.__loadBrevo = injectBrevo;
37
38
39
40        // Detect returning visitors who have already made a consent choice.
41        // Usercentrics v2 persists these keys in localStorage after the user
42        // interacts with the banner. We also accept any legacy cookie/key just
43        // in case the implementation version changes.
44        function hasStoredConsent() {
45          try {
46            var ls = window.localStorage;
47            if (ls) {
48              if (ls.getItem('uc_user_interaction') === 'true') return true;
49              if (ls.getItem('uc_settings')) return true;
50              for (var i = 0; i < ls.length; i++) {
51                var k = ls.key(i) || '';
52                if (k.indexOf('uc_') === 0 && ls.getItem(k)) return true;
53              }
54            }
55            if (document.cookie && /(?:^|;\s*)(usercentrics|uc_settings|uc-consent)=/i.test(document.cookie)) {
56              return true;
57            }
58          } catch (e) { /* storage blocked — treat as first-time */ }
59          return false;
60        }
61
62        // First user interaction always wakes the CMP — covers both cohorts.
63        var events = ['pointerdown', 'keydown', 'scroll', 'touchstart'];
64        events.forEach(function (ev) {
65          window.addEventListener(ev, injectCmp, { once: true, passive: true, capture: true });
66        });
67
68        // First-time visitors only: auto-inject well after first paint so the
69        // banner never wins LCP. Timing tuned to land AFTER a real hero image
70        // has painted on mid-range mobile: wait for `load`, then a 6s spacer,
71        // then request an idle callback with a 10s outer timeout. Any real
72        // user interaction still wakes the CMP instantly via the listeners
73        // above.
74        if (!hasStoredConsent()) {
75          function scheduleAfterPaint() {
76            setTimeout(function () {
77              if (window.requestIdleCallback) {
78                window.requestIdleCallback(injectCmp, { timeout: 10000 });
79              } else {
80                setTimeout(injectCmp, 6000);
81              }
82            }, 6000);
83          }
84          if (document.readyState === 'complete') {
85            scheduleAfterPaint();
86          } else {
87            window.addEventListener('load', scheduleAfterPaint, { once: true });
88          }
89        } else {
90          // Returning visitors: load the CMP (no banner shown) shortly after
91          // `load` so their stored choices apply without needing a click.
92          function loadReturning() {
93            if (window.requestIdleCallback) {
94              window.requestIdleCallback(injectCmp, { timeout: 3000 });
95            } else {
96              setTimeout(injectCmp, 1500);
97            }
98          }
99          if (document.readyState === 'complete') loadReturning();
100          else window.addEventListener('load', loadReturning, { once: true });
101        }
102
103      })();

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.