PageSourceSearch

https://www.stadtwerke-wernigerode.de/_Resources/Static/Packages/W…/JavaScript/map-consent.js?v=202610010300

js stadtwerke-wernigerode.de collected 2026-10-04 13:26:30 UTC 3,191 bytes, 77 lines download raw bytes

1(function () {
2    'use strict';
3
4    var authenticationFailed = false;
5    var previousAuthFailure = window.gm_authFailure;
6
7    function rewriteLegacyConsentLinks() {
8        document.querySelectorAll('a[href]').forEach(function (link) {
9            if (!/^\s*javascript:\s*Cookiebot\.renew\(\)\s*;?\s*$/i.test(link.getAttribute('href'))) {
10                return;
11            }
12            link.setAttribute('href', '#CCM.openWidget');
13            link.addEventListener('click', function (event) {
14                if (window.CCM && typeof window.CCM.openWidget === 'function') {
15                    event.preventDefault();
16                    event.stopPropagation();
17                    window.CCM.openWidget();
18                }
19            });
20        });
21    }
22
23    function updateMaps() {
24        document.querySelectorAll('.map-wrapper').forEach(function (wrapper) {
25            var notice = wrapper.querySelector('.cookieconsent-optout-marketing');
26            var map = wrapper.querySelector('.MapContainer');
27            if (!notice || !map) {
28                return;
29            }
30
31            if (authenticationFailed) {
32                if (notice.dataset.mapError) {
33                    return;
34                }
35                notice.dataset.mapError = 'authentication';
36                notice.hidden = false;
37                notice.style.display = 'block';
38                notice.setAttribute('role', 'status');
39                if (window.location.hostname.endsWith('.ddev.site')) {
40                    notice.textContent = 'Google Maps ist für diese lokale Vorschau nicht freigeschaltet. ';
41                    var link = document.createElement('a');
42                    link.href = 'https://www.stadtwerke-wernigerode.de' + window.location.pathname;
43                    link.target = '_blank';
44                    link.rel = 'noopener';
45                    link.textContent = 'Karte auf der öffentlichen Website ansehen';
46                    notice.appendChild(link);
47                } else {
48                    notice.textContent = 'Die Karte kann derzeit nicht geladen werden. Bitte versuchen Sie es später erneut.';
49                }
50                return;
51            }
52
53            // CCM19 controls script execution; Cookiebot's old opt-out CSS is not emulated.
54            // Remove the old notice only once Google has actually created the map.
55            var rendered = Boolean(map.querySelector('.gm-style'));
56            notice.hidden = rendered;
57            notice.style.display = rendered ? 'none' : '';
58        });
59    }
60
61    // Registered in the head, before any map scripts from Neos HTML content can run.
62    window.gm_authFailure = function () {
63        authenticationFailed = true;
64        updateMaps();
65        if (typeof previousAuthFailure === 'function') {
66            previousAuthFailure();
67        }
68    };
69
70    document.addEventListener('DOMContentLoaded', function () {
71        rewriteLegacyConsentLinks();
72        updateMaps();
73        document.querySelectorAll('.map-wrapper .MapContainer').forEach(function (map) {
74            new MutationObserver(updateMaps).observe(map, { childList: true, subtree: true });
75        });
76    });
77}());

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.