PageSourceSearch

https://www.moonshadow.hu/js/scripts.js?v=20260921-3

js moonshadow.hu collected 2026-10-08 20:31:36 UTC 3,950 bytes, 96 lines download raw bytes

1'use strict';
2(() => {
3  const consentName = 'moonshadow_cookie_consent';
4  const cookieBanner = document.querySelector('.cookie-banner');
5  const cookieSettings = document.querySelector('.cookie-settings');
6  const getConsent = () => {
7    const prefix = `${consentName}=`;
8    const entry = document.cookie.split('; ').find((item) => item.startsWith(prefix));
9    return entry ? decodeURIComponent(entry.slice(prefix.length)) : null;
10  };
11  const publishConsent = (choice) => {
12    window.dispatchEvent(new CustomEvent('moonshadow:cookie-consent', {
13      detail: { choice, optionalCookiesAllowed: choice === 'accepted' }
14    }));
15  };
16  const saveConsent = (choice) => {
17    const secure = location.protocol === 'https:' ? '; Secure' : '';
18    document.cookie = `${consentName}=${encodeURIComponent(choice)}; Max-Age=31536000; Path=/; SameSite=Lax${secure}`;
19    if (cookieBanner) cookieBanner.hidden = true;
20    publishConsent(choice);
21  };
22  if (cookieBanner) {
23    const savedConsent = getConsent();
24    cookieBanner.hidden = Boolean(savedConsent);
25    cookieBanner.querySelector('.cookie-accept')?.addEventListener('click', () => saveConsent('accepted'));
26    cookieBanner.querySelector('.cookie-reject')?.addEventListener('click', () => saveConsent('rejected'));
27    if (savedConsent) publishConsent(savedConsent);
28  }
29  cookieSettings?.addEventListener('click', () => {
30    if (!cookieBanner) return;
31    cookieBanner.hidden = false;
32    cookieBanner.querySelector('.cookie-accept')?.focus();
33  });
34
35  const toggle = document.querySelector('.menu-toggle');
36  const nav = document.querySelector('.main-nav');
37  if (toggle && nav) {
38    toggle.addEventListener('click', () => {
39      const open = nav.classList.toggle('is-open');
40      toggle.setAttribute('aria-expanded', String(open));
41    });
42    nav.addEventListener('click', (event) => {
43      if (event.target.matches('a')) {
44        nav.classList.remove('is-open');
45        toggle.setAttribute('aria-expanded', 'false');
46      }
47    });
48  }
49  const compare = document.querySelector('.quick-compare');
50  if (compare) {
51    const buttons = [...compare.querySelectorAll('[data-max-hours]')];
52    const rows = [...compare.querySelectorAll('tbody tr[data-hours]')];
53    const status = compare.querySelector('.compare-status');
54    buttons.forEach((button) => {
55      button.addEventListener('click', () => {
56        const limit = button.dataset.maxHours;
57        let visible = 0;
58        buttons.forEach((item) => {
59          const active = item === button;
60          item.classList.toggle('is-active', active);
61          item.setAttribute('aria-pressed', String(active));
62        });
63        rows.forEach((row) => {
64          const show = limit === 'all' || Number(row.dataset.hours) <= Number(limit);
65          row.hidden = !show;
66          if (show) visible += 1;
67        });
68        if (status) status.textContent = `${visible} kaszinó látható.`;
69      });
70    });
71  }
72  const iframe = document.getElementById('casino-widget-iframe');
73  if (iframe) {
74    window.addEventListener('message', (event) => {
75      if (event.source !== iframe.contentWindow) return;
76      let data = event.data;
77      if (typeof data === 'string') {
78        try { data = JSON.parse(data); } catch (_) { return; }
79      }
80      if (!data || data.type !== 'casino-widget-height') return;
81      const height = Number(data.height);
82      if (Number.isFinite(height) && height >= 300 && height <= 20000) iframe.style.height = `${Math.ceil(height)}px`;
83    });
84  }
85  document.addEventListener('click', (event) => {
86    const button = event.target.closest('.referral-btn');
87    if (!button || !button.dataset.casinoUrl) return;
88    event.preventDefault();
89    const params = new URLSearchParams({
90      name: button.dataset.casinoName || '',
91      url: button.dataset.casinoUrl,
92      img: button.dataset.casinoImg || ''
93    });
94    window.open(`/to-casino?${params.toString()}`, '_blank', 'noopener');
95  });
96})();

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.