PageSourceSearch

https://hofa-college.de/wp-content/plugins/hofa-countdown/countdown.js?ver=7.1.2

js hofa-college.de collected 2026-10-02 18:51:57 UTC 5,507 bytes, 182 lines download raw bytes

1var hofa_countdown;
2jQuery(function () {
3    hofa_countdown = new CountdownStart();
4});
5
6function CountdownStart() {
7    for (var item in countdown) {
8        if (countdown.hasOwnProperty(item)) {
9            if (typeof countdown[item].lang === 'undefined') {
10                countdown[item].lang = 'de';
11            }
12
13            countdown[item].abbr = !!countdown[item].abbr;
14            countdown[item].akk = !!countdown[item].akk;
15            countdown[item].remain = !!countdown[item].remain;
16
17            countdown[item].diff = parseInt(countdown[item].diff);
18            countdown[item].end = parseInt(countdown[item].end);
19
20            countdown[item].start = mkTime();
21
22            countdown[item].timer = setInterval(countdownNext.bind(countdown[item]), 1000);
23
24            // countdownNext.bind(countdown[item])();
25        }
26    }
27}
28
29function countdownNext() {
30    var lang = this.lang;
31
32    // this.amount = this.diff + this.start - mkTime();
33    this.amount = this.end - mkTime();
34
35    var time = this.amount;
36    var format = this.format;
37
38    var days = 0;
39    var hours = 0;
40    var mins = 0;
41    var secs = 0;
42    var out;
43
44    var day = '';
45    var hour = '';
46    var minute = '';
47    var second;
48
49    if (this.remain > 0) {
50        if ((this.format.indexOf('%s') < 0) && (time < 60)) {
51            time = 60;
52        } else if (time < 7) {
53            time = this.remain;
54        }
55    }
56
57    if (time > 0) {	// date is still good
58        time = Math.floor(time);
59
60        days = Math.floor(time / 86400);    //days
61        time = time % 86400;
62
63        hours = Math.floor(time / 3600);    //hours
64        time = time % 3600;
65
66        mins = Math.floor(time / 60);   //Minuten
67        time = time % 60;
68
69        secs = Math.floor(time);    //Sekunden
70
71        // setTimeout(countdownNext.bind(this), 1000);
72    } else {
73        clearInterval(this.timer);
74        return;
75    }
76
77    var text = {
78        d: {
79            de: ['Tag', 'Tag', 'e', 'en'],
80            en: ['day', 'day', 's', 's']
81        },
82        h: {
83            de: ['Stunde', 'Std.', 'n', 'n'],
84            en: ['hour', 'hrs.', 's', 's']
85        },
86        i: {
87            de: ['Minute', 'Min.', 'n', 'n'],
88            en: ['minute', 'min.', 's', 's']
89        },
90        s: {
91            de: ['Sekunde', 'Sek.', 'n', 'n'],
92            en: ['second', 'sec.', 's', 's']
93        }
94    };
95
96    var einheit = 0;
97    if (this.abbr > 0) {
98        einheit = 1;
99    }
100
101    var plural = 2;
102    if (this.akk > 0) {
103        plural = 3;
104    }
105
106    if (days > this.min_days) {
107        //Es sind noch ausreichend viele Tage übrig, um ganze Tage anzuzeigen
108        day = text.d[lang][einheit];
109        if (days !== 1 && day[day.length - 1] !== '.') {
110            day += text.d[lang][plural];
111        }
112    } else {
113        //erst bei nächst kleinerer Einheit beginnen
114        hours += days * 24; // verbleibende Tage in Stunden umrechnen
115        format = countdownSubside(format, '%h');
116    }
117
118    if (
119        this.amount < this.remain
120        || days !== 0
121        || hours !== 0
122    ) {
123        hour = text.h[lang][einheit];
124        if (hours !== 1 && hour[hour.length - 1] !== '.') {
125            hour += text.h[lang][plural];
126        }
127    } else {
128        //erst bei nächst kleinerer Einheit beginnen
129        format = countdownSubside(format, '%m');
130    }
131
132    if (
133        this.amount < this.remain
134        || days !== 0
135        || hours !== 0
136        || mins !== 0
137    ) {
138        minute = text.i[lang][einheit];
139        if (mins !== 1 && minute[minute.length - 1] !== '.') {
140            minute += text.i[lang][plural];
141        }
142    } else {
143        //erst bei nächst kleinerer Einheit beginnen
144        format = countdownSubside(format, '%s');
145    }
146
147    second = text.s[lang][einheit];
148    if (secs !== 1 && second[second.length - 1] !== '.') {
149        second += text.s[lang][plural];
150    }
151
152    out = format;
153    out = replaceAll(out, '%d', '<span class="countdown-number number-days">' + days + '</span>');
154    out = replaceAll(out, '%td', '<span class="countdown-text text-days">' + '&nbsp;' + day + '</span>');
155    out = replaceAll(out, '%h', '<span class="countdown-number number-hours">' + hours + '</span>');
156    out = replaceAll(out, '%th', '<span class="countdown-text text-hours">' + '&nbsp;' + hour + '</span>');
157    out = replaceAll(out, '%m', '<span class="countdown-number number-minutes">' + mins + '</span>');
158    out = replaceAll(out, '%tm', '<span class="countdown-text text-minutes">' + '&nbsp;' + minute + '</span>');
159    out = replaceAll(out, '%s', '<span class="countdown-number number-seconds">' + ('00' + secs).slice(-2) + '</span>');
160    out = replaceAll(out, '%ts', '<span class="countdown-text text-seconds">' + '&nbsp;' + second + '</span>');
161
162    out = replaceAll(out, ':', '<span class="blink">:</span>');
163
164    jQuery(this.target).html(this.text.replace('%s', out));
165
166    function replaceAll(haystack, needle, replacement) {
167        return haystack.split(needle).join(replacement);
168    }
169
170    function countdownSubside(format, unit) {
171        var p_unit = format.indexOf(unit);
172        if (p_unit === -1) {
173            format += unit;
174            p_unit = format.indexOf(unit);
175        }
176        return format.substring(p_unit);
177    }
178}
179
180function mkTime() {
181    return Math.floor((new Date).getTime() / 1000);
182}

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.