PageSourceSearch

https://lauremontschool.ca/wp-content/themes/lauremont/src/assets/lib/all.js?ver=3268

js lauremontschool.ca collected 2026-10-09 22:00:04 UTC 18,869 bytes, 636 lines download raw bytes

1jQuery(document).ready(function ($) {
2  // Header blank_div hover
3  const header = document.getElementById('header');
4  const menuDiv = document.getElementById('menu_div');
5  const blankDiv = document.getElementById('blank_div');
6  menuDiv.addEventListener('mouseover', () => {
7    header.classList.add('header-hover');
8  });
9  blankDiv.addEventListener('mouseout', () => {
10    header.classList.remove('header-hover');
11  });
12
13  //
14  //
15  // Change theme on scroll
16  //
17  //
18  var initialTheme = $("body").attr("id");
19  function onScroll() {
20    var scrollTop = $(window).scrollTop();
21    var themeClass = null;
22    var windowHeight = $(window).height();
23    
24    if (scrollTop === 0) {
25      $("body").attr("id", initialTheme);
26      $("header").removeClass(
27        "bg_theme_primary bg_theme_secondary bg_theme_tertiary"
28      );
29      return;
30    }
31
32    var maxVisibleArea = 0;
33    $("#main_content section").each(function () {
34      var $this = $(this);
35      var top = $this.offset().top + 275;
36      var height = $this.outerHeight();
37      var bottom = top + height;
38      
39      // Calculate visible area of the section
40      var visibleTop = Math.max(scrollTop, top);
41      var visibleBottom = Math.min(scrollTop + windowHeight, bottom);
42      var visibleArea = Math.max(0, visibleBottom - visibleTop);
43      
44      if (visibleArea > maxVisibleArea) {
45        maxVisibleArea = visibleArea;
46        var classes = $this.attr("class").split(" ");
47        for (var i = 0; i < classes.length; i++) {
48          if (classes[i].startsWith("bg_theme_")) {
49            themeClass = classes[i];
50            break;
51          }
52        }
53      }
54    });
55
56    $("header").removeClass(function (index, className) {
57      return (className.match(/(^|\s)bg_theme_\S+/g) || []).join(" ");
58    });
59    if (themeClass && $(window).scrollTop() > 0) {
60      $("header").addClass(themeClass);
61      $("body").attr("id", themeClass);
62    }
63  }
64  $(window).on("scroll", onScroll); // add scroll event listener using jQuery
65  //
66  //
67  //
68  //
69  //
70
71  //
72  //
73  // FAQ
74  //
75  //
76  $(".single_faq h3").on("click", function () {
77    $(".single_faq").removeClass("active");
78    $(this).parent().addClass("active");
79  });
80  //
81  //
82  //
83  //
84  //
85
86  //
87  //
88  // FOOTER
89  //
90  //
91  $("footer .menu1 p.name span:nth-child(1)").text(
92    $("footer .main_menu.menu1 ul")
93      .attr("id")
94      .replace("menu-", "")
95      .replace(/-/g, " ")
96      .replace(/\b\w/g, function (match) {
97        return match.toUpperCase();
98      })
99  );
100  $("footer .menu2 p.name span:nth-child(1)").text(
101    $("footer .main_menu.menu2 ul")
102      .attr("id")
103      .replace("menu-", "")
104      .replace(/-/g, " ")
105      .replace(/\b\w/g, function (match) {
106        return match.toUpperCase();
107      })
108  );
109  $("footer .menu3 p.name span:nth-child(1)").text(
110    $("footer .main_menu.menu3 ul")
111      .attr("id")
112      .replace("menu-", "")
113      .replace(/-/g, " ")
114      .replace(/\b\w/g, function (match) {
115        return match.toUpperCase();
116      })
117  );
118  $("footer .menu4 p.name span:nth-child(1)").text(
119    $("footer .main_menu.menu4 ul")
120      .attr("id")
121      .replace("menu-", "")
122      .replace(/-/g, " ")
123      .replace(/\b\w/g, function (match) {
124        return match.toUpperCase();
125      })
126  );
127  $("footer .main_menu p").on("click", function () {
128    $("footer .main_menu").removeClass("active");
129    $(this).parent().addClass("active");
130  });
131  //
132  //
133  //
134  //
135  //
136
137  //
138  //
139  // Header Menu 1 child
140  //
141  //
142  const menuLinks = document.querySelectorAll(".menu1 .menu-item-has-children");
143
144  menuLinks.forEach((menuLink, index) => {
145    let isOpen = false;
146
147    const link = menuLink.querySelector("a:first-child");
148    const subMenu = menuLink.querySelector(".sub-menu");
149
150    link.addEventListener("click", (event) => {
151      event.preventDefault();
152
153      if (isOpen) {
154        subMenu.classList.remove("open");
155        link.classList.remove("open");
156        isOpen = false;
157      } else {
158        subMenu.classList.add("open");
159        link.classList.add("open");
160        isOpen = true;
161      }
162    });
163  });
164
165  // header Menu 2 name
166  $("header .menu2 .name").text(
167    $("header .menu2 ul")
168      .attr("id")
169      .replace("menu-", "")
170      .replace(/-/g, " ")
171      .replace(/\b\w/g, function (match) {
172        return match.toUpperCase();
173      })
174  );
175  //
176  //
177  //
178  //
179  //
180
181  //
182  //
183  // Search Modal
184  //
185  //
186  $('header [data-modal="search_modal"]').on("click", function () {
187    if ($("header .menu_drawer").hasClass("open")) {
188      $("header .menu_drawer").removeClass("open");
189      setTimeout(function () {
190        $(".modal.search_modal").addClass("active");
191        $("body").css("overflow", "hidden");
192      }, 500);
193    } else {
194      $(".modal.search_modal").addClass("active");
195      $("body").css("overflow", "hidden");
196    }
197  });
198  $(".modal.search_modal .close").on("click", function () {
199    $(".modal.search_modal").removeClass("active");
200    $("body").css("overflow", "unset");
201  });
202  //
203  //
204  //
205  //
206  //
207
208  //
209  //
210  // Menu Drawer
211  //
212  //
213  $('header [data-modal="menu_drawer"]').on("click", function () {
214    $("header .menu_drawer").addClass("open");
215    $("body").css("overflow", "hidden");
216  });
217  $(".menu_drawer .close").on("click", function () {
218    $("header .menu_drawer").removeClass("open");
219    $("body").css("overflow", "unset");
220  });
221  //
222  //
223  //
224  //
225  //
226
227  //
228  //
229  // All Faculties module
230  //
231  //
232  $(".selected-categories-count span.close").on("click", function () {
233    $(".all_faculty_cards .sorting label").removeClass("active");
234    $(".selected-categories-count span.number").text(0);
235    $('.all_faculty_cards .sorting input[type="checkbox"]').prop(
236      "checked",
237      false
238    );
239    let selectedCategories = [];
240    $(".selected-categories-count").hide();
241    loadFaculties(selectedCategories, 1);
242  });
243  $('.all_faculty_cards .sorting input[type="checkbox"]').on(
244    "change",
245    function () {
246      $(".all_faculty_cards .sorting label").removeClass("active");
247      let selectedCategoriesCount = 0;
248      let selectedCategories = [];
249      $('.all_faculty_cards .sorting input[type="checkbox"]:checked').each(
250        function () {
251          selectedCategories.push($(this).val());
252          $(this).parent().addClass("active");
253          selectedCategoriesCount += 1;
254        }
255      );
256      if (selectedCategoriesCount > 0) {
257        $(".selected-categories-count").show();
258        $(".selected-categories-count span.number").text(
259          selectedCategoriesCount
260        );
261      } else {
262        $(".selected-categories-count").hide();
263      }
264      loadFaculties(selectedCategories, 1);
265    }
266  );
267  loadFaculties([], 1);
268  $(document).on(
269    "click",
270    ".all_faculty_cards .pagination .page-number",
271    function (e) {
272      $(".all_faculty_cards").addClass("pagination-clicked");
273      e.preventDefault();
274      var page = $(this).data("page");
275      var selectedCategories = [];
276      $('.all_faculty_cards .sorting input[type="checkbox"]:checked').each(
277        function () {
278          selectedCategories.push($(this).val());
279        }
280      );
281      loadFaculties(selectedCategories, page);
282    }
283  );
284  function loadFaculties(categories, page) {
285    $(".all_faculty_cards .loadingIcon").show();
286    $.ajax({
287      type: "POST",
288      url: my_ajax_object.ajax_url,
289      data: {
290        action: "load-faculty",
291        categories: categories,
292        paged: page,
293        seed: new URL(window.location.href).searchParams.get('seed') || Math.floor(Math.random() * 1000000),
294      },
295      success: function (response) {
296        if ($("#all_faculty_cards").hasClass("pagination-clicked")) {
297          $("html, body").animate(
298            {
299              scrollTop: $("#all_faculty_cards").offset().top - 200,
300            },
301            1000
302          );
303        }
304        $(".all_faculty_cards .loadingIcon").hide();
305        $(".all_faculty_cards .main_cards").html(response);
306      },
307    });
308  }
309  //
310  //
311  //
312  //
313  //
314
315  //
316  //
317  // All News Listing
318  //
319  //
320  $('.all_news_cards .sorting input[type="checkbox"]').on(
321    "change",
322    function () {
323      let selectedCategories = [];
324
325      $('.all_news_cards .sorting input[type="checkbox"]:checked').each(
326        function () {
327          selectedCategories.push($(this).val());
328        }
329      );
330      loadNews(selectedCategories, 1);
331    }
332  );
333
334  loadNews([], 1);
335
336  $(document).on(
337    "click",
338    ".all_news_cards .pagination .page-number",
339    function (e) {
340      e.preventDefault();
341      var page = $(this).data("page");
342      var selectedCategories = [];
343      $('.all_news_cards .sorting input[type="checkbox"]:checked').each(
344        function () {
345          selectedCategories.push($(this).val());
346        }
347      );
348      loadNews(selectedCategories, page);
349    }
350  );
351
352  function loadNews(categories, page) {
353    $.ajax({
354      type: "POST",
355      url: my_ajax_object.ajax_url,
356      data: {
357        action: "load-news",
358        categories: categories,
359        paged: page,
360      },
361      success: function (response) {
362        $(".all_news_cards .main_cards").html(response);
363      },
364    });
365  }
366  //
367  //
368  //
369  //
370  //
371
372
373  // 
374  // 
375  // ALL NEWS MODULE
376  // 
377  // 
378  $(".selected-categories-count span.close").on("click", function () {
379    $(".all_news_module .sorting label").removeClass("active");
380    $(".selected-categories-count span.number").text(0);
381    $('.all_news_module .sorting input[type="checkbox"]').prop(
382      "checked",
383      false
384    );
385    let selectedCategories = [];
386    $(".selected-categories-count").hide();
387    var search = $('.all_news_module .search_container input').val();
388    var sortBy = $('.all_news_module .sorting_dropdown').val();
389    loadAllNewsModule(selectedCategories, 1, sortBy, search);
390  });
391  $('.all_news_module .sorting input[type="checkbox"]').on(
392    "change",
393    function () {
394      $(".all_news_module .sorting label").removeClass("active");
395      let selectedCategoriesCount = 0;
396      let selectedCategories = [];
397      $('.all_news_module .sorting input[type="checkbox"]:checked').each(
398        function () {
399          selectedCategories.push($(this).val());
400          $(this).parent().addClass("active");
401          selectedCategoriesCount += 1;
402        }
403      );
404      if (selectedCategoriesCount > 0) {
405        $(".selected-categories-count").show();
406        $(".selected-categories-count span.number").text(
407          selectedCategoriesCount
408        );
409      } else {
410        $(".selected-categories-count").hide();
411      }
412      var sortBy = $('.all_news_module .sorting_dropdown').val();
413      var search = $('.all_news_module .search_container input').val();
414      loadAllNewsModule(selectedCategories, 1, sortBy, search);
415    }
416  );
417  $(document).on("change", ".all_news_module .sorting_dropdown", function () {
418    var sortBy = $('.all_news_module .sorting_dropdown').val();
419    var selectedCategories = [];
420    $('.all_news_module .sorting input[type="checkbox"]:checked').each(
421      function () {
422        selectedCategories.push($(this).val());
423      }
424    );
425    var search = $('.all_news_module .search_container input').val();
426    loadAllNewsModule(selectedCategories, 1, sortBy, search);
427  });
428  $(document).on(
429    "click",
430    ".all_news_module .pagination .page-number",
431    function (e) {
432      $(".all_news_module").addClass("pagination-clicked");
433      e.preventDefault();
434      var page = $(this).data("page");
435      var selectedCategories = [];
436      $('.all_news_module .sorting input[type="checkbox"]:checked').each(
437        function () {
438          selectedCategories.push($(this).val());
439        }
440      );
441      var sortBy = $('.all_news_module .sorting_dropdown').val();
442      var search = $('.all_news_module .search_container input').val();
443      loadAllNewsModule(selectedCategories, page, sortBy, search);
444    }
445  );
446  loadAllNewsModule([], 1, "", "");
447  function loadAllNewsModule(categories, page, sortBy, search) {
448    $(".all_news_module .loadingIcon").show();
449    if ($("#all_news_module").hasClass("pagination-clicked")) {
450      $("html, body").animate(
451        {
452          scrollTop: $("#all_news_module").offset().top - 200,
453        },
454        1000
455      );
456    }
457    $.ajax({
458      type: "POST",
459      url: my_ajax_object.ajax_url,
460      data: {
461        action: "load-all-news-module",
462        categories: categories,
463        paged: page,
464        sortBy: sortBy,
465        search: search,
466        seed: new URL(window.location.href).searchParams.get('seed') || Math.floor(Math.random() * 1000000),
467      },
468      success: function (response) {
469        $(".all_news_module .loadingIcon").hide();
470        $(".all_news_module .main_cards").html(response);
471      },
472    });
473  }
474
475  // click on search_container span.search_icon
476  $('.all_news_module .search_container span.search_icon').on('click', function () {
477    $('.all_news_module .search_container').addClass('active');
478  });
479  $(document).on('click', function(e) {
480    if (!$(e.target).closest('.search_container').length) {
481      if ($('.all_news_module .search_container input').val() === '') {
482        $('.all_news_module .search_container').removeClass('active');
483      }
484    }
485  });
486
487  // do ajax search once input is changed
488  let searchTimeout;
489  $('.all_news_module .search_container input').on('input', function () {
490    clearTimeout(searchTimeout);
491    searchTimeout = setTimeout(() => {
492      var search = $('.all_news_module .search_container input').val();
493      var selectedCategories = [];
494      $('.all_news_module .sorting input[type="checkbox"]:checked').each(
495        function () {
496          selectedCategories.push($(this).val());
497        }
498      );
499      var sortBy = $('.all_news_module .sorting_dropdown').val();
500      loadAllNewsModule(selectedCategories, 1, sortBy, search);
501    }, 500);
502  });
503
504
505  //
506  // 
507  // Alumni business directory
508  // 
509  // 
510  $(".selected-categories-count-alumni span.close").on("click", function () {
511    $(".alumni_business_directory .sorting label").removeClass("active");
512    $(".selected-categories-count-alumni span.number").text(0);
513    $('.alumni_business_directory .sorting input[type="checkbox"]').prop(
514      "checked",
515      false
516    );
517    let selectedCategories = [];
518    $(".selected-categories-count-alumni").hide();
519    var search = $('.alumni_business_directory .search_container input').val();
520    var sortBy = $('.alumni_business_directory .sorting_dropdown').val();
521    loadAllAlumniModule(selectedCategories, 1, sortBy, search);
522  });
523  $('.alumni_business_directory .sorting input[type="checkbox"]').on(
524    "change",
525    function () {
526      $(".alumni_business_directory .sorting label").removeClass("active");
527      let selectedCategoriesCount = 0;
528      let selectedCategories = [];
529      $('.alumni_business_directory .sorting input[type="checkbox"]:checked').each(
530        function () {
531          selectedCategories.push($(this).val());
532          $(this).parent().addClass("active");
533          selectedCategoriesCount += 1;
534        }
535      );
536      if (selectedCategoriesCount > 0) {
537        $(".selected-categories-count-alumni").show();
538        $(".selected-categories-count-alumni span.number").text(
539          selectedCategoriesCount
540        );
541      } else {
542        $(".selected-categories-count-alumni").hide();
543      }
544      var sortBy = $('.alumni_business_directory .sorting_dropdown').val();
545      var search = $('.alumni_business_directory .search_container input').val();
546      loadAllAlumniModule(selectedCategories, 1, sortBy, search);
547    }
548  );
549  $(document).on("change", ".alumni_business_directory .sorting_dropdown", function () {
550    var sortBy = $('.alumni_business_directory .sorting_dropdown').val();
551    var selectedCategories = [];
552    $('.alumni_business_directory .sorting input[type="checkbox"]:checked').each(
553      function () {
554        selectedCategories.push($(this).val());
555      }
556    );
557    var search = $('.alumni_business_directory .search_container input').val();
558    loadAllAlumniModule(selectedCategories, 1, sortBy, search);
559  });
560  $(document).on(
561    "click",
562    ".alumni_business_directory .pagination .page-number",
563    function (e) {
564      $(".alumni_business_directory").addClass("pagination-clicked");
565      e.preventDefault();
566      var page = $(this).data("page");
567      var selectedCategories = [];
568      $('.alumni_business_directory .so
568rting input[type="checkbox"]:checked').each(
569        function () {
570          selectedCategories.push($(this).val());
571        }
572      );
573      var sortBy = $('.alumni_business_directory .sorting_dropdown').val();
574      var search = $('.alumni_business_directory .search_container input').val();
575      loadAllAlumniModule(selectedCategories, page, sortBy, search);
576    }
577  );
578  loadAllAlumniModule([], 1, "", "");
579  function loadAllAlumniModule(categories, page, sortBy, search) {
580    $(".alumni_business_directory .loadingIcon").show();
581    if ($("#alumni_business_directory").hasClass("pagination-clicked")) {
582      $("html, body").animate(
583        {
584          scrollTop: $("#alumni_business_directory").offset().top - 200,
585        },
586        1000
587      );
588    }
589    $.ajax({
590      type: "POST",
591      url: my_ajax_object.ajax_url,
592      data: {
593        action: "load-all-alumni-module",
594        categories: categories,
595        paged: page,
596        sortBy: sortBy,
597        search: search,
598        seed: new URL(window.location.href).searchParams.get('seed') || Math.floor(Math.random() * 1000000),
599      },
600      success: function (response) {
601        $(".alumni_business_directory .loadingIcon").hide();
602        $(".alumni_business_directory .main_cards").html(response);
603      },
604    });
605  }
606
607  // click on search_container span.search_icon
608  $('.alumni_business_directory .search_container span.search_icon').on('click', function () {
609    $('.alumni_business_directory .search_container').addClass('active');
610  });
611  $(document).on('click', function(e) {
612    if (!$(e.target).closest('.search_container').length) {
613      if ($('.alumni_business_directory .search_container input').val() === '') {
614        $('.alumni_business_directory .search_container').removeClass('active');
615      }
616    }
617  });
618
619  // do ajax search once input is changed
620  let searchTimeoutAl;
621  $('.alumni_business_directory .search_container input').on('input', function () {
622    clearTimeout(searchTimeoutAl);
623    searchTimeoutAl = setTimeout(() => {
624      var search = $('.alumni_business_directory .search_container input').val();
625      var selectedCategories = [];
626      $('.alumni_business_directory .sorting input[type="checkbox"]:checked').each(
627        function () {
628          selectedCategories.push($(this).val());
629        }
630      );
631      var sortBy = $('.alumni_business_directory .sorting_dropdown').val();
632      loadAllAlumniModule(selectedCategories, 1, sortBy, search);
633    }, 500);
634  });
635
636});

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.