PageSourceSearch

https://www.bellevillenj.org/_Assets/js/default.js

js bellevillenj.org collected 2026-10-02 18:32:39 UTC 6,645 bytes, 201 lines download raw bytes

1$(document).ready(function () {
2
3    // scrolling ticker
4    function scrollingTicker() {
5        $.ajax({
6            type: 'GET',
7            url: '/api/data/GetTickerData',
8            dataType: 'json',
9            success: function (data) {
10                var tickerData = '';
11                var pre = "";
12                $.each(data, function (index, item) {
13                    if (item.CSSClass == "ticker-alert")
14                        pre = "ALERT: ";
15                    else if (item.CSSClass == "ticker-attention")
16                        pre = "ATTENTION: ";
17                    else
18                        pre = "UPDATE: ";
19
20                    if (item.SiteLink)
21                        tickerData += '<a class="' + item.CSSClass + '" href="' + item.SiteLink + '" target="' + item.SiteTarget + '">' + pre + item.Title + '</a>';
22                    else
23                        tickerData += '<a class="' + item.CSSClass + '" href="javascript:;">' + pre + item.Title + '</a>';
24
25                });
26
27                if (pre != "") {
28                    $(".ticker").html('<span>' + tickerData + '</span>');
29                    $(".ticker").show();
30                    $(".google-translate-menu").css('top', '55px');
31                }
32            },
33            error: function (msg) {
34                console.log('failure' + msg);
35            }
36        });
37    };
38    scrollingTicker();
39
40    /* open quick links */
41    $("#quicklinks-btn").click(function (e) {
42        e.preventDefault();
43        $("#sidebar-quicklinks").addClass("visible");
44        $(".arrow-close").show();
45        $("#overlay").show();
46    });
47
48    /* FIX MENU ISSUE - for all pages */
49    /* The code below checks if the menu DOM was already created by AngularJS */
50    function updateMenu() {
51        if ($('#main-menu .sub-arrow').length <= 0) { //verify if submenu items exist. If not, it calls the refresh function to apply the smartmenu and build the submenus.
52            $('#main-menu').smartmenus('refresh');
53        }
54    }
55    setTimeout(function () { updateMenu(); }, 500);
56    setTimeout(function () { updateMenu(); }, 1000);
57    setTimeout(function () { updateMenu(); }, 2000);
58    setTimeout(function () { updateMenu(); }, 5000);
59    setTimeout(function () { updateMenu(); }, 8000);
60    setTimeout(function () { updateMenu(); }, 15000);
61
62    //Keep fixed menu
63    window.onscroll = function () {
64
65        //get source page
66        var menuPosition = null;
67        if (window.location.pathname === '/') {
68            menuPosition = 155; //For home
69        }
70        else {
71            menuPosition = 0; //For internal pages
72        }
73
74        //if the page has ticker scrolling message
75        if ($(".ticker").is(":visible")) {
76            menuPosition += 55;
77        }
78
79        if (window.pageYOffset > menuPosition) {
80            $('#main-menu-container, #search-bar-container').css({ position: 'fixed' });
81            $('#main-menu-container').css({ top: 0 });
82            $('#search-bar-container').css({ top: 50 });
83            $("body").css({ 'padding-top': 50 });
84        } else {
85            $('#main-menu-container, #search-bar-container').css({ position: 'relative' });
86            $('#search-bar-container').css({ top: 0 });
87            $("body").css({ 'padding-top': 0 });
88        }
89    }
90
91    //Footer menu Collapse component
92    $('.collapse-menu').collapse({
93        toggle: false
94    });
95
96    /* FEATURE ICONS SLIDE */
97    function carouselUpdate() {
98        var BODY = $("body"), container = $("#features-icons-drag"), pageElements;
99
100        var width = $(this).width(), itemsInPage = 1, totalPages = 6;
101        $(".prev, .next").addClass("hidden");
102
103        var lastItemFix = 2; //this number is the quantity of items that are left on the last page
104
105        if (width > 700) {
106            itemsInPage = 6;
107            totalPages = 1;
108            $(".prev, .next").addClass("hidden");
109        } else if (width > 400) {
110            itemsInPage = 3;
111            totalPages = 2;
112            $(".next").removeClass("hidden");
113        } else {
114            itemsInPage = 2;
115            lastItemFix = 3;
116            $(".next").removeClass("hidden");
117        }
118
119        container.dragend({
120            pageClass: "icons",
121            itemsInPage: itemsInPage,
122            page: totalPages,
123            direction: "horizontal",
124            afterInitialize: function () {
125                this.container.style.visibility = "visible";
126            },
127            onSwipeEnd: function () {
128                var first = this.pages[0];
129                var last = this.pages[this.pages.length - lastItemFix];
130
131                $(".prev, .next").removeClass("hidden");
132                if (first === this.activeElement) { $(".prev").addClass("hidden"); }
133                if (last === this.activeElement) { $(".next").addClass("hidden"); }
134                //don't show any arrows when there is just 1 page
135                if (totalPages == 1) {
136                    $(".prev, .next").addClass("hidden");
137                }
138            }
139        });
140        container.dragend({
141            scrollToPage: 1
142        });
143    }
144
145    $(".prev").click(function () {
146        $("#features-icons-drag").dragend("right");
147    });
148
149    $(".next").click(function () {
150        $("#features-icons-drag").dragend("left");
151    });
152
153    carouselUpdate();
154
155    $(window).on("resize", function () {
156        carouselUpdate();
157        $("#features-icons-drag").dragend({
158            scrollToPage: 1
159        });
160    });
161
162    //Open Popup
163    if (sessionStorage.getItem('WNYFirstUserVisit') != "1") {
164        //openPopup();
165    }
166
167});
168
169/* Search Bar */
170function showSearchBar() {
171    $("#search-bar-container").slideToggle("slow");
172    $("#search-desktop").focus();
173}
174
175/* Hide overlay items */
176function hideAllOverlayItems() {
177    $("#popup-splash").hide();
178    $("#sidebar-quicklinks").removeClass("visible");
179    $(".arrow-close").hide();
180    $("#overlay").hide();
181}
182
183/* open splash screen */
184function openPopup() {
185
186    if ($("#popup-splash").length) {
187        $("#popup-splash").show();
188        $("#overlay").show();
189
190        sessionStorage.setItem('WNYFirstUserVisit', '1');
191    }
192}
193
194/* Lazy loading to carousel images */
195$(function () {
196    $('.carousel.lazy-load').bind('slide.bs.carousel', function (e) {
197        var image = $(e.relatedTarget).find('img[data-src]');
198        image.attr('src', image.data('src'));
199        image.removeAttr('data-src');
200    });
201});

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.