PageSourceSearch

https://dpcomaha.org/_assets/js/monk/helpers/countdown.js

js dpcomaha.org collected 2026-10-02 23:16:52 UTC 6,626 bytes, 145 lines download raw bytes

1jQuery((function($) {
2    var $countdown = window.$countdown;
3    var liveTest = false;
4    if (getLiveQueryParam("live") == "true") {
5        liveTest = true;
6    }
7    var i = 0;
8    $.getJSON("/_components/ajax/ajax-countdown-times.php", (function(data) {
9        if (data.length > 0 && typeof data[i] != "undefined") {
10            //window.console.log(data);
11            var starttime = new Date(data[i].date.start), endtime = new Date(data[i].date.end), curtime = new Date, lbs = [ "YRS", "MO", "W", "DAYS", "HRS", "MINS", "SECS" ], //plurl
12            lbs1 = [ "YR", "MO", "W", "DAY", "HR", "MIN", "SEC" ], frmt = "DHMS", website = data[i].website, summary = data[i].summary, title = data[i].title, infobtnlive = data[i].infobtnlive, infobtnoffline = data[i].infobtnoffline, infobtnurl = data[i].infobtnurl, infotext = data[i].infotext;
13            if (!infobtnlive) {
14                if (infobtnoffline) {
15                    infobtnlive = infobtnoffline;
16                } else {
17                    infobtnlive = title;
18                }
19            }
20            if (!infobtnoffline) {
21                if (infobtnlive) {
22                    infobtnoffline = infobtnlive;
23                } else {
24                    infobtnoffline = title;
25                }
26            }
27            if (!infobtnurl) {
28                infobtnurl = website;
29            }
30            if (!summary) {
31                summary = "Streaming Live!";
32            }
33            if (!infotext) {
34                infotext = summary;
35            }
36            //use layout pre live countdown
37                        var layoutTimer = "<div class='timer-container prelive'><div class='timer-layout'><span><b>{dnn}</b><i>{dl}</i></span><span><b>{hnn}</b><i>{hl}</i></span><span><b>{mnn}</b><i>{ml}</i></span><span><b>{snn}</b><i>{sl}</i></span></div><p class='timer-buttons'><a href='" + infobtnurl + "' class='btn btn-default btn-xs' style='transition: none;'>" + infobtnoffline + "</a></p></div>", 
38            //use layout for live service.  must keep timer but can hide via css.  allows a layout for both options
39            layoutTimerLive = "<a href='#' class='countdown-close'><i class='icon icon-cross2'></i></a><div class='timer-container live'><div class='timer-layout'><span><b>{dnn}</b><i>{dl}</i></span><span><b>{hnn}</b><i>{hl}</i></span><span><b>{mnn}</b><i>{ml}</i></span><span><b>{snn}</b><i>{sl}</i></span></div><div class='timer-text'>" + infotext + "</div><p class='timer-buttons'><a href='" + infobtnurl + "' class='btn btn-default btn-xs' style='transition: none;'>" + infobtnlive + "</a></p></div>";
40            setEvent(curtime, starttime, endtime, website);
41        } else {
42            return false;
43        }
44        function setEvent(curtime, starttime, endtime, website) {
45            //is it live
46            if (curtime <= endtime && curtime >= starttime || liveTest) {
47                if ($countdown.hasClass("hasCountdown")) {
48                    $countdown.countdown("option", {
49                        until: endtime,
50                        format: frmt,
51                        labels: lbs,
52                        labels1: lbs1,
53                        layout: layoutTimerLive,
54                        onExpiry: setNext
55                    });
56                } else {
57                    $countdown.countdown({
58                        until: endtime,
59                        format: frmt,
60                        labels: lbs,
61                        labels1: lbs1,
62                        layout: layoutTimerLive,
63                        onExpiry: setNext
64                    });
65                }
66                countdownLive();
67            }
68            //in the future...countdown
69             else if (curtime < starttime) {
70                if ($countdown.hasClass("hasCountdown")) {
71                    $countdown.countdown("option", {
72                        until: starttime,
73                        format: frmt,
74                        labels: lbs,
75                        labels1: lbs1,
76                        layout: layoutTimer,
77                        onExpiry: function() {
78                            $countdown.countdown("option", {
79                                until: endtime,
80                                format: frmt,
81                                labels: lbs,
82                                labels1: lbs1,
83                                layout: layoutTimerLive,
84                                onExpiry: setNext
85                            });
86                            countdownLive();
87                        }
88                    });
89                    countdownOffline();
90                } else {
91                    $countdown.countdown({
92                        until: starttime,
93                        format: frmt,
94                        labels: lbs,
95                        labels1: lbs1,
96                        layout: layoutTimer,
97                        onExpiry: function() {
98                            $countdown.countdown("option", {
99                                until: endtime,
100                                format: frmt,
101                                labels1: lbs1,
102                                labels: lbs,
103                                layout: layoutTimerLive,
104                                onExpiry: setNext
105                            });
106                            countdownLive();
107                        }
108                    });
109                }
110            }
111            //no bueno
112             else {
113                $countdown.remove();
114                //console.log('No Live events');
115                                countdownOffline();
116            }
117        }
118        function setNext() {
119            i++;
120            if (data.length > 0 && typeof data[i] != "undefined") {
121                starttime = new Date(data[i].date.start);
122                endtime = new Date(data[i].date.end);
123                curtime = new Date;
124                website = data[i].website;
125                setEvent(curtime, starttime, endtime, website);
126            } else {
127                console.log("No additional live events scheduled");
128            }
129        }
130    })).done((function() {}));
131}));
132
133function countdownLive() {
134    $("#header .countdown").addClass("live");
135}
136
137function countdownOffline() {
138    $("#header .countdown").addClass("offline");
139}
140
141function getLiveQueryParam(name) {
142    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
143    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
144    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
145}

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.