PageSourceSearch

https://canoetribe.com/wp-content/plugins/tbx-plugin/blox/topbar/script.js?ver=1790633312

js canoetribe.com collected 2026-09-29 00:54:38 UTC 3,219 bytes, 86 lines download raw bytes

1tb.onRootElementReady((tbRootElement) => {
2    let interval = false;
3
4    let closeBtn = document.querySelector('.js-tb-topbar__close');
5    if (closeBtn) {
6        closeBtn.addEventListener('click', (e) => {
7            closeBtn.parentElement.parentElement.remove();
8
9            // clear the interval
10            clearInterval(interval);
11        });
12    }
13
14    function parseDate(dateString) {
15        const [day, month, yearTime] = dateString.split('/');
16        const [year, time, pm] = yearTime.split(' ');
17
18        const [hour, minute] = time.split(':');
19        const isPM = pm.toLowerCase().replace(/\./g, '') === 'pm'; // the DE php format outputs "p.m.", so we remove dots
20
21        let parsedHour = parseInt(hour, 10);
22
23        // Adjust for AM/PM
24        if (isPM && parsedHour !== 12) {
25            parsedHour = (parsedHour + 12) % 24;
26        } else if (!isPM && parsedHour === 12) {
27            parsedHour = 0;
28        }
29
30        const parsedMonth = parseInt(month, 10) - 1; // Months are 0-based in JavaScript Dates
31
32        return new Date(year, parsedMonth, day, parsedHour, parseInt(minute, 10));
33    }
34
35    function updateCountdown() {
36        const countdownDateAttribute = document.querySelector('.tb-countdown__container').dataset.countdownDate;
37
38        // Parse the date using the custom parseDate function
39        const countdownDate = parseDate(countdownDateAttribute);
40
41        const now = new Date();
42        const timeDifference = countdownDate - now;
43
44        // if the countdown is over, clear the interval
45        let days = 0;
46        let hours = 0;
47        let minutes = 0;
48        let seconds = 0;
49
50        if (timeDifference > 0) {
51            days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
52            hours = Math.floor((timeDifference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
53            minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
54            seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
55        } else {
56            clearInterval(interval);
57        }
58
59        // Update the countdown by creating separate spans for each digit
60        updateDigit('[data-countdown-name="days"] .tb-countdown__numbers', days);
61        updateDigit('[data-countdown-name="hours"] .tb-countdown__numbers', hours);
62        updateDigit('[data-countdown-name="minutes"] .tb-countdown__numbers', minutes);
63        updateDigit('[data-countdown-name="seconds"] .tb-countdown__numbers', seconds);
64    }
65
66    function updateDigit(selector, value) {
67        const digitContainer = document.querySelector(selector);
68        digitContainer.innerHTML = ''; // Clear previous content
69
70        const digits = value.toString().padStart(2, '0').split(''); // Ensure 2 digits with leading zeros
71
72        digits.forEach((digit) => {
73            const digitSpan = document.createElement('span');
74            digitSpan.innerText = digit;
75            digitContainer.appendChild(digitSpan);
76        });
77    }
78
79    if (document.querySelector('.tb-countdown__container')) {
80        // Update the countdown every second
81        interval = setInterval(updateCountdown, 1000);
82
83        // Initial call to set the initial values
84        updateCountdown();
85    }
86});

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.