PageSourceSearch

https://www.incode.com/js/behaviors/highlights-ticker.js

js incode.com collected 2026-10-02 03:55:49 UTC 9,741 bytes, 200 lines download raw bytes

1(function() {
2    if (window.__b_hlTicker) return;
3    window.__b_hlTicker = true;
4    function init() {
5        var reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
6        var ticker = document.querySelector("[data-x3-ticker]");
7        if (ticker) {
8            var tLines = [].slice.call(ticker.querySelectorAll("[data-x3-ticker-line]"));
9            var tCards = [].slice.call(ticker.querySelectorAll("[data-x3-ticker-card]"));
10            var tCounts = [].slice.call(ticker.querySelectorAll("[data-x3-ticker-count]"));
11            var tToggle = ticker.querySelector("[data-x3-ticker-toggle]");
12            var tPanel = ticker.querySelector("[data-x3-ticker-panel]");
13            var tScrim = ticker.querySelector("[data-x3-ticker-scrim]");
14            var tPrev = ticker.querySelector("[data-x3-ticker-prev]");
15            var tNext = ticker.querySelector("[data-x3-ticker-next]");
16            var tActive = 0;
17            var tOpen = false;
18            var tTimer = null;
19            var tHold = false;
20            function pad(n) {
21                return n < 10 ? "0" + n : String(n);
22            }
23            function tShow(next) {
24                tLines.forEach(function(el, i) {
25                    el.classList.remove("is-leaving");
26                    if (i === tActive && i !== next) el.classList.add("is-leaving");
27                    el.classList.toggle("is-active", i === next);
28                });
29                tCards.forEach(function(el, i) {
30                    el.classList.toggle("is-active", i === next);
31                });
32                tActive = next;
33                tCounts.forEach(function(el) {
34                    el.textContent = pad(tActive + 1) + "/" + pad(tLines.length);
35                });
36            }
37            function tSchedule() {
38                window.clearTimeout(tTimer);
39                if (tHold || reduceMotion) return;
40                tTimer = window.setTimeout(function() {
41                    if (!document.hidden) tShow((tActive + 1) % tLines.length);
42                    tSchedule();
43                }, 5e3);
44            }
45            function tSyncNavShift() {
46                var root = document.documentElement;
47                root.classList.toggle("x3-hl-open", tOpen);
48                if (tOpen && tPanel) root.style.setProperty("--x3-hl-shift", ticker.offsetHeight + tPanel.offsetHeight + "px");
49            }
50            function tSetOpen(open) {
51                tOpen = open;
52                ticker.classList.toggle("is-open", open);
53                tSyncNavShift();
54                if (tToggle) {
55                    tToggle.setAttribute("aria-expanded", open ? "true" : "false");
56                    tToggle.setAttribute("aria-label", open ? "Collapse highlights" : "Expand highlights");
57                }
58                tSchedule();
59            }
60            var tBar = ticker.querySelector(".x3-ticker__bar");
61            if (tBar) tBar.addEventListener("click", function(e) {
62                var link = e.target.closest && e.target.closest("a");
63                if (link && (link.getAttribute("href") || "#") === "#") e.preventDefault();
64                tSetOpen(!tOpen);
65            });
66            if (tScrim) tScrim.addEventListener("click", function() {
67                tSetOpen(false);
68            });
69            var tClose = ticker.querySelector("[data-x3-ticker-close]");
70            if (tClose) tClose.addEventListener("click", function(e) {
71                e.stopPropagation();
72                tSetOpen(false);
73            });
74            document.addEventListener("keydown", function(e) {
75                if (e.key === "Escape" && tOpen) tSetOpen(false);
76            });
77            [].slice.call(document.querySelectorAll(".c-header__item--has-menu, .c-header__mega")).forEach(function(el) {
78                el.addEventListener("mouseenter", function() {
79                    if (tOpen) tSetOpen(false);
80                });
81            });
82            if (window.matchMedia("(hover: hover)").matches) [ tPrev, tNext ].forEach(function(btn) {
83                if (!btn) return;
84                btn.addEventListener("mouseenter", function() {
85                    tHold = true;
86                    window.clearTimeout(tTimer);
87                });
88                btn.addEventListener("mouseleave", function() {
89                    tHold = false;
90                    tSchedule();
91                });
92            });
93            if (tPrev) tPrev.addEventListener("click", function() {
94                tShow((tActive - 1 + tLines.length) % tLines.length);
95                tSchedule();
96            });
97            if (tNext) tNext.addEventListener("click", function() {
98                tShow((tActive + 1) % tLines.length);
99                tSchedule();
100            });
101            document.addEventListener("keydown", function(e) {
102                if (!tOpen) return;
103                var t = e.target;
104                if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable)) return;
105                if (e.key === "ArrowLeft") {
106                    e.preventDefault();
107                    tShow((tActive - 1 + tLines.length) % tLines.length);
108                    tSchedule();
109                } else if (e.key === "ArrowRight") {
110                    e.preventDefault();
111                    tShow((tActive + 1) % tLines.length);
112                    tSchedule();
113                }
114            });
115            function tDock() {
116                var scrolled = window.scrollY > 8;
117                document.documentElement.classList.toggle("x3-scrolled", scrolled);
118                if (scrolled && tOpen) tSetOpen(false);
119            }
120            window.addEventListener("scroll", tDock, {
121                passive: true
122            });
123            window.addEventListener("resize", function() {
124                if (tOpen) tSyncNavShift();
125            }, {
126                passive: true
127            });
128            tDock();
129            tSchedule();
130            var tAutoFrom = ticker.getAttribute("data-x3-ticker-autopen-from");
131            var tAutoUntil = ticker.getAttribute("data-x3-ticker-autopen-until");
132            var tAutoSlide = parseInt(ticker.getAttribute("data-x3-ticker-autopen-slide") || "", 10);
133            var tAtHome = /^\/(index\.html)?$/.test(window.location.pathname);
134            if (tAtHome && tAutoFrom && tAutoUntil && tAutoSlide >= 0 && tAutoSlide < tLines.length) {
135                var tNow = new Date;
136                var tToday = tNow.getFullYear() + "-" + pad(tNow.getMonth() + 1) + "-" + pad(tNow.getDate());
137                if (tToday >= tAutoFrom && tToday <= tAutoUntil) {
138                    var tPreview = /^(localhost|127\.0\.0\.1)$/.test(window.location.hostname);
139                    var tAutoKey = "x3HlAutoOpen:" + tAutoFrom;
140                    var tAutoSeen = false;
141                    try {
142                        tAutoSeen = !tPreview && !!window.localStorage.getItem(tAutoKey);
143                    } catch (e) {}
144                    if (!tAutoSeen) {
145                        var tAutoCancelled = false;
146                        var tAutoCancel = function(e) {
147                            var el = e.target;
148                            if (el && el.closest && el.closest('[id^="cookiescript"], [class^="cookiescript"], #CybotCookiebotDialog')) return;
149                            tAutoCancelled = true;
150                            [ "wheel", "touchstart", "pointerdown", "keydown", "scroll" ].forEach(function(ev) {
151                                window.removeEventListener(ev, tAutoCancel);
152                            });
153                        };
154                        [ "wheel", "touchstart", "pointerdown", "keydown", "scroll" ].forEach(function(ev) {
155                            window.addEventListener(ev, tAutoCancel, {
156                                passive: true
157                            });
158                        });
159                        window.setTimeout(function() {
160                            [ "wheel", "touchstart", "pointerdown", "keydown", "scroll" ].forEach(function(ev) {
161                                window.removeEventListener(ev, tAutoCancel);
162                            });
163                        }, 1600);
164                        window.setTimeout(function() {
165                            if (tAutoCancelled || document.hidden || tOpen || window.scrollY > 8) return;
166                            try {
167                                window.localStorage.setItem(tAutoKey, "1");
168                            } catch (e) {}
169                            ticker.classList.add("is-auto");
170                            tShow(tAutoSlide);
171                            tSetOpen(true);
172                            window.setTimeout(function() {
173                                ticker.classList.remove("is-auto");
174                            }, 900);
175                        }, 1500);
176                    }
177                }
178            }
179            document.addEventListener("visibilitychange", function() {
180                if (document.hidden) return;
181                tLines.forEach(function(el) {
182                    el.style.transition = "none";
183                    el.classList.remove("is-leaving");
184                    el.classList.toggle("is-active", tLines.indexOf(el) === tActive);
185                });
186                void ticker.offsetHeight;
187                window.requestAnimationFrame(function() {
188                    tLines.forEach(function(el) {
189                        el.style.transition = "";
190                    });
191                });
192            });
193        }
194    }
195    if (document.readyState === "loading") {
196        document.addEventListener("DOMContentLoaded", init);
197    } else {
198        init();
199    }
200})();

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.