PageSourceSearch

https://www.georgiaaquarium.org/wp-content/plugins/tessitura-gai/js/open-hours.js?ver=20261001185938

js georgiaaquarium.org collected 2026-10-02 09:51:37 UTC 4,072 bytes, 89 lines download raw bytes

1const popOpenHours = () => {
2    (function($) {
3        //debug_log("[HOURS] popOpenHours called");
4        let output = '';
5
6        // Try the cookie first
7        if (!(output = getCookie('open-hours'))) {
8            $.ajax({
9                type: "POST",
10                url: apiBaseURIv2 + 'getOpenHours',
11                contentType: 'application/json',
12                timeout: 15000, // 15 seconds
13                dataType: 'json',
14                success: function (data) {
15                    let fakeError = false; // !env.live && confirm('Pretend hours & schedule fetch returned error?'); 	
16                    let resp = safeJSONParse(data);
17                    debug_log("[HOURS] Grabbed data: ",resp);
18                    if ('0' in resp && !fakeError) {
19                        // Do the thing
20
21
22                        // Store the thing
23                        debug_log("[HOURS] Caching hours: ",resp[0],"which becomes",JSON.stringify(resp[0]));
24                        setCookie('open-hours',JSON.stringify(resp[0]), (60*15), true); // 1 hour, do not URI encode
25                        output = resp[0];
26                    }
27                    else {
28                        pushException('getHours-errorResponse');
29                        
30                        output = null;
31                    }
32                },
33                error: function (jqXHR, status, errorThrown) {
34                    pushException('getHours-badResponse');
35                    
36                    output = null;
37                },
38                complete: function (jqXHR, status) {
39                    // If we got correct output of the API call we can render it. Otherwise we leave whatever is in the HTML alone, right or wrong.
40                    if (output) { renderOpenHours(output); }
41                }
42            });
43
44        } else {
45            debug_log("[HOURS] Using cached hours: ",output);
46            renderOpenHours(JSON.parse(output));
47        }
48
49        function shortenHours(time_string) {
50            let matches = time_string.match(/(\d+):00\s*(am|pm)/i);
51            if (matches) {
52                return matches[1] + matches[2].toLowerCase();
53            }
54            return time_string;
55        }
56
57        function renderOpenHours(output) {
58            debug_log("[HOURS] renderOpenHours called with: ",output);
59            // We need to update three different places with today's hours:
60            // 1. In the standard header.
61            let headerOutput = (output.note ? output.note + " " : "Today's Hours ") + shortenHours(output.openHours) + " - " + shortenHours(output.closeHours);
62            $('#site-header .utility .hours').attr('aria-label', `Aquarium hours: ${headerOutput}`);
63            $('#site-header .utility .hours span').text(headerOutput);
64            $('#site-header .utility .hours').addClass('updated');
65            // 2. In the minified header (flow-bar).
66            let flowBarOutput = (output.note ? output.note + " " : "Open Today ") + output.openHours + " - " + output.closeHours;
67            $('.flow-bar .hours').text(flowBarOutput);
68            $('.flow-bar .hours').addClass('updated');
69            // 3. In the footer, where the note is in a different place.
70            let footerOutput = output.openHours + " - " + output.closeHours;
71            $('#site-footer .hours .title').text(output.note ? output.note : "Today's hours");
72            $('#site-footer .hours .hours-display p').text(footerOutput);
73            $('#site-footer .hours').addClass('updated');
74            
75            // This is used by ticketwidget and hours-schedule to determine if we are still open for the day.
76            // If these modules init before a potential pull, we may still have problems assessing the correct closeTS.
77            // But at least this gives us a chance to be correct more often than not.
78            if (output.closeTS) {
79                $('#closeTS').val(output.closeTS);
80                $('#closeTS').addClass('updated');
81            }
82
83        }
84       
85
86    })(jQuery);
87};
88
89popOpenHours();

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.