PageSourceSearch

https://www.mahn.ch/typo3temp/assets/compressed/Cookies-41d27c8db8c0c31cdda5d3ab63a92e68.js?1783333228

js mahn.ch collected 2026-10-02 10:13:30 UTC 4,434 bytes, 143 lines download raw bytes

1window.addEventListener("load", function() {
2    var lauchGa = function() {
3        (function(i, s, o, g, r, a, m) {
4            i['GoogleAnalyticsObject'] = r;
5            i[r] = i[r] || function() {
6                (i[r].q = i[r].q || []).push(arguments)
7            }, i[r].l = 1 * new Date();
8            a = s.createElement(o),
9                m = s.getElementsByTagName(o)[0];
10            a.async = 1;
11            a.src = g;
12            m.parentNode.insertBefore(a, m)
13        })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
14
15        // Prod
16        ga('create', 'UA-8586345-13', 'auto');
17
18        // Pour les tests
19        //ga('create', 'UA-8586345-2', 'auto');
20        ga('send', 'pageview');
21    };
22    var deleteCookie = function(name) {
23
24        var hostname = window.location.hostname;
25        var firstPoint = hostname.indexOf('.');
26
27        // Le nom de domaine mis par GA est du style .neuchatelville.ch, alors qu'on est sur www.neuchatelville.ch
28        var cookieDomain = hostname.substr(firstPoint);
29
30        document.cookie = name + '=; Path=/; Domain=' + cookieDomain + '; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
31    };
32
33    /**
34     * Suppression des cookies mis précédemment par Google Analytics
35     */
36    var deleteGaCookies = function() {
37        deleteCookie('_ga');
38        deleteCookie('_gid');
39        deleteCookie('__atuvc');
40        deleteCookie('__atuvs');
41    };
42
43    /**
44     * Suppession de tous les iFrames, pour les embed Youtube et Facebook
45     */
46    var removeAlliFrames = function() {
47        var iframes = document.querySelectorAll('iframe');
48        for (var i = 0; i < iframes.length; i++) {
49            iframes[i].parentNode.removeChild(iframes[i]);
50        }
51    };
52
53    var _popup;
54
55    var language = $('html').attr('lang');
56    var labels = typeof window.cookieconsentLabels[language] !== 'undefined' ? window.cookieconsentLabels[language] : window.cookieconsentLabels['fr'];
57
58    /**
59     * Gestion de la "popup" de consentement pour les cookies et tracking
60     */
61    window.cookieconsent.initialise({
62        "palette": {
63            "popup": {
64                "text": "#ffffff"
65            },
66            "button": {
67                "background": "#000"
68            }
69        },
70        "content": {
71            "message": labels.message,
72            "dismiss": labels.dismiss,
73            "deny": labels.deny,
74            "link": labels.link,
75            "href": labels.href,
76            "allow": labels.allow,
77            "policy": labels.policy
78        },
79        "showLink": true,
80        "type": "opt-out",
81        "revokable": false,
82        "cookie": {
83            "name": "consentGDPR"
84        },
85
86        /**
87         * Appelé au chargement de la page
88         * @param status
89         */
90        onInitialise: function(status) {
91            var type = this.options.type;
92            var didConsent = this.hasConsented();
93
94            if (type == 'opt-in' && didConsent) {
95                //console.log("onInitialize, opt-in enable cookies")
96            }
97            if (type == 'opt-out' && !didConsent) {
98                //console.log("onInitialize, opt-out disable cookies")
99            }
100
101            if (didConsent) {
102                lauchGa();
103            } else {
104                // removeAlliFrames();
105            }
106        },
107
108        /**
109         * Appelé au clic sur "J'accepte" ou "Je refuse"
110         * @param status
111         * @param chosenBefore
112         */
113        onStatusChange: function(status, chosenBefore) {
114            var type = this.options.type;
115            var didConsent = this.hasConsented();
116
117            if (type == 'opt-in' && didConsent) {
118                //console.log("onStatusChange, opt-in enable cookies")
119            }
120            if (type == 'opt-out' && !didConsent) {
121                console.log("onStatusChange, opt-out disable cookies")
122
123                deleteGaCookies();
124                // removeAlliFrames();
125
126            }
127        },
128
129        onRevokeChoice: function() {
130            var type = this.options.type;
131            if (type == 'opt-in') {
132                //console.log("onRevokeChoice, opt-in disable cookies")
133            }
134            if (type == 'opt-out') {
135                //console.log("onRevokeChoice, opt-out enable cookies")
136            }
137        }
138    }, function(popup) {
139        _popup = popup;
140    }, function(err) {
141        console.error(err);
142    });
143});

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.