PageSourceSearch

https://www.casopisveteran.sk/wp-content/themes/Newspaper-child/js/newsletter-timed-popup.js?ver=1772811893

js casopisveteran.sk collected 2026-10-09 04:44:11 UTC 2,014 bytes, 72 lines download raw bytes

1(function () {
2  const TRIGGER_SELECTOR = ".newsletter-timed-popup";
3  const OPEN_DELAY_MS = 15000;
4  const LAST_SHOWN_KEY = "td_popup_newsletter_last_shown";
5  const DAYS_BETWEEN_SHOWS = 30; // 30 days
6  
7  let openTimer = null;
8
9  function lsGet(k) { try { return localStorage.getItem(k); } catch { return null; } }
10  function lsSet(k, v) { try { localStorage.setItem(k, v); } catch {} }
11
12  function shouldShow() {
13    const lastShown = lsGet(LAST_SHOWN_KEY);
14    if (!lastShown) return true;
15    
16    const daysSince = (Date.now() - parseInt(lastShown)) / (1000 * 60 * 60 * 24);
17    return daysSince >= DAYS_BETWEEN_SHOWS;
18  }
19
20  function markShown() {
21    lsSet(LAST_SHOWN_KEY, Date.now().toString());
22    if (openTimer) {
23      clearTimeout(openTimer);
24      openTimer = null;
25    }
26  }
27
28  document.addEventListener("click", function (e) {
29    const t = e.target;
30    if (
31      t.closest(".tdm-pmh-close") ||
32      t.closest(".td-icon-modal-close") ||
33      t.closest("[class*='modal-close']") ||
34      t.closest("button.mfp-close") ||
35      t.closest("[aria-label='Close']") ||
36      t.classList.contains("mfp-close") ||
37      t.closest(".mfp-close")
38    ) {
39      markShown();
40    }
41  }, true);
42
43  document.addEventListener("keydown", function (e) {
44    if (e.key === "Escape" || e.key === "Esc") {
45      markShown();
46    }
47  }, true);
48
49  function clickTrigger() {
50    const trigger = document.querySelector(TRIGGER_SELECTOR);
51    if (!trigger) return;
52
53    const link =
54      trigger.querySelector("a.tds-button1") ||
55      trigger.querySelector("a") ||
56      trigger.querySelector("button");
57
58    if (!link) return;
59
60    link.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true, view: window }));
61  }
62
63  if (!shouldShow()) return;
64
65  window.addEventListener("load", function () {
66    openTimer = setTimeout(function () {
67      if (!shouldShow()) return;
68      clickTrigger();
69    }, OPEN_DELAY_MS);
70  });
71})();
72

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.