PageSourceSearch

https://www.pesterlloyd.net/wp-content/themes/mission-news-child/js/kofi-overrides.js?ver=1772118354

js pesterlloyd.net collected 2026-09-24 22:45:10 UTC 3,973 bytes, 153 lines download raw bytes

1(function () {
2  "use strict";
3
4  var MAX_RUNS = 60;
5  var RUN_INTERVAL_MS = 500;
6  var runCount = 0;
7  var timerId = null;
8  var supportButtonId = "pl-support-floating-btn";
9  var defaultSupportUrl = "https://www.pesterlloyd.net/unterstutzen";
10  var LEFT_OFFSET = 16;
11  var BOTTOM_OFFSET = 16;
12  var STACK_GAP = 6;
13  var bubbleClickBound = false;
14
15  function hideKofiFloatingWidgets() {
16    var selectors = [
17      'iframe[src*="ko-fi.com"]',
18      'iframe[src*="storage.ko-fi.com"]',
19      '[class*="kofi"]',
20      '[id*="kofi"]',
21      '[class*="ko-fi"]',
22      '[id*="ko-fi"]',
23      ".floatingchat-container-wrap",
24      ".floating-chat-container-wrap",
25    ];
26
27    document.querySelectorAll(selectors.join(", ")).forEach(function (node) {
28      if (node && node.style) {
29        node.style.display = "none";
30        node.style.visibility = "hidden";
31        node.style.opacity = "0";
32        node.style.pointerEvents = "none";
33      }
34    });
35  }
36
37  function getSupportUrl() {
38    var kofiLink = document.querySelector('a[href*="ko-fi.com"]');
39    if (kofiLink && kofiLink.href) {
40      return kofiLink.href;
41    }
42    return defaultSupportUrl;
43  }
44
45  function ensureCustomSupportButton() {
46    var btn = document.getElementById(supportButtonId);
47    if (!btn) {
48      btn = document.createElement("a");
49      btn.id = supportButtonId;
50      btn.className = "pl-support-floating-btn";
51      btn.target = "_blank";
52      btn.rel = "noopener noreferrer";
53      btn.textContent = "PL Unterstützen";
54      document.body.appendChild(btn);
55    }
56
57    btn.style.position = "fixed";
58    btn.style.left = LEFT_OFFSET + "px";
59    btn.style.right = "auto";
60    btn.style.bottom = BOTTOM_OFFSET + "px";
61    btn.style.zIndex = "2147483646";
62    btn.href = getSupportUrl();
63    return btn;
64  }
65
66  function positionWpDiscuzAboveSupportButton() {
67    var supportBtn = document.getElementById(supportButtonId);
68    var bubble = document.getElementById("wpd-bubble-wrapper");
69
70    if (!supportBtn || !bubble) {
71      return;
72    }
73
74    var supportBottom = BOTTOM_OFFSET;
75    var gap = STACK_GAP;
76    var bubbleBottom = supportBottom + supportBtn.offsetHeight + gap;
77
78    bubble.style.position = "fixed";
79    bubble.style.left = LEFT_OFFSET + "px";
80    bubble.style.right = "auto";
81    bubble.style.bottom = bubbleBottom + "px";
82    bubble.style.display = "block";
83    bubble.style.visibility = "visible";
84    bubble.style.opacity = "1";
85    bubble.style.zIndex = "2147483647";
86  }
87
88  function run() {
89    hideKofiFloatingWidgets();
90    ensureCustomSupportButton();
91    positionWpDiscuzAboveSupportButton();
92  }
93
94  function scrollToWpDiscuz() {
95    var comments = document.getElementById("wpdcom");
96    if (!comments) {
97      return;
98    }
99
100    var targetY = comments.getBoundingClientRect().top + window.pageYOffset - 32;
101    window.scrollTo({
102      top: Math.max(0, targetY),
103      behavior: "smooth",
104    });
105  }
106
107  function bindWpDiscuzBubbleFallback() {
108    if (bubbleClickBound) {
109      return;
110    }
111
112    document.addEventListener("click", function (event) {
113      var bubbleButton = event.target.closest("#wpd-bubble, #wpd-bubble-count");
114      if (!bubbleButton) {
115        return;
116      }
117
118      // Keep WPDiscuz native behavior for "new comments" count bubble.
119      if (
120        bubbleButton.id === "wpd-bubble-count" &&
121        bubbleButton.classList.contains("wpd-new-comments")
122      ) {
123        return;
124      }
125
126      window.setTimeout(scrollToWpDiscuz, 0);
127    });
128
129    bubbleClickBound = true;
130  }
131
132  function start() {
133    if (timerId) {
134      return;
135    }
136
137    bindWpDiscuzBubbleFallback();
138    run();
139
140    timerId = window.setInterval(function () {
141      run();
142      runCount += 1;
143      if (runCount >= MAX_RUNS) {
144        window.clearInterval(timerId);
145        timerId = null;
146      }
147    }, RUN_INTERVAL_MS);
148  }
149
150  document.addEventListener("DOMContentLoaded", start);
151  window.addEventListener("load", start);
152  window.addEventListener("resize", run);
153})();

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.