PageSourceSearch

https://esdcybersecurity.eu/assets/js/rgpd.js

js esdcybersecurity.eu collected 2026-10-09 22:45:02 UTC 4,391 bytes, 98 lines download raw bytes

1/**
2 * ESD Cybersecurity — Bandeau RGPD + Google Tag Manager
3 * Conforme CNIL : consentement explicite avant chargement GTM
4 * GTM ID : GTM-55T6CKHL
5 */
6
7(function () {
8  'use strict';
9
10  var GTM_ID = 'GTM-55T6CKHL';
11
12  // ── Charger GTM après consentement ──────────────────────────
13  function loadGTM() {
14    if (window._gtm_loaded) return;
15    window._gtm_loaded = true;
16    window.dataLayer = window.dataLayer || [];
17    window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
18    var s = document.createElement('script');
19    s.async = true;
20    s.src = 'https://www.googletagmanager.com/gtm.js?id=' + GTM_ID;
21    document.head.appendChild(s);
22    // noscript fallback
23    var ns = document.createElement('noscript');
24    var iframe = document.createElement('iframe');
25    iframe.src = 'https://www.googletagmanager.com/ns.html?id=' + GTM_ID;
26    iframe.height = '0'; iframe.width = '0';
27    iframe.style.cssText = 'display:none;visibility:hidden';
28    ns.appendChild(iframe);
29    document.body.insertBefore(ns, document.body.firstChild);
30  }
31
32  // ── Créer le bandeau ────────────────────────────────────────
33  function createBanner() {
34    var style = document.createElement('style');
35    style.textContent = [
36      '#rgpd-banner{position:fixed;bottom:0;left:0;right:0;background:#071A3D;border-top:2px solid #355B9E;z-index:9999;padding:16px 24px;box-shadow:0 -4px 24px rgba(0,0,0,.4);font-family:\'Poppins\',sans-serif;font-size:13px;color:rgba(255,255,255,.85);animation:rgpd-up .3s ease}',
37      '@keyframes rgpd-up{from{transform:translateY(100%)}to{transform:translateY(0)}}',
38      '#rgpd-inner{max-width:1100px;margin:0 auto;display:flex;align-items:center;gap:24px;flex-wrap:wrap}',
39      '#rgpd-text{flex:1;min-width:240px;line-height:1.6;margin:0}',
40      '#rgpd-btns{display:flex;gap:10px;flex-shrink:0}',
41      '#rgpd-refuse{padding:8px 20px;border:1px solid rgba(255,255,255,.3);background:transparent;color:rgba(255,255,255,.7);border-radius:6px;cursor:pointer;font-size:13px;font-family:inherit;transition:border-color .2s}',
42      '#rgpd-refuse:hover{border-color:rgba(255,255,255,.6)}',
43      '#rgpd-accept{padding:8px 20px;border:none;background:#355B9E;color:#fff;border-radius:6px;cursor:pointer;font-size:13px;font-family:inherit;font-weight:600;transition:background .2s}',
44      '#rgpd-accept:hover{background:#2a4a80}'
45    ].join('');
46    document.head.appendChild(style);
47
48    var banner = document.createElement('div');
49    banner.id = 'rgpd-banner';
50    banner.setAttribute('role', 'dialog');
51    banner.setAttribute('aria-label', 'Gestion des cookies');
52    banner.innerHTML =
53      '<div id="rgpd-inner">' +
54        '<p id="rgpd-text"><strong>Cookies</strong> — Nous utilisons Google Analytics pour mesurer l\'audience de notre site. Ces données sont anonymisées. ' +
55        '<a href="/mentions.html" style="color:#7da8e8;">En savoir plus</a></p>' +
56        '<div id="rgpd-btns">' +
57          '<button id="rgpd-refuse" onclick="ESD_RGPD.refuse()">Refuser</button>' +
58          '<button id="rgpd-accept" onclick="ESD_RGPD.accept()">Accepter</button>' +
59        '</div>' +
60      '</div>';
61    document.body.appendChild(banner);
62  }
63
64  function hideBanner() {
65    var b = document.getElementById('rgpd-banner');
66    if (b) b.remove();
67  }
68
69  // ── API publique ─────────────────────────────────────────────
70  window.ESD_RGPD = {
71    accept: function () {
72      localStorage.setItem('esd_rgpd', 'accepted');
73      hideBanner();
74      loadGTM();
75    },
76    refuse: function () {
77      localStorage.setItem('esd_rgpd', 'refused');
78      hideBanner();
79    }
80  };
81
82  // ── Init ─────────────────────────────────────────────────────
83  function init() {
84    var consent = localStorage.getItem('esd_rgpd');
85    if (consent === 'accepted') {
86      loadGTM();
87    } else if (!consent) {
88      createBanner();
89    }
90    // Si 'refused' : rien ne charge
91  }
92
93  if (document.readyState === 'loading') {
94    document.addEventListener('DOMContentLoaded', init);
95  } else {
96    init();
97  }
98})();

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.