PageSourceSearch

https://www.cfnc.org/assets/javascripts/app.js

js cfnc.org collected 2026-09-24 08:57:05 UTC 9,052 bytes, 339 lines download raw bytes

1$ = jQuery.noConflict();
2
3//variables
4var iScrollPos = 0;
5var isopen = true;
6var width;
7var menuWidth;
8
9//width sizes
10$(window).on("resize", function () {
11  //variables
12  var width = $(window).width();
13  var iCurScrollPos = $(this).scrollTop();
14
15  //changes based on screen width
16  if (width > 992) {
17    $("#menuBtn").removeClass("active");
18    $(".mobile-menu").fadeOut();
19    $("body").removeClass("state-scroll-blocked");
20    //set mobile desktop header height
21    if ($(".full-header").length) {
22      setHeight();
23    }
24  } else {
25    $("#searchBarContainer").slideUp("fast");
26    $("#search-bg").fadeOut("fast");
27    //set mobile desktop header height
28    if ($(".full-header").length) {
29      setMobileHeight();
30    }
31  }
32});
33
34$(".pagination-container").click(function (e) {
35  e.preventDefault();
36  $("html, body").animate({ scrollTop: 0 }, "medium");
37});
38
39/*
40$(document).scroll(function() { 
41   if($(window).scrollTop() ==== 0) {
42    console.log($(window).scrollTop());
43    if ($("#dropdown-menu-special").hasClass("top-menu-special")) {
44    }else{
45     $("#dropdown-menu-special").addClass('top-menu-special');
46    }
47   }else{
48    console.log($(window).scrollTop());
49     $("#dropdown-menu-special").removeClass('top-menu-special');
50   }
51});
52*/
53
54document.addEventListener("DOMContentLoaded", () => {
55  new Mmenu(
56    "#menu",
57    {
58      navbar: {
59        title: "Main Menu",
60      },
61      navbars: [
62        {
63          position: "top",
64          content: ["prev", "title"],
65        },
66      ],
67    },
68    {
69      // configuration
70      classNames: {
71        selected: "active",
72      },
73    }
74  );
75});
76
77/*
78  $("#menu").mmenu({
79    offCanvas: false,
80    navbar: {
81        title: ""
82    },
83  });
84*/
85
86/*
87$(document).on("keyup", ".nice-select", function (event) {
88  var $dropdown = $(this);
89  alert(test);
90  if (event.which !== 0) {
91    $(this)
92      .find("ul.list li")
93      .each(function (index) {
94        if (!$(this).hasClass("focus")) {
95          var li_text = $(this).text().replace(/\s+/g, "");
96          if (li_text.charAt(0) == String.fromCharCode(event.which)) {
97            $dropdown.find(".focus").removeClass("focus");
98            $(this).addClass("focus");
99            return false;
100          }
101        }
102      });
103  }
104});
105*/
106
107$(document).ready(function () {
108  //$('[data-toggle="popover"]').popover();
109  //init
110  if ($("select").length) {
111      $("select").niceSelect();
112      $("select").on('change', function () {
113          var form = $(this).parents("form:first");
114          var validator = $(form).validate();
115          validator.element(this);
116      });
117  }
118
119  if ($(".slick-slide").is(":focus")) {
120    alert("asdfdasf");
121    //I have the focus
122  }
123
124  //variables
125  var width = $(window).width();
126  var iCurScrollPos = $(this).scrollTop();
127
128  //changes based on screen width
129  if (width > 992) {
130    //set mobile desktop header height
131    if ($(".full-header").length) {
132      setHeight();
133    }
134  } else {
135    //set mobile desktop header height
136    if ($(".full-header").length) {
137      setMobileHeight();
138    }
139  }
140
141  //MENU functionality
142  //MENU functionality
143  //MENU functionality
144
145  //mobile button
146  $("#menuBtn").click(function (event) {
147    $(this).toggleClass("active");
148    $("body").toggleClass("state-scroll-blocked");
149    $(".mobile-menu").fadeToggle();
150  });
151  //if user hovers over mega menu, highlights nav item
152  $(".mega-dropdown-container").hover(
153    function () {
154      $(this).parent(".mega-dropdown").closest().removeClass("active");
155      $(this).parent(".mega-dropdown").find(".nav-item").addClass("active");
156    },
157    function () {
158      $(this).parent(".mega-dropdown").find(".nav-item").removeClass("active");
159    }
160  );
161
162  $(".mm-next").attr("aria-label", "Next Button");
163  $(".mm-next").attr("role", "button");
164
165  //menu end
166  //menu end
167  //menu end
168
169  //searchbar
170  $("#searchBtn").click(function (event) {
171    event.preventDefault();
172    //$(this).toggleClass('active');
173    $("#searchBarContainer").slideDown("fast");
174    $("#search-bg").fadeIn("fast");
175    $("#desktop-search").focus();
176  });
177  $("#search-bg").click(function (event) {
178    $("#searchBarContainer").slideUp("fast");
179    $("#search-bg").fadeOut("fast");
180  });
181
182  //accordion
183  $(".accordion-title-btn").click(function (event) {
184    if (
185      $(this)
186        .parent()
187        .next(".col-1")
188        .find(".accordion-click-btn")
189        .attr("aria-expanded") == "false"
190    ) {
191    } else {
192    }
193  });
194
195  $(".hor-title-btn").click(function (event) {
196    if ($(this).closest(".header-focus").hasClass("shadowed")) {
197      $(this).closest(".header-focus").removeClass("shadowed");
198    } else {
199      $(this).closest(".header-focus").addClass("shadowed");
200    }
201  });
202  $(".hor-click-btn").click(function (event) {
203    if ($(this).closest(".header-focus").hasClass("shadowed")) {
204      $(this).closest(".header-focus").removeClass("shadowed");
205    } else {
206      $(this).closest(".header-focus").addClass("shadowed");
207    }
208  });
209
210  //scroll to top
211  $("#topBtn").click(function () {
212    $("html, body").animate({ scrollTop: 0 }, "medium");
213    return false;
214  });
215
216  //forms
217  $(".search-form-container input")
218    .blur(function () {
219      $(this).parent(".search-form-container").removeClass("focus");
220    })
221    .focus(function () {
222      $(this).parent(".search-form-container").addClass("focus");
223    });
224
225  //input form
226  $(".input-numb-container .plus").click(function (event) {
227    event.preventDefault();
228
229    incVal = $(this).parent().find(".num-spinner").attr("value");
230    incVal++;
231    //$(this).prev('.num-spinner').attr('value', incVal);
232    $(this).parent().find(".num-spinner").attr("value", incVal);
233  });
234
235  $(".input-numb-container .minus").click(function (event) {
236    event.preventDefault();
237
238    decVal = $(this).parent().find(".num-spinner").attr("value");
239    if (decVal <= 0) {
240      decVal = 0;
241    } else {
242      decVal--;
243    }
244    //$(this).prev('.num-spinner').attr('value', incVal);
245    $(this).parent().find(".num-spinner").attr("value", decVal);
246  });
247
248  $(".input-date-container .plus").click(function (event) {
249    event.preventDefault();
250
251    incVal = $(this).parent().find(".num-spinner").attr("value");
252    if (incVal >= 12) {
253      incVal = 12;
254    } else {
255      incVal++;
256    }
257    //$(this).prev('.num-spinner').attr('value', incVal);
258    $(this).parent().find(".num-spinner").attr("value", incVal);
259  });
260
261  $(".input-date-container .minus").click(function (event) {
262    event.preventDefault();
263
264    decVal = $(this).parent().find(".num-spinner").attr("value");
265    if (decVal <= 1) {
266      decVal = 1;
267    } else {
268      decVal--;
269    }
270    //$(this).prev('.num-spinner').attr('value', incVal);
271    $(this).parent().find(".num-spinner").attr("value", decVal);
272  });
273
274  //file input - allow name to appear
275  $(".cs-file-upload").change(function () {
276    var i = $(this).prev("label").clone();
277    var file = $(this)[0].files[0].name;
278    $(this).prev("label").addClass("active");
279    $(this)
280      .prev("label")
281      .html("<span class='btn small'>Choose File</span>" + file);
282  });
283
284  //file input- if selected allows keyboard to activate file
285  $(".upload-btn-wrapper").keydown(function (event) {
286    if (event.which == 13) {
287      $(this).find('input[type="file"]').click();
288    }
289  });
290
291  //login button
292  $(".brand-button").click(function (event) {
293    var img_current = $("#current-brand").attr("src");
294    var img_name = $(this).find("img").attr("src");
295    $("#current-brand").attr("src", img_name);
296    $(this).find("img").attr("src", img_current);
297  });
298
299  //language modal
300  $('#language-modal-continue').click(function () {
301      //save cookie
302      document.cookie = 'showTranslationModal=false; path=/';
303  })
304});
305
306//set height
307function setHeight() {
308  var windowHeight = $(window).innerHeight() - 120;
309  $(".full-header").css("height", windowHeight);
310}
311//set mobile height
312function setMobileHeight() {
313  var windowHeight = $(window).innerHeight() - 60;
314  $(".full-header").css("height", windowHeight);
315}
316
317//FORMS
318//checkbox
319$(".checkbox-label").on("keypress", function (event) {
320  var checkbox = $(this).prev('input[type="checkbox"]');
321  if (event.which == 13) {
322    if ($(checkbox).is(":checked")) {
323      $(this).prev('input[type="checkbox"]').prop("checked", false);
324    } else {
325      $(this).prev('input[type="checkbox"]').prop("checked", true);
326    }
327  } //if enter
328});
329
330$(".radio-label").on("keypress", function (event) {
331  var radiobox = $(this).prev('input[type="radio"]');
332  if (event.which == 13) {
333    if ($(radiobox).is(":checked")) {
334      $(this).prev('input[type="radio"]').prop("checked", false);
335    } else {
336      $(this).prev('input[type="radio"]').prop("checked", true);
337    }
338  } //if enter
339});

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.