PageSourceSearch

https://cmha.ca/wp-content/themes/cmha-national/js/app.js?ver=7.1.2

js cmha.ca collected 2026-09-24 08:28:59 UTC 32,170 bytes, 1,026 lines download raw bytes

1$(document).foundation();
2
3jQuery(document).ready(function ($) {
4  $("body").on("click", ".infographic-nav-buttons .button", function (e) {
5    e.preventDefault();
6    var $clickedElement = $(this);
7    var clickedId = $clickedElement.attr("data-name");
8    var content_page_id = $(this).data("page");
9    var content_page_title = $(this).data("page-title");
10    var $infographicContent = $(".infographic-content");
11    var $infographicTitle = $(".infographic-popup-title");
12    var $revealModal = $("#infographic-reveal");
13    var $infographicMessages = $(".infographic-error-messages");
14    var messageError = $infographicMessages.find(".error").text();
15    var messageErrorContent = $infographicMessages
16      .find(".content-error")
17      .text();
18    var messageErrorNoContent = $infographicMessages.find(".no-content").text();
19    var messageLoading = $infographicMessages.find(".loading").text();
20    $infographicTitle.html("");
21
22    var $currentData = $(
23      '.infogaphic-data-set .infogaphic-data[data-name="' + clickedId + '"]',
24    );
25
26    if ($currentData.length) {
27      var content_page_id = $currentData.data("page");
28      var content_page_title = $currentData.data("page-title");
29
30      // Find all .infogaphic-data elements
31      var $allData = $(".infogaphic-data-set .infogaphic-data");
32      var currentIndex = $allData.index($currentData);
33      var totalElements = $allData.length;
34
35      // Determine the next and previous
36      var nextIndex = (currentIndex + 1) % totalElements;
37      var prevIndex = (currentIndex - 1 + totalElements) % totalElements;
38
39      // Get the next and previous
40      var $nextData = $allData.eq(nextIndex);
41      var $prevData = $allData.eq(prevIndex);
42      // console.log($nextData);
43
44      // Get the data-page and data-page-title for next and previous
45      var nextPageId = $nextData.attr("data-page");
46      var nextPageTitle = $nextData.attr("data-page-title");
47      var nextPageName = $nextData.attr("data-name");
48      var prevPageId = $prevData.attr("data-page");
49      var prevPageTitle = $prevData.attr("data-page-title");
50      var prevPageName = $prevData.attr("data-name");
51    }
52
53    // Set data attributes on the navigation buttons
54    $(".infographic-nav-buttons .button.next")
55      .attr("data-page", nextPageId)
56      .attr("data-page-title", nextPageTitle)
57      .attr("data-name", nextPageName);
58    $(".infographic-nav-buttons .button.prev")
59      .attr("data-page", prevPageId)
60      .attr("data-page-title", prevPageTitle)
61      .attr("data-name", prevPageName);
62
63    $revealModal.addClass("loading");
64
65    if (content_page_id) {
66      $.ajax({
67        url: "/wp-admin/admin-ajax.php",
68        type: "POST",
69        data: {
70          action: "get_infographic_content",
71          page_id: content_page_id,
72        },
73        beforeSend: function () {
74          $infographicContent.html("<p>" + messageLoading + "</p>");
75          $revealModal.foundation("open");
76        },
77        success: function (response) {
78          if (response) {
79            $infographicContent.html(response);
80            $infographicTitle.html("<h2>" + content_page_title + "</h2>");
81            $revealModal.removeClass("loading");
82          } else {
83            $infographicContent.html("<p>" + messageErrorContent + "</p>");
84          }
85        },
86        error: function (errorThrown) {
87          console.log("AJAX Error:", errorThrown);
88          $infographicContent.html("<p>" + messageError + "</p>");
89        },
90      });
91    } else {
92      $revealModal.foundation("open");
93      $infographicContent.html("<p>" + messageErrorNoContent + "</p>");
94    }
95  });
96
97  $("body").on("click", "svg .svg-clickable", function () {
98    var $clickedElement = $(this);
99    var clickedId = $clickedElement.attr("id");
100    var content_page_id = $(this).data("page");
101    var content_page_title = $(this).data("page-title");
102    var $infographicContent = $(".infographic-content");
103    var $infographicTitle = $(".infographic-popup-title");
104    var $revealModal = $("#infographic-reveal");
105    var $infographicMessages = $(".infographic-error-messages");
106    var messageError = $infographicMessages.find(".error").text();
107    var messageErrorContent = $infographicMessages
108      .find(".content-error")
109      .text();
110    var messageErrorNoContent = $infographicMessages.find(".no-content").text();
111    var messageLoading = $infographicMessages.find(".loading").text();
112
113    $infographicTitle.html("");
114
115    var $currentData = $(
116      '.infogaphic-data-set .infogaphic-data[data-name="' + clickedId + '"]',
117    );
118
119    if ($currentData.length) {
120      var content_page_id = $currentData.data("page");
121      var content_page_title = $currentData.data("page-title");
122
123      var $allData = $(".infogaphic-data-set .infogaphic-data");
124      var currentIndex = $allData.index($currentData);
125      var totalElements = $allData.length;
126
127      // Determine the next and previous
128      var nextIndex = (currentIndex + 1) % totalElements;
129      var prevIndex = (currentIndex - 1 + totalElements) % totalElements;
130
131      // Get the next and previous
132      var $nextData = $allData.eq(nextIndex);
133      var $prevData = $allData.eq(prevIndex);
134
135      // Get the data-page and data-page-title for next and previous
136      var nextPageId = $nextData.attr("data-page");
137      var nextPageTitle = $nextData.attr("data-page-title");
138      var nextPageName = $nextData.attr("data-name");
139      var prevPageId = $prevData.attr("data-page");
140      var prevPageTitle = $prevData.attr("data-page-title");
141      var prevPageName = $prevData.attr("data-name");
142    }
143
144    // Set data attributes on the navigation buttons
145    $(".infographic-nav-buttons .button.next")
146      .attr("data-page", nextPageId)
147      .attr("data-page-title", nextPageTitle)
148      .attr("data-name", nextPageName);
149    $(".infographic-nav-buttons .button.prev")
150      .attr("data-page", prevPageId)
151      .attr("data-page-title", prevPageTitle)
152      .attr("data-name", prevPageName);
153
154    $revealModal.addClass("loading");
155
156    if (content_page_id) {
157      $.ajax({
158        url: "/wp-admin/admin-ajax.php",
159        type: "POST",
160        data: {
161          action: "get_infographic_content",
162          page_id: content_page_id,
163        },
164        beforeSend: function () {
165          $infographicContent.html("<p>" + messageLoading + "</p>");
166          $revealModal.foundation("open");
167        },
168        success: function (response) {
169          if (response) {
170            $infographicContent.html(response);
171            $infographicTitle.html("<h2>" + content_page_title + "</h2>");
172            $revealModal.removeClass("loading");
173          } else {
174            $infographicContent.html("<p>" + messageErrorContent + "</p>");
175          }
176        },
177        error: function (errorThrown) {
178          console.log("AJAX Error:", errorThrown);
179          $infographicContent.html("<p>" + messageError + "</p>");
180        },
181      });
182    } else {
183      $revealModal.foundation("open");
184      $infographicContent.html("<p>" + messageErrorNoContent + "</p>");
185    }
186  });
187
188  // Start - Snippet for adding missing class to svg paths for click not working in French. Affected URL - The Big Picture
189  function restoreSvgClasses() {
190    document.querySelectorAll("svg path.svg-clickable-circle").forEach((el) => {
191      el.classList.add("svg-clickable");
192    });
193  }
194
195  window.addEventListener("load", function () {
196    setTimeout(restoreSvgClasses, 300);
197  });
198  // End - Snippet for adding missing class to svg paths for click not working in French. Affected URL - The Big Picture
199
200  // Start - Snippet for styling tooltip CTA text. Affected URL - The Big Picture
201  function styleTooltipCTA() {
202    document.querySelectorAll('[id$="-tooltip"]').forEach((el) => {
203      el.innerHTML = el.innerHTML.replace(
204        /Click for more|Cliquez pour en savoir plus/gi,
205        '<span class="tooltip-cta">$&</span>',
206      );
207    });
208  }
209
210  window.addEventListener("load", () => {
211    setTimeout(styleTooltipCTA, 300);
212  });
213  // End - Snippet for styling tooltip CTA text. Affected URL - The Big Picture
214
215  if ($("#bounceback-province-modal").length) {
216    $("#bounceback-province-modal").foundation("open");
217  }
218
219  $("#bounceback-province-modal .accordion-content a").on(
220    "click",
221    function (e) {
222      var href = $(this).attr("href");
223      if (href == "#") {
224        e.preventDefault();
225        $("#bounceback-province-modal .accordion").hide();
226        $("#bounceback-province-modal .province-confirm-popup").show();
227
228        setTimeout(function () {
229          $("#bounceback-province-modal").foundation("close");
230        }, 2500);
231      } else {
232        $("#bounceback-province-modal").foundation("close");
233      }
234      $(".site-alert--location").hide();
235      Cookies.set("bounceback-location-popup", "closed", { expires: 7 });
236    },
237  );
238
239  //var iframe_src = $(this).find('iframe').attr('src');
240  //$(this).find('iframe').show().attr('src', iframe_src + '?autoplay=1');
241
242  $(document).on("open.zf.reveal", ".reveal-video[data-reveal]", function () {
243    //console.log('open modal');
244
245    var iframe_src = $(this).find("iframe").attr("src");
246    $(this)
247      .find("iframe")
248      .show()
249      .attr("src", iframe_src + "?autoplay=1");
250  });
251
252  $(document).on("closed.zf.reveal", ".reveal-video[data-reveal]", function () {
253    var iframe_src = $(this).data("src");
254    $(this).find("iframe").show().attr("src", iframe_src);
255  });
256
257  $(".page-template-template-mhw .gfield--type-fileupload input").change(
258    function (e) {
259      var file_name = e.target.files[0].name;
260      $(".page-template-template-mhw .gfield--type-fileupload label").html(
261        file_name,
262      );
263    },
264  );
265
266  $(".see-more").on("click", function () {
267    $(this).parents(".read-more-text").addClass("is-open");
268  });
269
270  $(".see-less").on("click", function () {
271    $(this).parents(".read-more-text").removeClass("is-open");
272  });
273
274  // $('.video-parent').on('click', function(){
275  // 	$(this).find('.video-poster-img').hide();
276  // 	$(this).find('video').show();
277  // 	$(this).find('video')[0].play();
278  // });
279
280  $("a.prevent-default").on("click", function (e) {
281    e.preventDefault();
282  });
283
284  $(".module-read-more-link").on("click", function (e) {
285    e.preventDefault();
286    $(this).parents(".module-inner").addClass("module-active");
287  });
288
289  $(".module-read-less-link").on("click", function (e) {
290    e.preventDefault();
291    $(this).parents(".module-inner").removeClass("module-active");
292  });
293
294  $('.section--impact-text-with-image .button[href*="#"]').on(
295    "click",
296    function (e) {
297      e.preventDefault();
298      var href = $(this).attr("href");
299      $("html,body").animate({ scrollTop: $(href).offset().top - 50 }, 500);
300    },
301  );
302
303  $(".accordion").on("down.zf.accordion", function (event) {
304    setTimeout(function () {
305      $("html,body").animate(
306        { scrollTop: $(".accordion-item.is-active").offset().top - 50 },
307        500,
308      );
309    }, 250);
310  });
311
312  //auto search locations
313
314  if ($(".search-map-location-request").length) {
315    //$('#wpsl-wrap').hide();
316    setTimeout(function () {
317      $(".search-map-location-request").each(function () {
318        var location_request = $(this).data("request");
319        console.log(location_request);
320        $("#wpsl-search-input").val("");
321        $("#wpsl-search-input").val(location_request);
322        $(".search-map-location-loading").hide();
323        $("#wpsl-wrap").show();
324        $("#wpsl-search-btn").click();
325      });
326    }, 5000);
327  }
328
329  //mobile slider
330
331  $(window).resize(function (e) {
332    if (window.innerWidth < 640) {
333      if (!$(".mobile-swipe-slider").hasClass("slick-initialized")) {
334        mobileOnlySlider();
335      }
336    } else {
337      if ($(".mobile-swipe-slider").hasClass("slick-initialized")) {
338        $(".mobile-swipe-slider").slick("unslick");
339      }
340    }
341  });
342
343  $(".number-countup").each(function (index, element) {
344    var count = $(this);
345    var num = count.data("number");
346    var counter = { var: 0 };
347    console.log(num);
348    //num = String(num);
349    //num = num.substring(1).replace(/,/g , '');
350    //console.log(num);
351    gsap.to(counter, {
352      var: num,
353      duration: 1.5,
354      scrollTrigger: element,
355      onUpdate: function () {
356        count.text(numberWithCommas(Math.ceil(counter.var)));
357      },
358    });
359  });
360
361  function numberWithCommas(x) {
362    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
363  }
364
365  initLogoSlider();
366  function initLogoSlider() {
367    $(".logo-slider").slick({
368      speed: 2000,
369      infinite: true,
370      slidesToShow: 8,
371      slidesToScroll: 1,
372      arrows: false,
373      swipeToSlide: true,
374      dots: false,
375      autoplay: true,
376      //autoplaySpeed: 2000,
377      autoplaySpeed: 0,
378      cssEase: "linear",
379      pauseOnHover: false,
380      pauseOnFocus: false,
381      draggable: false,
382      responsive: [
383        {
384          breakpoint: 1024,
385          settings: {
386            slidesToShow: 4,
387            slidesToScroll: 4,
388          },
389        },
390        {
391          breakpoint: 640,
392          settings: {
393            slidesToShow: 2,
394            slidesToScroll: 2,
395          },
396        },
397      ],
398    });
399  }
400
401  $(window).bind("resizeEnd", function () {
402    $(".logo-slider").slick("unslick");
403
404    setTimeout(function () {
405      initLogoSlider();
406    }, 500);
407  });
408
409  $(".testimonial-slider").slick({
410    autoplay: true,
411    speed: 1000,
412    autoplaySpeed: 5000,
413    infinite: true,
414    slidesToShow: 1,
415    slidesToScroll: 1,
416    arrows: true,
417    dots: true,
418    centerMode: false,
419    prevArrow: '<i class="fas fa-chevron-left slick-prev"></i>',
420    nextArrow: '<i class="fas fa-chevron-right slick-next"></i>',
421  });
422
423  $(".profile-carousel-wrapper").slick({
424    autoplay: false,
425    speed: 1000,
426    autoplaySpeed: 5000,
427    adaptiveHeight: true,
428    infinite: true,
429    slidesToShow: 3,
430    slidesToScroll: 3,
431    arrows: true,
432    dots: true,
433    centerMode: false,
434    responsive: [
435      {
436        breakpoint: 1024,
437        settings: {
438          slidesToShow: 2,
439          slidesToScroll: 2,
440        },
441      },
442      {
443        breakpoint: 640,
444        settings: {
445          slidesToShow: 1,
446          slidesToScroll: 1,
447        },
448      },
449    ],
450    prevArrow: '<i class="fas fa-chevron-left slick-prev"></i>',
451    nextArrow: '<i class="fas fa-chevron-right slick-next"></i>',
452  });
453
454  $(".stat-slider").slick({
455    autoplay: true,
456    speed: 1000,
457    autoplaySpeed: 7000,
458    infinite: true,
459    slidesToShow: 1,
460    slidesToScroll: 1,
461    arrows: false,
462    dots: true,
463    centerMode: false,
464  });
465
466  function mobileOnlySlider() {
467    $(".mobile-swipe-slider").slick({
468      autoplay: false,
469      speed: 1000,
470      autoplaySpeed: 5000,
471      infinite: true,
472      slidesToShow: 1,
473      slidesToScroll: 1,
474      arrows: false,
475      dots: true,
476      centerMode: true,
477    });
478  }
479
480  if (window.innerWidth < 640) {
481    mobileOnlySlider();
482
483    var elementHeights = $(".mobile-swipe-slider .slick-track .cell")
484      .map(function () {
485        return $(this).outerHeight();
486      })
487      .get();
488
489    var maxHeight = Math.max.apply(null, elementHeights);
490
491    $(".mobile-swipe-slider .slick-track").height(maxHeight);
492  }
493
494  //menu logic
495
496  $(".menu-wrapper-header .drilldown").on(
497    "open.zf.drilldown",
498    function (event) {
499      $(".menu-wrapper-header").addClass("submenu-open");
500    },
501  );
502
503  $(".menu-wrapper-header .drilldown").on(
504    "hide.zf.drilldown",
505    function (event) {
506      $(".menu-wrapper-header").removeClass("submenu-open");
507    },
508  );
509
510  $(".header-expanding-search:not(.mobile) a").on("click", function (e) {
511    e.preventDefault();
512    $(this).parents(".header-expanding-search").toggleClass("is-open");
513    $(this)
514      .parents(".header-expanding-search")
515      .find('input[type="text"]')
516      .focus();
517  });
518
519  $(".header-expanding-search.mobile a").on("click", function (e) {
520    e.preventDefault();
521    $(".slide-in-search").toggleClass("is-active");
522    $(".header-expanding-search.mobile").toggleClass("is-active");
523    $(".mobile-menu-toggle--wrapper").toggleClass("prevent-touch");
524    $(".multi-site-select-drilldown").toggleClass("prevent-touch");
525  });
526
527  $(document).on("click", function (e) {
528    if ($(".header-expanding-search:hover").length > 0) {
529    } else {
530      $(".header-expanding-search").removeClass("is-open");
531    }
532  });
533
534  //opens main menu
535  $(".mobile-menu-toggle--wrapper").on("click", function () {
536    $(".menu-wrapper-header").toggleClass("is-open");
537    $(".mobile-menu-toggle--wrapper").toggleClass("is-open");
538    $(".menu-wrapper-header").addClass("transition");
539    $(this).find(".mobile-menu-toggle").toggleClass("is-open");
540    $(".multisite-drilldown").removeClass("is-open");
541    $(".multi-site-select-drilldown").removeClass("is-open");
542    $("body").removeClass("multisite-drilldown-open");
543    toggleHeaderButtons();
544  });
545
546  $(window).bind("resizeEnd", function () {
547    $(".menu-wrapper-header").removeClass("transition");
548  });
549
550  //opens multisite menu
551  $(".multi-site-select-drilldown").on("click", function () {
552    $(".multisite-drilldown").toggleClass("is-open");
553    $(".multisite-drilldown").addClass("transition");
554    $("body").toggleClass("multisite-drilldown-open");
555    $("html, body").animate({ scrollTop: 0 }, "slow");
556    $(".multi-site-select-drilldown").toggleClass("is-open");
557    $(".menu-wrapper-header").removeClass("is-open");
558    $(".mobile-menu-toggle--wrapper").removeClass("is-open");
559    $(".mobile-menu-toggle").removeClass("is-open");
560    $(".header-expanding-search.mobile").toggleClass("prevent-touch");
561    $(".mobile-menu-toggle--wrapper").toggleClass("prevent-touch");
562  });
563
564  $(".dropdown-overlay").on("click", function () {
565    $("body").removeClass("multisite-drilldown-open");
566    $(".multisite-drilldown").removeClass("is-open");
567    $(".multi-site-select-drilldown").removeClass("is-open");
568  });
569
570  $(".multisite-drilldown--close").on("click", function () {
571    $("body").removeClass("multisite-drilldown-open");
572    $(".multisite-drilldown").removeClass("is-open");
573    $(".multi-site-select-drilldown").removeClass("is-open");
574    $(".header-expanding-search.mobile").removeClass("prevent-touch");
575    $(".mobile-menu-toggle--wrapper").removeClass("prevent-touch");
576  });
577
578  setTimeout(function () {
579    setDrilldownHeight();
580  }, 250);
581
582  $(window).bind("resizeEnd", function () {
583    $(".multisite-drilldown").removeClass("transition");
584    setDrilldownHeight();
585  });
586
587  $(document).keyup(function (e) {
588    if (e.key === "Escape") {
589      $("body").removeClass("multisite-drilldown-open");
590      $(".multisite-drilldown").removeClass("is-open");
591      $(".multi-site-select-drilldown").removeClass("is-open");
592    }
593  });
594
595  function setDrilldownHeight() {
596    var alertHeight = $(".site-alert").outerHeight();
597    var headerHeight = $(".site-header").outerHeight();
598    if ($(".site-alert-open").is(".is-closed")) {
599      alertHeight = 0;
600    }
601    var menuHeight = parseInt(alertHeight) + parseInt(headerHeight);
602    $(".multisite-drilldown").css(
603      "height",
604      "calc(100vh - " + menuHeight + "px)",
605    );
606
607    if ($(window).width() <= 640) {
608      mainHeight =
609        menuHeight + parseInt($(".site-alert--location").outerHeight());
610
611      $(".menu-wrapper-header").css("top", menuHeight + "px");
612      $("main").css("paddingTop", mainHeight + "px");
613      $(".site-header").css("marginTop", alertHeight + "px");
614      $(".menu-wrapper-header").css("top", menuHeight + "px");
615      $(".multisite-drilldown").css("top", menuHeight + "px");
616      $(".site-alert--location").css("top", menuHeight + "px");
617    } else {
618      $(".menu-wrapper-header").css("top", "0px");
619      $("main").css("paddingTop", "0px");
620      $(".site-header").css("marginTop", "0px");
621      $(".multisite-drilldown").css("top", "0px");
622      $(".site-alert--location").css("top", "0px");
623    }
624  }
625
626  function disableHeaderButtons() {
627    $(".header-expanding-search.mobile").addClass("prevent-touch");
628    $(".multi-site-select-drilldown.mobile").addClass("prevent-touch");
629  }
630
631  function enableHeaderButtons() {
632    $(".header-expanding-search.mobile").removeClass("prevent-touch");
633    $(".multi-site-select-drilldown.mobile").removeClass("prevent-touch");
634  }
635
636  function toggleHeaderButtons() {
637    $(".header-expanding-search.mobile").toggleClass("prevent-touch");
638    $(".multi-site-select-drilldown.mobile").toggleClass("prevent-touch");
639  }
640
641  //menu logic end
642
643  $(".submit-quiz").on("click", function (e) {
644    e.preventDefault();
645    console.log("submit quiz");
646    var total_questions = $(this)
647      .parents(".section--quiz")
648      .find(".radio-grid").length;
649    var total_questions_checked = $(this)
650      .parents(".section--quiz")
651      .find('input[type="radio"]:checked').length;
652    if (total_questions_checked == total_questions) {
653      var total_score = 0;
654      $(this)
655        .parents(".section--quiz")
656        .find('input[type="radio"]:checked')
657        .each(function () {
658          var radio_val = $(this).val();
659          total_score = parseInt(total_score) + parseInt(radio_val);
660        });
661      $(".score-number").text(total_score);
662      $(this)
663        .parents(".section--quiz")
664        .find(".results-text")
665        .each(function () {
666          var score_max = $(this).data("score-max");
667          var score_min = $(this).data("score-min");
668
669          console.log("Score: ", total_score, score_max);
670
671          if (
672            parseInt(total_score) <= parseInt(score_max) &&
673            parseInt(total_score) > parseInt(score_min)
674          ) {
675            $(this).show();
676          } else {
677            $(this).hide();
678          }
679
680          if (total_score == 0) {
681            console.log("score is 0");
682            $(this)
683              .parents(".section--quiz")
684              .find('.results-text[data-score-min="0"]')
685              .show();
686          }
687        });
688    } else {
689      alert("Please Fill In All Questions");
690    }
691  });
692
693  $(".blog-carousel").slick({
694    adaptiveHeight: false,
695    infinite: true,
696    dots: true,
697    slidesToShow: 3,
698    slidesToScroll: 1,
699    autoplay: true,
700    autoplaySpeed: 5000,
701    prevArrow: '<i class="fas fa-chevron-left slick-prev"></i>',
702    nextArrow: '<i class="fas fa-chevron-right slick-next"></i>',
703    responsive: [
704      {
705        breakpoint: 1385,
706        settings: {
707          slidesToShow: 2,
708          slidesToScroll: 1,
709        },
710      },
711      {
712        breakpoint: 640,
713        settings: {
714          slidesToShow: 1,
715          slidesToScroll: 1,
716        },
717      },
718    ],
719  });
720
721  var alert_cookie = Cookies.get("alert");
722
723  $(".alert-toggle-close").on("click", function () {
724    $(".site-alert").slideToggle(500, "swing", function () {});
725    $(".site-alert-open").addClass("is-closed");
726    $(".site-header").removeClass("header-banner-active");
727    $("main").removeClass("header-banner-active");
728    $(".menu-wrapper-header").removeClass("header-banner-active");
729    Cookies.set("alert", "closed");
730    setTimeout(function () {
731      setDrilldownHeight();
732    }, 500);
733  });
734
735  $(".site-alert-open").on("click", function () {
736    var alert_cookie = Cookies.get("alert");
737    Cookies.set("alert", "open");
738    $(".site-alert").slideToggle(500, "swing", function () {});
739    $(".site-alert-open").removeClass("is-closed");
740    $(".site-header").addClass("header-banner-active");
741    $("main").addClass("header-banner-active");
742    $(".menu-wrapper-header").addClass("header-banner-active");
743    //.menu-wrapper-header
744    setTimeout(function () {
745      setDrilldownHeight();
746    }, 500);
747  });
748
749  $(".site-header").on("show.zf.dropdownmenu", function (ev, $el) {
750    console.log("open");
751    $("body").addClass("dropdown-open");
752
753    $("body").removeClass("multisite-drilldown-open");
754    $(".multisite-drilldown").removeClass("is-open");
755    $(".multi-site-select-drilldown").removeClass("is-open");
756  });
757
758  $(".site-header").on("hide.zf.dropdownmenu", function (ev, $el) {
759    console.log("hide");
760    $("body").removeClass("dropdown-open");
761  });
762
763  $(".swipe-slider").slick({
764    adaptiveHeight: false,
765    infinite: true,
766    dots: true,
767    slidesToShow: 1,
768    slidesToScroll: 1,
769    autoplay: true,
770    autoplaySpeed: 5000,
771    prevArrow: '<i class="fas fa-chevron-left slick-prev"></i>',
772    nextArrow: '<i class="fas fa-chevron-right slick-next"></i>',
773  });
774
775  $(".btn--menu").on("click", function () {
776    $(this).toggleClass("is-active");
777    $(".menu-wrapper-header").toggleClass("is-open");
778    $(".menu-wrapper-header").addClass("transition");
779  });
780
781  // var controller2 = new ScrollMagic.Controller({globalSceneOptions: {triggerHook: "onEnter", duration: "200%"}});
782
783  // $('.parallax-bg').each(function(){
784  //     var currentParallax = this;
785
786  //     var tweenParallax = new TimelineMax()
787  //         .to(currentParallax, 1, {y: "-15%", ease: Linear.easeNone})
788
789  //     var sceneParallax = new ScrollMagic.Scene({triggerElement: currentParallax})
790  //         .setTween(tweenParallax)
791  //         .addTo(controller2);
792  // });
793
794  // $(window).scroll(function(){
795  //    var currentScroll = $(this).scrollTop();
796  //    if (currentScroll > 50){
797  // 	   jQuery('.site-header').addClass('is-scrolled');
798  //    } else {
799  // 	  jQuery('.site-header').removeClass('is-scrolled');
800  //    }
801  // });
802
803  $(".site-header .menu").addClass("loaded");
804
805  $(document).on("click", ".js-load-more", function (event) {
806    var $this, $load_more, href;
807    $this = $(this);
808    $load_more = $(".load-more");
809    href = $this.attr("href");
810    if (href) {
811      event.preventDefault();
812      $(".js-load-more").text($(".js-load-more").data("load"));
813      $.ajax({
814        url: href,
815        dataType: "html",
816      })
817        .done(function (data) {
818          var $posts, $posts_new;
819          $posts = $(".paginated-list");
820          $posts_new = $(data).find(".paginated-list").children();
821          $posts_new.appendTo($posts);
822          $load_more.remove();
823
824          setTimeout(function () {
825            ScrollTrigger.refresh();
826          }, 250);
827        })
828        .fail(function () {
829          console.log("Failed to load additional results.");
830        });
831    }
832  });
833
834  bindScrollTrigger();
835
836  function bindScrollTrigger() {
837    ScrollTrigger.batch(".batch-slide-up", {
838      interval: 0.2,
839      batchMax: 3,
840      onEnter: (batch) => {
841        gsap.to(batch, { autoAlpha: 1, y: 0, stagger: 0.25, overwrite: true });
842        //gsap.set(batch, {className:"+=grid-container animated"});
843      },
844      onLeave: (batch) => {
845        gsap.set(batch, { autoAlpha: 0, y: 50, overwrite: true });
846      },
847      onEnterBack: (batch) =>
848        gsap.to(batch, { autoAlpha: 1, y: 0, stagger: 0.25, overwrite: true }),
849      onLeaveBack: (batch) =>
850        gsap.set(batch, { autoAlpha: 0, y: 50, overwrite: true }),
851    });
852  }
853
854  bindSimpleFade();
855
856  function bindSimpleFade() {
857    ScrollTrigger.batch(".simple-fade", {
858      interval: 0.2,
859      batchMax: 3,
860      onEnter: (batch) => {
861        gsap.to(batch, { autoAlpha: 1, stagger: 0.25, overwrite: true });
862        //gsap.set(batch, {className:"+=grid-container animated"});
863      },
864      onLeave: (batch) => {
865        gsap.set(batch, { autoAlpha: 0, overwrite: true });
866      },
867      onEnterBack: (batch) =>
868        gsap.to(batch, { autoAlpha: 1, stagger: 0.25, overwrite: true }),
869      onLeaveBack: (batch) =>
870        gsap.set(batch, { autoAlpha: 0, overwrite: true }),
871    });
872  }
873
874  // gsap.utils.toArray("section.parallax-section").forEach((section, i) => {
875  //   console.log(section);
876  //   section.bg = section.querySelector(".parallax-bg");
877
878  //   if (i) {
879  //     section.bg.style.backgroundPosition = `50% ${-innerHeight / 2}px`;
880  // 	//section.bg.style.backgroundPosition = "50% -120px";
881  //     gsap.to(section.bg, {
882  //       backgroundPosition: `50% ${innerHeight / 2 * -1}px`,
883  //       ease: "none",
884  //       scrollTrigger: {
885  //         trigger: section,
886  //         start: "-100% top",
887  //         end: "bottom top",
888  //         scrub: true
889  //       }
890  //     });
891  //   } else {
892  //     section.bg.style.backgroundPosition = "50% -120px";
893
894  //     gsap.to(section.bg, {
895  //       backgroundPosition: `50% ${innerHeight / 2 * -1}px`,
896  //       ease: "none",
897  //       scrollTrigger: {
898  //         trigger: section,
899  //         start: "-100% top",
900  //         end: "bottom top",
901  //         scrub: true
902  //       }
903  //     });
904  //   }
905
906  // });
907
908  console.log(`Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
909License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)`);
910
911  $("body").addClass("loaded");
912
913  var quiz_total = 0;
914  $("body").on(
915    "change",
916    '#gform_44 input[type="radio"], #gform_45 input[type="radio"]',
917    function () {
918      quiz_total = 0;
919      $(this)
920        .parents("form")
921        .
921find('input[type="radio"]:checked')
922        .each(function () {
923          var value = $(this).val();
924          value = parseInt(value);
925          quiz_total = quiz_total + value;
926        });
927      $(this)
928        .parents("form")
929        .find('.gform_hidden input[type="hidden"]')
930        .val(quiz_total);
931      //console.log(quiz_total);
932    },
933  );
934
935  $(".check-program-eligibility").on("click", function (e) {
936    e.preventDefault();
937    var checkboxes = $(".eligibility-checkbox").length;
938    var checked_checkboxes = $(
939      '.eligibility-checkbox input[type="checkbox"]:checked',
940    ).length;
941    if (checkboxes == checked_checkboxes) {
942      $(".eligibility-true-text").show();
943      $(".eligibility-false-text").hide();
944      $(".check-program-eligibility").hide();
945    } else {
946      $(".eligibility-true-text").hide();
947      $(".eligibility-false-text").show();
948      $(".check-program-eligibility").hide();
949    }
950  });
951
952  $(".eligibility-checkbox").on("change", function () {
953    $(".eligibility-true-text").hide();
954    $(".eligibility-false-text").hide();
955    $(".check-program-eligibility").show();
956  });
957
958  // if( window.location.href === 'https://cmha.ca/bounce-back/' ||
959  // 	window.location.href === 'https://cmha.ca/fr/bounce-back/' ) {
960
961  // 	getRegion();
962  // }
963
964  // function getRegion(){
965  // 	var href = 'https://geouser.cmha.workers.dev/';
966
967  // 	const client = new XMLHttpRequest();
968  // 	client.open("GET", href, true);
969  // 	client.send();
970
971  // 	client.onreadystatechange = () => {
972  // 	  if (client.readyState === client.HEADERS_RECEIVED) {
973  // 	    var user_province = client.getResponseHeader('cf_user_province');
974
975  // 	    // determine whether to show the alert bar
976  // 	    console.log('Province:', user_province);
977
978  // 	    var alternative_websites = {
979  // 	    	'BC': 'https://bouncebackbc.ca/',
980  // 	    	'MB': 'https://bouncebackmb.cmha.ca/',
981  // 	    	'NB': 'https://cmhanb.ca/bounceback/',
982  // 	    	'ON': 'https://bouncebackontario.ca/',
983  // 	    	'QC': 'https://bouncebackqc.ca/',
984  // 	    }
985
986  // 	    if( alternative_websites[user_province] ) {
987  // 	    	// console.log('User Province matches site: ', alternative_websites[user_province]);
988  // 	    	$('#provincial-website-url').html( '<a href="' + alternative_websites[user_province] + '">' + alternative_websites[user_province] + '</a>' );
989  // 	    	$('#provincial-website-alert').show();
990  // 	    }
991
992  // 	  }
993
994  // 	}
995  //console.log('bounce back page');
996  // }
997
998  $(".site-alert--location .menu .menu a").on("click", function (e) {
999    var href = $(this).attr("href");
1000    if (href == "#") {
1001      e.preventDefault();
1002      $(".site-alert--location .text-with-dropdown").hide();
1003      $(".site-alert--location .province-confirm").show();
1004
1005      setTimeout(function () {
1006        $(".site-alert--location").hide();
1007      }, 1500);
1008    }
1009
1010    Cookies.set("bounceback-location-popup", "closed", { expires: 7 });
1011  });
1012
1013  $(".alert-location-close").on("click", function () {
1014    $(".site-alert--location").hide();
1015  });
1016});
1017
1018$(window).bind("resizeEnd", function () {});
1019
1020$(window).resize(function () {
1021  if (this.resizeTO) clearTimeout(this.resizeTO);
1022
1023  this.resizeTO = setTimeout(function () {
1024    $(this).trigger("resizeEnd");
1025  }, 500);
1026});

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.