PageSourceSearch

https://flyhamilton.ca/wp-content/plugins/HIA-Flight-Status/public/js/main.js?ver=2.0.0

js flyhamilton.ca collected 2026-10-02 04:48:58 UTC 3,654 bytes, 115 lines download raw bytes

1jQuery(document).ready(function( $ ) {
2
3    let filters = {
4        airline: "",
5        city: ""
6    }
7
8    let $fromDate = $('.hia-flight-status .controls #from-date').flatpickr({
9        altInput: true,
10        altFormat: "H:i / M d, Y",
11        dateFormat: "Y-m-d H:i",
12        time_24hr: true,
13        enableTime: true,
14        defaultDate: moment().subtract(3, 'days').format("Y-MM-DD"),
15        onChange: function() {
16            UpdateFilters();
17        },
18    });
19
20    let $toDate = $('.hia-flight-status .controls #to-date').flatpickr({
21        altInput: true,
22        altFormat: "H:i / M d, Y",
23        dateFormat: "Y-m-d H:i",
24        time_24hr: true,
25        enableTime: true,
26        defaultDate: moment().endOf('day').add(7,'days').format("Y-MM-DD HH:mm:ss"),
27        onChange: function() {
28            UpdateFilters();
29        },
30    });
31
32    $(".hia-flight-status .controls #airline").change(function() {
33        filters.airline = $(this).val();
34        UpdateFilters();
35    });
36
37    $(".hia-flight-status .controls #city").change(function() {
38        filters.city = $(this).val();
39        UpdateFilters();
40    });
41
42
43    var hash = document.location.hash;
44    if (hash) {
45        $('.nav-tabs a[href='+hash+']').tab('show');
46    }
47
48    SetUrlVariables();
49    UpdateFilters();
50    function UpdateFilters() {
51
52        $(".hia-flight-status .flights .flight").each(function() {
53
54            let datetime = moment($(this).data('datetime'));
55            let fromDate = moment($fromDate.selectedDates[0]);
56            let toDate = moment($toDate.selectedDates[0]);
57
58            if (($(this).data("airline") == filters.airline || filters.airline == "") &&
59                ($(this).data("city") == filters.city || filters.city == "") &&
60                (fromDate.isSameOrBefore(datetime) && toDate.isSameOrAfter(datetime))) {
61                $(this).removeClass('hide');
62            } else {
63                $(this).addClass('hide');
64            }
65        });
66
67        if ($(".hia-flight-status .flights #departures .flight:not(.hide)").length == 0) {
68            $(".hia-flight-status #departures .no-results").show();
69        } else {
70            $(".hia-flight-status #departures .no-results").hide();
71        }
72        if ($(".hia-flight-status .flights #arrivals .flight:not(.hide)").length == 0) {
73            $(".hia-flight-status #arrivals .no-results").show();
74        } else {
75            $(".hia-flight-status #arrivals .no-results").hide();
76        }
77
78        $(window).trigger('resize');
79    }
80
81
82    function SetUrlVariables() {
83        let urlVars = getUrlVars();
84        let $controls = $('.hia-flight-status .controls');
85
86        $controls.find('select').each(function(){
87            let id = $(this).attr('id');
88            if (id in urlVars) {
89                if ($(this).find('option[value="' + urlVars[id]+ '"]').length > 0) {
90                    $(this).val(urlVars[id]).trigger('change');
91                }
92            }
93        });
94    }
95
96    // Read a page's GET URL variables and return them as an associative array.
97    function getUrlVars()
98    {
99        var vars = [], hash;
100        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
101        for(var i = 0; i < hashes.length; i++)
102        {
103            hash = hashes[i].split('=');
104            vars.push(hash[0]);
105            if (hash[1]) {
106                if (hash[1].includes("#")) {
107                    vars[hash[0]] = decodeURIComponent(hash[1].split('#')[0]);
108                } else {
109                    vars[hash[0]] = decodeURIComponent(hash[1]);
110                }
111            }
112        }
113        return vars;
114    }
115});

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.