PageSourceSearch

https://www.lavanda.sk/wa_script/js/countdown_timer.js?_=2026-09-02-11-10

js lavanda.sk collected 2026-09-27 15:11:57 UTC 1,771 bytes, 60 lines download raw bytes

1(function (BS) {
2    "use strict";
3    function CountdownTimer(endtime, onUpdate) {
4        this.endtime = endtime;
5        if (typeof onUpdate !== 'function') {
6            throw new Error('onUpdate must be a function');
7        }
8        this.onUpdate = onUpdate;
9        this.timeRemaining = null;
10        this.start();
11    }
12
13    CountdownTimer.prototype.getTimeRemaining = function () {
14        return Object.assign({}, this.timeRemaining);
15    };
16    CountdownTimer.prototype.update = function () {
17        var t = Math.max(this.endtime - Date.parse(new Date()), 0);
18        var seconds = 0;
19        var minutes = 0;
20        var hours = 0;
21        var days = 0;
22        if(t > 0) {
23            seconds = Math.floor((t / 1000) % 60);
24            minutes = Math.floor((t / 1000 / 60) % 60);
25            hours = Math.floor((t / (1000 * 60 * 60)) % 24);
26            days = Math.floor(t / (1000 * 60 * 60 * 24));
27        }
28
29        this.timeRemaining = {
30            total: t,
31            days: days,
32            hours: hours,
33            minutes: minutes,
34            seconds: seconds
35        };
36
37        this.onUpdate(this.getTimeRemaining());
38        if (t <= 0) {
39            clearInterval(this.interval);
40        }
41    };
42    CountdownTimer.prototype.stop = function () {
43        clearInterval(this.interval);
44    };
45    CountdownTimer.prototype.start = function () {
46        this.update();
47        if(this.timeRemaining.total > 0) {
48            this.interval = setInterval(this.update.bind(this), 1000);
49        }
50    }
51
52    function initializeCountdownTimer(endtime, onUpdate) {
53        return new CountdownTimer(endtime, onUpdate);
54    }
55
56    BS.countdownTimer = {
57        CountdownTimer: CountdownTimer,
58        create: initializeCountdownTimer,
59    };
60})(BS);

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.