PageSourceSearch

https://cldbm.qc.ca/wp-content/themes/income-wp/assets/js/main.js?ver=7.0.4

js cldbm.qc.ca collected 2026-10-06 19:31:44 UTC 19,293 bytes, 766 lines download raw bytes

1(function($) {
2	
3	"use strict";
4	
5/* ==========================================================================
6   ieViewportFix - fixes viewport problem in IE 10 SnapMode and IE Mobile 10
7   ========================================================================== */
8   
9	function ieViewportFix() {
10	
11		var msViewportStyle = document.createElement("style");
12		
13		msViewportStyle.appendChild(
14			document.createTextNode(
15				"@-ms-viewport { width: device-width; }"
16			)
17		);
18
19		if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
20			
21			msViewportStyle.appendChild(
22				document.createTextNode(
23					"@-ms-viewport { width: auto !important; }"
24				)
25			);
26		}
27		
28		document.getElementsByTagName("head")[0].
29				appendChild(msViewportStyle);
30
31	}
32
33/* ==========================================================================
34   exists - Check if an element exists
35   ========================================================================== */		
36	
37	function exists(e) {
38		return $(e).length > 0;
39	}
40
41/* ==========================================================================
42   isTouchDevice - return true if it is a touch device
43   ========================================================================== */
44
45	function isTouchDevice() {
46		return !!('ontouchstart' in window) || ( !! ('onmsgesturechange' in window) && !! window.navigator.maxTouchPoints);
47	}
48
49/* ==========================================================================
50   setDimensionsPieCharts
51   ========================================================================== */
52	
53	function setDimensionsPieCharts() {
54
55		$('.pie-chart').each(function() {
56
57			var $t = $(this),
58				n = $t.parent().width(),
59				r = $t.attr("data-barSize");
60			
61			if (n < r) {
62				r = n;
63			}
64			
65			$t.css({
66				"height": r,
67				"width": r,
68				"line-height": r + "px"
69			});
70			
71			$t.find("i").css({
72				"line-height": r + "px",
73				"font-size": r / 3
74			});
75			
76		});
77
78	}
79
80/* ==========================================================================
81   animatePieCharts
82   ========================================================================== */
83
84	function animatePieCharts() {
85
86		if(typeof $.fn.easyPieChart !== 'undefined'){
87
88			$('.pie-chart:in-viewport').each(function() {
89	
90				var $t = $(this),
91					n = $t.parent().width(),
92					r = $t.attr("data-barSize"),
93					l = "square";
94				
95				if ($t.attr("data-lineCap") !== undefined) {
96					l = $t.attr("data-lineCap");
97				} 
98				
99				if (n < r) {
100					r = n;
101				}
102				
103				$t.easyPieChart({
104					animate: 1300,
105					lineCap: l,
106					lineWidth: $t.attr("data-lineWidth"),
107					size: r,
108					barColor: $t.attr("data-barColor"),
109					trackColor: $t.attr("data-trackColor"),
110					scaleColor: "transparent",
111					onStep: function(from, to, percent) {
112						$(this.el).find('.pie-chart-percent span').text(Math.round(percent));
113					}
114	
115				});
116				
117			});
118			
119		}
120
121	}
122
123/* ==========================================================================
124   animateMilestones
125   ========================================================================== */
126
127	function animateMilestones() {
128
129		$('.milestone:in-viewport').each(function() {
130			
131			var $t = $(this),
132				n = $t.find(".milestone-value").attr("data-stop"),
133				r = parseInt($t.find(".milestone-value").attr("data-speed"), 10);
134				
135			if (!$t.hasClass("already-animated")) {
136				$t.addClass("already-animated");
137				$({
138					countNum: $t.find(".milestone-value").text()
139				}).animate({
140					countNum: n
141				}, {
142					duration: r,
143					easing: "linear",
144					step: function() {
145						$t.find(".milestone-value").text(Math.floor(this.countNum));
146					},
147					complete: function() {
148						$t.find(".milestone-value").text(this.countNum);
149					}
150				});
151			}
152			
153		});
154
155	}
156
157/* ==========================================================================
158   animateProgressBars
159   ========================================================================== */
160
161	function animateProgressBars() {
162
163		$('.progress-bar .progress-bar-outer:in-viewport').each(function() {
164			
165			var $t = $(this);
166			
167			if ($t.attr("data-progress-bar-outer-color") !== undefined) {
168				$t.css("background-color", $t.attr("data-progress-bar-outer-color"));
169			}
170			
171			if (!$t.hasClass("already-animated")) {
172				$t.addClass("already-animated").animate({
173					width: $t.attr("data-width") + "%"
174				}, 2000);
175			}
176			
177		});
178
179	}
180
181/* ==========================================================================
182   enableParallax
183   ========================================================================== */
184
185	function enableParallax() {
186
187		// vertical parallax
188		if(typeof $.fn.parallax !== 'undefined'){
189			
190			$('.parallax').each(function() {
191	
192				var $t = $(this);
193				$t.addClass("parallax-enabled").parallax("49%", 0.3, false);
194	
195			});
196			
197		}
198		
199		// horizontal parallax
200		if(typeof $.fn.hparallax !== 'undefined'){
201		
202			$('.horizontal-parallax').each(function() {
203	
204				var $t = $(this);
205				$t.addClass("horizontal-parallax-enabled").hparallax();
206	
207			});
208			
209		}
210		
211		//animated parallax
212		if(typeof $.fn.animatedparallax !== 'undefined'){
213		
214			$('.animated-parallax').each(function() {
215	
216				var $t = $(this);
217				$t.addClass("animated-parallax-enabled").animatedparallax();
218	
219			});
220		
221		}
222
223	}
224
225
226/* ==========================================================================
227   handleMobileMenu 
228   ========================================================================== */		
229
230	var MOBILEBREAKPOINT = 991;
231
232	function handleMobileMenu() {
233
234		if ($(window).width() > MOBILEBREAKPOINT) {
235			
236			$("#mobile-menu").hide();
237			$("#mobile-menu-trigger").removeClass("mobile-menu-opened").addClass("mobile-menu-closed");
238		
239		} else {
240			
241			if (!exists("#mobile-menu")) {
242				
243				$("#menu").clone().attr({
244					id: "mobile-menu",
245					"class": "fixed"
246				}).insertAfter("#header");
247				
248				$("#mobile-menu > li > a, #mobile-menu > li > ul > li > a").each(function() {
249					var $t = $(this);
250					if ($t.next().hasClass('sub-menu') || $t.next().is('ul') || $t.next().is('.sf-mega')) {
251						$t.append('<span class="fa fa-angle-down mobile-menu-submenu-arrow mobile-menu-submenu-closed"></span>');
252					}
253				});
254			
255				$(".mobile-menu-submenu-arrow").on("click", function(event) {
256					var $t = $(this);
257					if ($t.hasClass("mobile-menu-submenu-closed")) {
258						$t.removeClass("mobile-menu-submenu-closed fa-angle-down").addClass("mobile-menu-submenu-opened fa-angle-up").parent().siblings("ul, .sf-mega").slideDown(300);
259					} else {
260						$t.removeClass("mobile-menu-submenu-opened fa-angle-up").addClass("mobile-menu-submenu-closed fa-angle-down").parent().siblings("ul, .sf-mega").slideUp(300);
261					}
262					event.preventDefault();
263				});
264				
265				$("#mobile-menu li, #mobile-menu li a, #mobile-menu ul").attr("style", "");
266				
267			}
268			
269		}
270
271	}
272	
273/* ==========================================================================
274   showHideMobileMenu
275   ========================================================================== */
276
277	function showHideMobileMenu() {
278		
279		$("#mobile-menu-trigger").on("click", function(event) {
280			
281			var $t = $(this),
282				$n = $("#mobile-menu");
283			
284			if ($t.hasClass("mobile-menu-opened")) {
285				$t.removeClass("mobile-menu-opened").addClass("mobile-menu-closed");
286				$n.slideUp(300);
287			} else {
288				$t.removeClass("mobile-menu-closed").addClass("mobile-menu-opened");
289				$n.slideDown(300);
290			}
291			event.preventDefault();
292			
293		});
294		
295	}
296	
297   
298/* ==========================================================================
299   handleBackToTop
300   ========================================================================== */
301   
302   function handleBackToTop() {
303	   
304		$('#back-to-top').on("click", function(){
305			$('html, body').animate({scrollTop:0}, 'slow');
306			return false;
307		});
308   
309   }
310   	
311/* ==========================================================================
312   showHidebackToTop
313   ========================================================================== */	
314	
315	function showHidebackToTop() {
316	
317		if ($(window).scrollTop() > $(window).height() / 2 ) {
318			$("#back-to-top").removeClass('gone').addClass('visible');
319		} else {
320			$("#back-to-top").removeClass('visible').addClass('gone');
321		}
322	
323	}
324
325/* ==========================================================================
326   handleSearch
327   ========================================================================== */
328   
329	function handleSearch() {	
330		
331		$("#custom-search-button").on("click", function(e) { 
332	
333			e.preventDefault();
334			
335			if(!$("#custom-search-button").hasClass('open')) {
336			
337				$("#custom-search-form-container").fadeIn(200);
338				
339			} else {
340				
341				$("#custom-search-form-container").fadeOut(200);	
342			
343			}
344			
345		});
346		
347		$('#custom-search-form').append('<a class="custom-search-form-close" href="#" title="Close Search Box">x</a>');
348		
349		$('#custom-search-form-container a.custom-search-form-close').on("click", function(event){
350			
351			event.preventDefault();
352			$('#custom-search-form-container').fadeOut(200);
353			
354		});
355		
356	 }
357
358/* ==========================================================================
359   handleStickyHeader
360   ========================================================================== */	 
361	
362	var stickypoint = 500;
363	
364	if ($('body').hasClass('sticky-header')){
365		stickyHeader = true;
366	}
367	
368	stickypoint = $("#header-top").outerHeight() + $("#header-wrap").outerHeight() + 150;
369	
370	function handleStickyHeader() {
371	
372		var b = document.documentElement,
373        	e = false;
374
375		function f() {
376			
377			window.addEventListener("scroll", function (h) {
378				
379				if (!e) {
380					e = true;
381					setTimeout(d, 250);
382				}
383			}, false);
384			
385			window.addEventListener("load", function (h) {
386				
387				if (!e) {
388					e = true;
389					setTimeout(d, 250);
390				}
391			}, false);
392		}
393	
394		function d() {
395			
396			var h = c();
397			
398			if (h >= stickypoint) {
399				$('#header').addClass("stuck");
400			} else {
401				$('#header').removeClass("stuck");
402			}
403			
404			e = false;
405		}
406	
407		function c() {
408			
409			return window.pageYOffset || b.scrollTop;
410			
411		}
412		
413		f();
414		
415	}	
416	
417/* ==========================================================================
418   handleFullScreen
419   ========================================================================== */
420	
421	function handleFullScreen() {
422		
423		var x = $(window).height();
424		
425		$('.fullscreen').css("height", x + "px");
426		
427	}
428	 
429/* ==========================================================================
430   When document is ready, do
431   ========================================================================== */
432   
433	$(document).ready(function() {			   
434		
435		ieViewportFix();
436		
437		setDimensionsPieCharts();
438		
439		animatePieCharts();
440		animateMilestones();
441		animateProgressBars();
442
443		if (!isTouchDevice()) {
444			enableParallax();
445		}
446		
447		handleMobileMenu();
448		showHideMobileMenu();
449		
450		handleBackToTop();
451		showHidebackToTop();
452		
453		handleFullScreen();
454		
455		handleSearch();
456		
457		if(income_sticky.income_sticky && ($(window).width() > 1024)){ 
458			handleStickyHeader();
459		}
460		
461		// twitterFetcher
462		// http://jasonmayes.com/projects/twitterApi/
463		
464		if(typeof twitterFetcher !== 'undefined' && ($('.income_widget_latest_tweets').length > 0)) {
465			
466			$('.income_widget_latest_tweets').each(function(index){
467			
468				var account_id = $('.income-tweet-list', this).attr('data-account-id'),
469					items = $('.income-tweet-list', this).attr('data-items'),
470					newID = 'income-tweet-list-' + index;
471				
472				$('.income-tweet-list', this).attr('id', newID);
473				
474				var config = {
475				  "id": account_id,
476				  "domId": newID,
477				  "maxTweets": items,
478				  "showRetweet": false,
479				  "showTime": false,
480				  "showUser": false
481				};
482				
483				twitterFetcher.fetch(config);
484			});
485			
486		}
487		
488		// Fitvids - fluid width video embeds
489		// https://github.com/davatron5000/FitVids.js/blob/master/README.md
490		
491		if(typeof $.fn.fitVids !== 'undefined'){
492			
493			$('.fitvids,.responsive-embed,.format-video').fitVids();
494		
495		}
496		
497		// Superfish - enhance pure CSS drop-down menus
498		// http://users.tpg.com.au/j_birch/plugins/superfish/options/
499		
500		if(typeof $.fn.superfish !== 'undefined'){
501			
502			$('#menu').superfish({
503				delay: 500,
504				animation: {opacity:'show',height:'show'},
505				speed: 100,
506				cssArrows: true
507			});
508			
509		}
510		
511		// Revolution Slider
512		
513		if(typeof $.fn.revolution !== 'undefined'){
514			
515			$('.fullwidthbanner').revolution({
516				delay:9000,
517				startwidth:1170,
518				startheight:600,
519				startWithSlide:0,
520
521				fullScreenAlignForce:"off",
522				autoHeight:"off",
523				minHeight:"off",
524
525				shuffle:"off",
526
527				onHoverStop:"on",
528
529				thumbWidth:100,
530				thumbHeight:50,
531				thumbAmount:3,
532
533				hideThumbsOnMobile:"off",
534				hideNavDelayOnMobile:1500,
535				hideBulletsOnMobile:"off",
536				hideArrowsOnMobile:"off",
537				hideThumbsUnderResoluition:0,
538
539				hideThumbs:0,
540				hideTimerBar:"off",
541
542				keyboardNavigation:"on",
543
544				navigationType:"bullet",
545				navigationArrows:"solo",
546				navigationStyle:"round",
547
548				navigationHAlign:"center",
549				navigationVAlign:"bottom",
550				navigationHOffset:0,
551				navigationVOffset:30,
552
553				soloArrowLeftHalign:"left",
554				soloArrowLeftValign:"center",
555				soloArrowLeftHOffset:50,
556				soloArrowLeftVOffset:0,
557
558				soloArrowRightHalign:"right",
559				soloArrowRightValign:"center",
560				soloArrowRightHOffset:50,
561				soloArrowRightVOffset:0,
562
563
564				touchenabled:"off",
565				swipe_velocity:"0.7",
566				swipe_max_touches:"1",
567				swipe_min_touches:"1",
568				drag_block_vertical:"false",
569
570				parallax:"mouse",
571				parallaxBgFreeze:"on",
572				parallaxLevels:[10,7,4,3,2,5,4,3,2,1],
573				parallaxDisableOnMobile:"off",
574
575				stopAtSlide:-1,
576				stopAfterLoops:-1,
577				hideCaptionAtLimit:0,
578				hideAllCaptionAtLilmit:0,
579				hideSliderAtLimit:0,
580
581				dottedOverlay:"none",
582
583				spinned:"spinner4",
584
585				fullWidth:"off",
586				forceFullWidth:"off",
587				fullScreen:"off",
588				fullScreenOffsetContainer:"#topheader-to-offset",
589				fullScreenOffset:"0px",
590
591				panZoomDisableOnMobile:"off",
592
593				simplifyAll:"off",
594
595				shadow:0
596			});
597				
598		}
599		
600		// bxSlider - responsive slider
601		// http://bxslider.com/options
602		
603		if(typeof $.fn.bxSlider !== 'undefined'){
604			
605			$('.images-slider .slides').bxSlider({
606				 mode: 'fade',							// Type of transition between slides: 'horizontal', 'vertical', 'fade'		
607				 speed: 500,							// Slide transition duration (in ms)
608				 infiniteLoop: true,					// If true, clicking "Next" while on the last slide will transition to the first slide and vice-versa.
609				 hideControlOnEnd: false,				// If true, "Next" control will be hidden on last slide and vice-versa. Only used when infiniteLoop: false
610				 pager: true,							// If true, a pager will be added
611				 pagerType: 'full',						// If 'full', a pager link will be generated for each slide. If 'short', a x / y pager will be used (ex. 1/5)
612				 controls: false,						// If true, "Next" / "Prev" controls will be added
613				 auto: true,							// If true, slides will automatically transition
614				 pause: 4000,							// The amount of time (in ms) between each auto transition
615				 autoHover: true,						// Auto show will pause when mouse hovers over slider
616				 useCSS: false 							// If true, CSS transitions will be used for animations. False, jQuery animations. Setting to false fixes problem with jQuery 2.1.0 and mode:horizontal
617			});
618			
619			$('.testimonial-slider .slides').bxSlider({
620				 mode: 'fade',							// Type of transition between slides: 'horizontal', 'vertical', 'fade'		
621				 speed: 500,							// Slide transition duration (in ms)
622				 infiniteLoop: true,					// If true, clicking "Next" while on the last slide will transition to the first slide and vice-versa.
623				 hideControlOnEnd: false,				// If true, "Next" control will be hidden on last slide and vice-versa. Only used when infiniteLoop: false
624				 pager: true,							// If true, a pager will be added
625				 pagerType: 'full',						// If 'full', a pager link will be generated for each slide. If 'short', a x / y pager will be used (ex. 1/5)
626				 controls: false,						// If true, "Next" / "Prev" controls will be added
627				 auto: true,							// If true, slides will automatically transition
628				 pause: 4000,							// The amount of time (in ms) between each auto transition
629				 autoHover: true,						// Auto show will pause when mouse hovers over slider
630				 useCSS: false 							// If true, CSS transitions will be used for animations. False, jQuery animations. Setting to false fixes problem with jQuery 2.1.0 and mode:horizontal
631			});
632			
633		}
634				
635		// Magnific PopUp - responsive lightbox
636		// http://dimsemenov.com/plugins/magnific-popup/documentation.html
637		
638		if(typeof $.fn.magnificPopup !== 'undefined'){
639		
640			$('.magnificPopup').magnificPopup({
641				disableOn: 400,
642				closeOnContentClick: true,
643				type: 'image'
644			});
645			
646			$('.magnificPopup-gallery').magnificPopup({
647				disableOn: 400,
648				type: 'image',
649				gallery: {
650					enabled: true
651				}
652			});
653			
654			$('.magnificPopup-modal').magnificPopup({
655				type: 'inline',
656				preloader: false,
657				modal: true
658			});
659			
660			$(document).on('click', '.magnificPopup-modal-dismiss', function (e) {
661				e.preventDefault();
662				$.magnificPopup.close();
663			});
664		
665		}
666
667		// gMap -  embed Google Maps into your website; uses Google Maps v3
668		// http://labs.mario.ec/jquery-gmap/
669		
670		if(typeof $.fn.gMap !== 'undefined'){
671		
672			//handleGoogleMapHeight();
673			
674			$('.google-map').each(function() {
675				
676				var $t = $(this),
677					mapZoom = 15,
678					mapAddress = $t.attr("data-address"),
679					mapCaption = $t.attr("data-caption"),
680					mapType = "ROADMAP",
681					mapHeight = $t.attr("data-mapheight"),
682					popUp = false;
683				
684				if ($t.attr("data-zoom") !== undefined) {
685					mapZoom = parseInt($t.attr("data-zoom"),10);
686				}	
687				
688				if ($t.attr("data-mapHeight") !== undefined) {
689					$t.css( "height", mapHeight+'px');
690				}
691				
692				if ($t.attr("data-maptype") !== undefined) {
693					mapType = $t.attr("data-maptype");
694				} 
695				
696				if ($t.attr("data-popup") !== undefined) {
697					popUp = $t.data("popup");
698				} 
699				
700				$t.gMap({
701					maptype: mapType,
702					scrollwheel: false,
703					zoom: mapZoom,
704					markers: [{
705						address: mapAddress,
706						html: mapCaption,
707						popup: popUp
708					}],
709					controls: {
710						panControl: true,
711						zoomControl: true,
712						mapTypeControl: true,
713						scaleControl: false,
714						streetViewControl: false,
715						overviewMapControl: false
716					}
717				});
718		
719			});
720			
721		}
722		
723	});
724
725/* ==========================================================================
726   When the window is scrolled, do
727   ========================================================================== */
728   
729	$(window).scroll(function() {				   
730		
731		animateMilestones();
732		animatePieCharts();
733		animateProgressBars();
734		
735		showHidebackToTop();
736		
737		if(income_sticky.income_sticky && ($(window).width() > 1024)){ 
738			handleStickyHeader();
739		}
740		
741
742	});
743
744/* ==========================================================================
745   When the window is resized, do
746   ========================================================================== */
747   
748	$(window).resize(function() {
749		
750		handleMobileMenu();
751		
752		if(income_sticky.income_sticky && ($(window).width() > 1024)){ 
753			handleStickyHeader();
754		}
755		
756		handleFullScreen();
757		
758	});
759	
760
761})(jQuery);
762
763// non jQuery scripts below
764
765
766

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.