PageSourceSearch

https://zongoraszalon.hu/assets/js/zs-consent.js?v=2

js zongoraszalon.hu collected 2026-10-08 03:16:25 UTC 3,485 bytes, 78 lines download raw bytes

1/* zongoraszalon.hu – süti-beleegyezés + GA4 Consent Mode v2
2   A gtag('consent','default', denied) már a head-ben lefutott a config előtt.
3   Ez a fájl: kezeli a korábbi döntést, betölti a GA4 configot (cookieless, amíg
4   nincs elfogadás), és megjeleníti a süti-sávot, ha még nincs döntés. */
5(function () {
6  var GA_ID = 'G-LHXJHK1G2S';
7  var KEY = 'zs-consent';
8
9  function gtag() { window.dataLayer.push(arguments); }
10
11  var choice = null;
12  try { choice = localStorage.getItem(KEY); } catch (e) {}
13
14  if (choice === 'granted') {
15    gtag('consent', 'update', { 'analytics_storage': 'granted' });
16  }
17
18  // A config mindig lefut, így a mérőkód „aktív"; elutasításkor süti nélkül (cookieless) mér.
19  gtag('config', GA_ID, { 'anonymize_ip': true });
20
21  // Ha már döntött, nincs sáv.
22  if (choice === 'granted' || choice === 'denied') { return; }
23
24  function setChoice(val) {
25    try { localStorage.setItem(KEY, val); } catch (e) {}
26    if (val === 'granted') {
27      gtag('consent', 'update', { 'analytics_storage': 'granted' });
28    }
29    var bar = document.getElementById('zs-cookie');
30    if (bar) { bar.parentNode.removeChild(bar); }
31  }
32
33  function build() {
34    if (document.getElementById('zs-cookie')) { return; }
35
36    var css = document.createElement('style');
37    css.textContent =
38      '#zs-cookie{position:fixed;left:0;right:0;bottom:0;z-index:99999;' +
39      'background:#1a1a1a;color:#f2f2f2;padding:16px 20px;' +
40      'box-shadow:0 -2px 18px rgba(0,0,0,.25);' +
41      'font-family:inherit;font-size:14px;line-height:1.5;}' +
42      '#zs-cookie .zs-cc-in{max-width:1200px;margin:0 auto;display:flex;' +
43      'align-items:center;gap:18px;flex-wrap:wrap;justify-content:center;}' +
44      '#zs-cookie p{margin:0;flex:1 1 360px;}' +
45      '#zs-cookie a{color:#e0c389;text-decoration:underline;}' +
46      '#zs-cookie .zs-cc-btns{display:flex;gap:10px;flex:0 0 auto;}' +
47      '#zs-cookie button{cursor:pointer;border:0;border-radius:6px;' +
48      'padding:10px 18px;font-size:14px;font-weight:600;font-family:inherit;}' +
49      '#zs-cookie .zs-cc-no{background:transparent;color:#cfcfcf;' +
50      'border:1px solid #555;}' +
51      '#zs-cookie .zs-cc-yes{background:#e0c389;color:#1a1a1a;}' +
52      '@media (max-width:575px){#zs-cookie .zs-cc-in{flex-direction:column;' +
53      'gap:14px;}#zs-cookie p{flex:0 0 auto;}#zs-cookie .zs-cc-btns{width:100%;}' +
54      '#zs-cookie button{flex:1;}}';
55    document.head.appendChild(css);
56
57    var bar = document.createElement('div');
58    bar.id = 'zs-cookie';
59    bar.setAttribute('role', 'dialog');
60    bar.setAttribute('aria-label', 'Süti-beállítások');
61    bar.innerHTML =
62      '<div class="zs-cc-in">' +
63      '<p>Sütiket használunk a weboldal működéséhez és – beleegyezéseddel – ' +
64      'névtelen látogatottsági statisztikához. Részletek az ' +
65      '<a href="/adatkezeles/">adatkezelési tájékoztatóban</a>.</p>' +
66      '<div class="zs-cc-btns">' +
67      '<button type="button" class="zs-cc-no">Elutasítom</button>' +
68      '<button type="button" class="zs-cc-yes">Elfogadom</button>' +
69      '</div></div>';
70    document.body.appendChild(bar);
71
72    bar.querySelector('.zs-cc-yes').addEventListener('click', function () { setChoice('granted'); });
73    bar.querySelector('.zs-cc-no').addEventListener('click', function () { setChoice('denied'); });
74  }
75
76  if (document.body) { build(); }
77  else { document.addEventListener('DOMContentLoaded', build); }
78})();

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.