PageSourceSearch

https://www.editionsboreal.qc.ca/js/main.js?v=1/9/2026_09:38:36AM

js editionsboreal.qc.ca collected 2026-09-24 18:03:30 UTC 50,636 bytes, 1,595 lines download raw bytes

1$(function(){
2
3  $(".customSelect").selectmenu({
4    open: function() {
5      $lst = $(this); $('div.ui-selectmenu-menu li.ui-menu-item').each(function (idx) {
6        $(this).addClass($('select#' + $lst.attr('id') + ' option').eq(idx).attr('class'))
7      });
8    }
9  });
10
11		/* - - - - GEOLOCALISATION - - - - */
12		if(activerGeolocalisationParNavigateur == 1){
13			var getGeolocalisation = function(){
14				if(navigator.geolocation) {
15					navigator.geolocation.getCurrentPosition(function(position) {
16						//accepté
17						$.ajax({
18							data: {
19								latitude: position.coords.latitude
20								,longitude: position.coords.longitude
21								,type: 2
22							}
23							,type: "post"
24							,dataType : "json"
25							,url: "inc/ajax/localisateur/majGeoLocalisation.cfm"
26							,success: function(data) {
27								if(data.estSucces === 1){
28									window.location = '//' + location.host + location.pathname + location.search;
29								}
30							}
31						});
32					}, function(error) {
33						// refusé
34						if(error.code == error.PERMISSION_DENIED) {
35							$.ajax({
36								data: {type: 3}
37								,type: "post"
38								,dataType : "json"
39								,url: "inc/ajax/localisateur/majGeoLocalisation.cfm"
40								,success: function(data) {}
41							});
42						}
43					});
44				} else {}
45			}
46
47			getGeolocalisation();
48		}
49
50
51	/* - - - - MENU BURGER modifié pour ecom - - - - */
52	function BurgerMove() {
53		$(".avecSousMenu > a, .menuSansLien").removeClass('js-sousMenu-ouvert');
54		$("#btn-menuBurger").toggleClass('js-menu-ouvert');
55		$(".conteneur").toggleClass('js-menu-ouvert');
56		return this;
57	};
58
59	$menuBurger = $("#menuBurger");
60	$("#btn-menuBurger, #btn-menuBurger-fermer").on('click', function(e){
61    e.preventDefault();
62    BurgerMove();
63  });
64
65	/* Sous-menu */
66	$menuBurger.find(".avecSousMenu > a .btn-sousMenu").on('click', function(){
67		$(this).parent().parent().find(".avecSousMenu a").not($(this)).removeClass('js-sousMenu-ouvert');
68		$(this).parent().toggleClass('js-sousMenu-ouvert');
69		return false;
70	});
71
72	$menuBurger.find(".menuSansLien").on('click', function(){
73		$(this).toggleClass('js-sousMenu-ouvert');
74		return false;
75	});
76
77	/* Bouton retour pour menu en panneau */
78	$menuBurger.find(".sousMenu_retour").on('click', function(){
79		$(this).parent().parent().prev().removeClass('js-sousMenu-ouvert');
80	});
81	/* Ferme le menu sur click extérieur */
82	$(document).on( "mouseup touchend", function(e){
83		if ($(e.target).closest($("#menuBurger")).length === 0 && $(e.target).closest($(".btn-menuBurger")).length === 0) {
84			if($(".conteneur").hasClass('js-menu-ouvert')) {
85				BurgerMove();
86				e.preventDefault();
87			}
88		}
89	});
90	/* - - - - /FIN MENU BURGER - - - - */
91
92	/* fallback pour object fit, utilisé pour les modules textes/images, IE11 */
93	if ( ! Modernizr.objectfit ) {
94	  $('.imageFit').each(function () {
95	    var $container = $(this),
96	        imgUrl = $container.find('img').prop('src');
97	    if (imgUrl) {
98	      $container
99	        .css('backgroundImage', 'url(' + imgUrl + ')')
100	        .addClass('compat-object-fit');
101	    }
102	  });
103	}
104
105	/* - - - Click anywhere to close - - - */
106	$("html").on("click", function (e) {
107		// MultiSelect
108		/*if ($('.multiSelect ul').is(':visible')){
109		 	$('.multiSelect ul').hide();
110		 	$('.multiSelect').removeClass('focus');
111		}*/
112
113		/*
114		$(document).on("click", (function(event) {
115			var listeElement = ".selectionMagasin";
116		    if(!$(event.target).closest(listeElement).length) {
117		        if($(listeElement).is(":visible")) {
118		            $(listeElement).fadeOut('fast');
119					$('.votreMagasin').removeClass('actif');
120		        }
121		    }
122
123		})
124		*/
125	});
126
127	$(".formatCanadaCodePostal").inputmask("A9A 9A9");
128	$(".formatUSACodePostal").inputmask({ mask: "99999[-9999]", greedy: false });
129	$(".formatTelephone").inputmask("(999) 999-9999");
130
131	$('#btnAuteurListe').on("click", function(){
132		if(! $(this).hasClass('actif')){
133			$('#btnAuteurMosaique').removeClass('actif');
134			$(this).addClass('actif');
135
136			$('#auteurMosaique').fadeOut('fast', function() {
137				$('#auteurListe').fadeIn();
138			});
139		}
140	});
141
142
143	/* - - - Filtres multi-select - - - */
144	$(document).on("click", '.multiSelect', function(e) {
145		// À évité d'activer le hmtl.click
146		e.stopPropagation();
147
148		if ($(this).children('ul').is(':visible')){
149			$(this).children('ul').hide();
150			$(this).removeClass('focus')
151		} else {
152			$(this).addClass('focus');
153
154			// Le top peut changer si .multiSelect prend plusieurs lignes
155			$(this).children('ul').css('top', ($(this).outerHeight()-1) + 'px');
156
157			$(this).children('ul').show();
158		}
159	});
160
161	// Empàªche le double-toggle quand on choisi une option
162	$(document).on("click", '.multiSelect ul', function(e) {
163		e.stopPropagation();
164	});
165
166	/* - - - Tabs dans Auteurs 02_200 - - - */
167	$('#btnAuteurMosaique').on("click", function() {
168		if(! $(this).hasClass('actif')){
169			$('#btnAuteurListe').removeClass('actif');
170			$(this).addClass('actif');
171
172			$('#auteurListe').fadeOut('fast', function() {
173				$('#auteurMosaique').fadeIn();
174			});
175		}
176	});
177
178
179	/* header qui change au scroll */
180	function verifierScrollPage(){
181	   	var scroll = $(window).scrollTop(),
182	   		caisse = $("#caisse");
183
184	   	if (scroll > 80){
185		   $('body').addClass('activeTop');
186	   	} else {
187		   $('body').removeClass('activeTop');
188	   	}
189
190	   	if ( p == '10_300' || p == '10_400' ) {
191	   		if (scroll > caisse.offset().top){
192	   			$(".caisseFixe").addClass('fixe');
193	   		} else {
194				$(".caisseFixe").removeClass('fixe');
195		   	}
196	   	}
197	}
198
199	verifierScrollPage();
200
201	$(document).on("click", function() {
202		/* dropdown du menu secondaire */
203		$('.menuPrincipal .avecSousMenu').on("mouseover", function(){
204			$(this).find('> .boiteSousMenu').show();
205		}).on("mouseout", function() {
206			$('.boiteSousMenu').hide();
207		});
208	});
209
210	doubletap('.avecSousMenu');
211
212	if($('.apercuImage').length){
213		initApercuImage();
214	}
215
216	if ( $('.popup-modal').length ){
217		$('.popup-modal').magnificPopup({
218			type: 'inline',
219			preloader: false,
220			focus: '#username',
221			modal: true
222		});
223		$(document).on('click', '.popup-modal-dismiss', function (e) {
224			e.preventDefault();
225			$.magnificPopup.close();
226		});
227	}
228
229	if ($('.agrandirImg').length){
230		$('.agrandirImg').magnificPopup({
231			type:'image',
232			mainClass: 'mfp-fade',
233			gallery: {
234				enabled: true,
235				navigateByImgClick: true,
236				tCounter: ''
237			}
238		});
239	}
240
241	if ( $('.popup-modal').length ){
242		$('.popup-modal').magnificPopup({
243			type: 'inline',
244			preloader: false,
245			focus: '#username',
246			modal: true
247		});
248		$(document).on('click', '.popup-modal-dismiss', function (e) {
249			e.preventDefault();
250			$.magnificPopup.close();
251		});
252	}
253
254	$('#lateralMobile').on('change', function() {
255		var pageDestination = $(this).val();
256		$('.menuLateralBureau [data-url=' + pageDestination + ']')[0].click();
257	});
258
259if ($('.produitsAssocies').length) {
260  $('.produitsAssocies').each(function () {
261    const $container = $(this);
262    const $slider = $container.find('ul.produits');
263    const $nav = $container.find('.custom-nav');
264
265    // Évite la double initialisation
266    if (!$slider.hasClass('slick-initialized')) {
267      $slider.slick({
268        dots: false,
269        arrows: true,
270        infinite: true,
271        autoplay: false,
272				 mobileFirst: true,
273        slidesToShow: 2,
274        slidesToScroll: 1,
275        appendArrows: $nav,
276        prevArrow: '<button class="slide-arrow prev-arrow icon-arrow-left arrow-cta"></button>',
277        nextArrow: '<button class="slide-arrow next-arrow icon-arrow-right arrow-cta"></button>',
278        responsive: [
279				{
280					breakpoint: 680,
281					settings: {
282						slidesToShow: 3
283					}
284				},
285				{
286					breakpoint: 850,
287					settings: {
288						slidesToShow: 4
289					}
290				}
291			]
292      });
293    }
294  });
295}
296$('.nouvelleAccueil__liste').slick({
297        dots: false,
298        arrows: true,
299        infinite: true,
300        autoplay: false,
301        slidesToShow: 3,
302        slidesToScroll: 1,
303        appendArrows: $('.nav-1'),
304        prevArrow: '<button class="slide-arrow prev-arrow icon-arrow-left arrow-cta"></button>',
305        nextArrow: '<button class="slide-arrow next-arrow icon-arrow-right arrow-cta"></button>',
306        responsive: [
307          {
308            breakpoint: 600,
309            settings: {
310              slidesToShow: 1
311            }
312          },
313          {
314            breakpoint: 970,
315            settings: {
316              slidesToShow: 2
317            }
318          }
319        ]
320      });
321
322
323
324	if ($('#galerieProduit').length && $('#galerieProduit').hasClass("chargementCarrousel")){
325
326		/* https://github.com/kenwheeler/slick/issues/1189 */
327
328		var $galerieProduitSlick = $('#galerieProduit');
329		var $galerieThumbnailSlick = $('#thumbnailGalerie');
330
331
332		$galerieProduitSlick.slick({
333			fade: true,
334			dots: false,
335			cssEase: 'linear',
336			slidesToShow: 1,
337			slidesToScroll: 1,
338			swipe: false,
339			arrows: false,
340			asNavFor: '#thumbnailGalerie',
341			autoplay: false,
342      initialSlide: 0,
343			rows: 0
344		});
345
346    if (l == 'fr') {
347      var lblPrev = "Image précédente";
348      var lblNext = "Image suivante";
349    } else {
350      var lblPrev = "Previous slide";
351      var lblNext = "Next slide";
352    }
353
354		$galerieThumbnailSlick.slick({
355			infinite: false,
356			dots: false,
357			slidesToShow: 6,
358	 		slidesToScroll: 1,
359	 		autoplay: false,
360	 		arrows: true,
361      prevArrow: '<button type="button" class="slick-prev"><span class="only-sr">'+lblPrev+'</span><svg class="icon icon-right-arrow-2" aria-hidden="true"><use xlink:href="gx/m/icones.svg#icon-right-arrow-2"></use></svg></button>',
362      nextArrow: '<button type="button" class="slick-next"><span class="only-sr">'+lblNext+'</span><svg class="icon icon-right-arrow-2" aria-hidden="true"><use xlink:href="gx/m/icones.svg#icon-right-arrow-2"></use></svg></button>',
363	 		centerMode: false,
364      initialSlide: 0,
365			rows: 0,
366	 		responsive: [
367				{
368				breakpoint: 440,
369				settings: {
370				  slidesToShow: 4
371				}
372			  },
373			  {
374				breakpoint: 600,
375				settings: {
376				  slidesToShow: 5
377				}
378			  },
379			  {
380				breakpoint: 900,
381				settings: {
382				  slidesToShow: 4
383				}
384			  },
385			  {
386				breakpoint: 1100,
387				settings: {
388				  slidesToShow: 5
389				}
390			  }
391			 ]
392		});
393
394		$galerieProduitSlick.on('beforeChange',function(event, slick, currentSlide, nextSlide){
395			$('#thumbnailGalerie .imageCourante').removeClass('imageCourante');
396			$('#thumbnailGalerie .slick-slide[data-slick-index=' + nextSlide + '] ').addClass('imageCourante');
397		});
398
399		if($("#galerieProduit .imagePrincipaleCourante").length > 0){
400			var slideno = $("#galerieProduit .imagePrincipaleCourante").data('slick-index');
401			$('#galerieProduit').slick('slickGoTo', slideno);
402		}
403
404		$("#galerieProduit").removeClass('hidden');
405		$("#galerieProduit").slick('resize');
406	}
407
408	$(".search-close-popup").click(function(){
409		$('.conteneur__recherche').removeClass('afficher');
410	});
411
412	const elementRecherhe = document.getElementById("submitRech");
413
414	elementRecherhe.addEventListener("click",  function(){
415/* 		$('.conteneur__recherche ').magnificPopup({
416			type: 'inline',
417			modal: true
418		}); */
419afficherBoxRecherche();
420	/* 		$.magnificPopup.open({
421
422	  		type: 'inline',
423        fixedContentPos: false,
424        fixedBgPos: true,
425        overflowY: 'auto',
426        closeBtnInside: true,
427        preloader: false,
428        removalDelay: 300,
429        mainClass: 'my-mfp-zoom-in' */
430	});
431
432		function afficherBoxRecherche(){
433$('.conteneur__recherche').addClass('afficher');
434 document.getElementById("rechAutoComplete").focus();
435			/*$('.btn-recherche').magnificPopup({
436				type: 'inline',
437				fixContentPos: true,
438				closeBtnInside: false
439
440			});*/
441			/* alert('obn'); */
442		/* 		$.magnificPopup.open({
443	  		type: 'inline',
444        fixedContentPos: false,
445        fixedBgPos: true,
446        overflowY: 'auto',
447        closeBtnInside: true,
448        preloader: false,
449        removalDelay: 300,
450        mainClass: 'my-mfp-zoom-in'
451		}); */
452	}
453
454  /* - - - Rechercher autocomplte - - - */
455	var xhrAutocomplete;
456	function autoCompleteSource(recherche){
457		try {xhrAutocomplete.abort();} catch(e){}
458
459    xhrAutocomplete = $.ajax({
460      url: "inc/ajax/rechercheAutocomplete.cfm",
461      dataType: "json",
462      data: {recherche : recherche, l : l},
463      success: function(result) {
464        $('#rechercheBoite').html(result.htmResultat);
465
466        if($("#rechAutoComplete").val().length >= 3 && (result.nbTotalCategories > 0 || result.nbTotalProduits > 0 || result.nbTotalNews > 0 || result.nbTotalAutors > 0)) {
467          $('#rechercheBoite').slideDown('fast');
468					$('.formEntete').addClass('has-result');
469					$.getScript('js/accesibleTabs.js');
470          // $('.overlay').fadeIn();
471        } else {
472          $('#rechercheBoite').slideUp('fast');
473					$('.formEntete').removeClass('has-result');
474
475          // $('.overlay').fadeOut();
476        }
477      }
478    });
479	}
480
481	$("#rechAutoComplete").autocomplete({
482		minLength: 3,
483		delay: 150,
484		cache: false,
485		source: function(request, response) {
486			autoCompleteSource($('#rechAutoComplete').val())
487		}
488	});
489
490  /* créer dynamiquement le message d'avertissement */
491  if ( l == 'fr' ){
492    messageCaractereInsuffisant = document.createTextNode('Veuillez entrer au moins 3 caractères.');
493  } else {
494    messageCaractereInsuffisant = document.createTextNode('Please enter a minimum of 3 caracters.');
495  }
496  var htmlTooltip = document.createElement('div');
497  var texteTooltip = document.createElement('p');
498  htmlTooltip.setAttribute('id','formRechMessage');
499  texteTooltip.appendChild(messageCaractereInsuffisant);
500  htmlTooltip.appendChild(texteTooltip);
501  var htmlFermerTooltip = document.createElement('span');
502  htmlFermerTooltip.setAttribute('id','fermerTooltip');
503  var contenuFermerTooltip = document.createTextNode('x');
504  htmlFermerTooltip.appendChild(contenuFermerTooltip);
505  htmlTooltip.appendChild(htmlFermerTooltip);
506  var rechNbCarac = 0;
507
508  document.querySelectorAll('.formRechMotCle').forEach(formRechMotCle => {
509
510    formRechMotCle.addEventListener("keyup", function(){
511      rechNbCarac = formRechMotCle.elements['recherche'].value.length;
512      noteTooltip = document.getElementById('formRechMessage');
513
514      if( rechNbCarac > 3 && (typeof(noteTooltip) != 'undefined' && noteTooltip != null) ){
515        noteTooltip.remove();
516      }
517    });
518
519    formRechMotCle.addEventListener("submit", function(e) {
520      rechNbCarac = formRechMotCle.elements['recherche'].value.length;
521
522      if( rechNbCarac < 3 ) {
523        e.preventDefault();
524        formRechMotCle.append(htmlTooltip);
525        var btnFermerTooltip = document.getElementById('fermerTooltip');
526        btnFermerTooltip.addEventListener('click', function(){
527          var elementTooltip = document.getElementById('formRechMessage');
528
529					if (elementTooltip) {
530						elementTooltip.remove();
531					}
532        })
533
534      } else {
535        formRechMotCle.submit();
536      }
537    });
538
539  })
540
541
542
543
544  /* - - - FIN recherche autocomplete - - - */
545
546
547	/* - - - Liste des détaillants - - -*/
548	if (p == '13_100'){
549		if (mob == 0) {
550			$("#listeRechSuccursaleScroll").slimscroll({
551				height: "auto",
552				position: "right",
553				size: "5px",
554				color: "#dfdfe0",
555				alwaysVisible: true,
556				disableFadeOut : true,
557				railVisible: true,
558				railColor: "#878b9b",
559				railOpacity: 0.8,
560				allowPageScroll: true
561			});
562
563			$("#reduireAggrandir").click(function(){
564				var conteneurCarte = $(this).parent().parent(),
565				texteBulle = $(".reduireListe .infoBulleRecherche");
566
567				if ( conteneurCarte.hasClass('off') ) {
568					conteneurCarte.removeClass('off');
569					if ( l == 'fr' ) {
570						texteBulle.text("Réduire");
571					} else {
572						texteBulle.text("Collapse");
573					}
574				} else {
575					conteneurCarte.addClass('off');
576					if ( l == 'fr' ) {
577						texteBulle.text("Agrandir");
578					} else {
579						texteBulle.text("Expand");
580					}
581				}
582			});
583		}
584	}
585
586	$(document).on('click', '.faireMaSuccursale', function(event) {
587
588		$('.faireMaSuccursale').not($(this)).prop('checked', false);
589
590		var SuccursaleId = $(this).val();
591		if(!$(this).is(':checked')){
592			SuccursaleId = 0;
593		}
594
595		$.ajax({
596			type: "post"
597			,url: "inc/ajax/localisateur/majSuccursaleSelectionne.cfm"
598			,cache: false
599			,data: {'SuccursaleId' : SuccursaleId}
600			,dataType : "json"
601			,error: function(){}
602			,success: function(data){
603				$('#selectionBoutique').html(data.htmlSuccursaleSelectionne);
604				location.reload();
605				//locations.chosenLocationId = data.SuccursaleId;
606			}
607		});
608	});
609
610
611	/* Trouver une succursale */
612	$(document).on('click', '#selectionBoutiqueTrigger', function(event) {
613		var _selectionBoutique = $(this).parent();
614		if ( _selectionBoutique.hasClass('actif') ) {
615			_selectionBoutique.removeClass('actif');
616		} else {
617			_selectionBoutique.addClass('actif');
618		}
619	});
620
621	/* Enlever les états si on clique à l'extérieur */
622	$(document).on("click", function(event) {
623		/* Résultats de recherche */
624		var boiteRecherche = "#rechercheBoite";
625		/*if(!$(event.target).closest(boiteRecherche).length) {
626			$('#rechercheBoite').slideUp('fast');
627			$('.formEntete').removeClass('has-result');
628		}*/
629
630		/* Trouver une succursale */
631		var selectionBoutiqueConteneur = "#selectionBoutique";
632		if(!$(event.target).closest(selectionBoutiqueConteneur).length) {
633			$('#selectionBoutique').removeClass('actif');
634		}
635	});
636
637
638  function detecterEvenementNavigateur() {
639    var perfEntries = performance.getEntriesByType("navigation");
640
641    perfEntries.forEach( perfEntry => {
642      // usager a reculé / avancé avec le bouton back / forward du navigateur
643      if ( perfEntry.type === 'back_forward') {
644        getPageInfos();
645      }
646    });
647
648  }
649
650  detecterEvenementNavigateur();
651
652  function getPageInfos(){
653    $.ajax({
654			url : "inc/ajax/getPageInfos.cfm"
655			,type : "POST"
656			,data : {}
657			,cache : false
658			,dataType : "json"
659			,success : function(data){
660				$('.nbPanierItems').text(data.nbPanierItems);
661			}
662			,error : function(){}
663		});
664  }
665
666	/* - - - Entete : panier apercu - - - */
667	$('.supprimerPanierItem').on("click", function(e) {
668    var $item = $(this);
669    var itemId = $item.data('itemid');
670    var skuId = $item.data('skuid');
671
672    $.ajax({
673        url : "inc/ajax/supprimerPanierItem.cfm"
674        ,type : "POST"
675        ,async : true
676        ,cache : false
677        ,data : {itemId : itemId, skuId : skuId}
678        ,dataType : "json"
679        ,error: function (xhr, ajaxOptions, thrownError) {}
680        ,success : function(data){
681            $item.parents('li').remove();
682            $('.nbArticle').html(data.panierNbItems + (l==='fr' ? ' article' : ' item') + (data.panierNbItems > 1 ? 's' : ''));
683          $('.nbPanierItems').html('('+data.panierNbItems+')');
684        }
685    });
686  });
687
688	/* - - - Compte mot de passe - - - */
689	if(p == '20_120' || p == '08_100' || p == '20_310' || p == '08_400' || p == '20_210' || p == '20_121'){
690
691		if ( l == 'fr' ) {
692			var mp_montreChamp = 'Voir la saisie';
693            var mp_cacheChamp = 'Cacher la saisie';
694		} else {
695			var mp_montreChamp = 'Show the entry';
696            var mp_cacheChamp = 'Hide the entry';
697		}
698
699		$("input[type=password]").on("keypress", function(e) {
700
701			var kc = e.keyCode ? e.keyCode : e.which;
702			var sk = e.shiftKey ? e.shiftKey : kc === 16;
703
704			if ( ((kc >= 65 && kc <= 90) && !sk ) || ((kc >= 97 && kc <= 122) && sk) ) {
705				$('#capsLock').addClass("visible");
706			} else {
707				$('#capsLock').removeClass("visible");
708			}
709		});
710
711		$("input[id=nouveauMotPasse]").on("keyup", function(e) {
712			var score = 0;
713
714			if (l == 'fr') {
715				var forceTexte = "force ";
716			}else{
717				var forceTexte = "strenght ";
718			}
719
720			var message = "";
721
722      score = zxcvbn($(this).val()).score;
723			warning = zxcvbn($(this).val()).feedback.warning;
724			suggestion = zxcvbn($(this).val()).feedback.suggestions;
725
726			/* pour afficher les messages de type suggestion de la librairie */
727			for(i=0; i<suggestion.length; i++) {
728				for(j=0; j<arrMsgMotPasse.length; j++) {
729					/* on compare aussi sans le dernier caractères de la string (avec ou sans le point final de la phrase) */
730					if(arrMsgMotPasse[j][0] == suggestion[i] || arrMsgMotPasse[j][0] == suggestion[i].substring(0,suggestion[i].length-1)){
731						if(l == 'fr') {
732							message = message + arrMsgMotPasse[j][2] + '<br>';
733						}
734						else {
735							message = message + arrMsgMotPasse[j][1] + '<br>';
736						}
737					}
738				}
739			}
740
741			/* pour afficher les messages de type warning de la librairie */
742			for(i=0; i<arrMsgMotPasse.length; i++) {
743				/* on compare aussi sans le dernier caractères de la string (avec ou sans le point final de la phrase) */
744				if(arrMsgMotPasse[i][0] == warning || arrMsgMotPasse[i][0] == warning.substring(0,warning.length-1)){
745					if(l == 'fr') {
746						message = message + arrMsgMotPasse[i][2] + '<br>';
747					}
748					else {
749						message = message + arrMsgMotPasse[i][1] + '<br>';
750					}
751				}
752			}
753
754			if($(this).val().length < 8 || score < ForceMDPCompteClient){
755				if(l == 'fr') {
756					message = message + arrMsgMotPasse[26][2] + '<br>';
757				}
758				else {
759					message = message + arrMsgMotPasse[26][1] + '<br>';
760				}
761			}
762
763			$('#messageMotPasse').html(message);
764			$('#messageMotPasse').show();
765
766			/* pour afficher le score du mot de passe */
767			forceTexte = forceTexte + score + "/" + ForceMDPMax;
768			$('#forceMotPasse').html(forceTexte);
769			$('#forceMotPasse').show();
770			$('#jaugeMotPasse').show();
771
772			/* visualisation pour présenter la validation du mot de passe selon la force*/
773			if(score >= ForceMDPCompteClient){
774				$('#jaugeMotPasse').css("background-color", "green");
775			}
776			else if(score == ForceMDPCompteClient - 1) {
777				$('#jaugeMotPasse').css("background-color", "orange");
778			}
779			else {
780				$('#jaugeMotPasse').css("background-color", "red");
781			}
782
783			if($(this).val().length <= 0 ){
784				$('#jaugeMotPasse').css("background-color", "transparent");
785				$('#messageMotPasse').hide();
786				$('#forceMotPasse').hide();
787				$('#jaugeMotPasse').hide();
788			}
789
790			if(message.length <= 0 ){
791				$('#messageMotPasse').hide();
792			}
793
794		});
795
796		$(document).on('click', '#motPasseVisible', function(e) {
797			e.preventDefault();
798			thisclass = 'hide_'+$(this).attr('class');
799			if (document.getElementById('nouveauMotPasse').type === "password") {
800				document.getElementById('nouveauMotPasse').type = "text";
801				$('#motPasseVisible').addClass(thisclass).attr('title',mp_cacheChamp);
802			} else {
803				document.getElementById('nouveauMotPasse').type = "password"
804				$('#motPasseVisible').removeClass(thisclass).attr('title',mp_montreChamp);
805			}
806		});
807
808		$(document).on('click', '#motPasseCfmVisible', function(e) {
809			e.preventDefault();
810			thisclass = 'hide_'+$(this).attr('class');
811			if (document.getElementById('nouveauMotPasseCfm').type === "password") {
812				document.getElementById('nouveauMotPasseCfm').type = "text";
813				$('#motPasseCfmVisible').addClass(thisclass).attr('title',mp_cacheChamp);
814			} else {
815				document.getElementById('nouveauMotPasseCfm').type = "password"
816				$('#motPasseCfmVisible').removeClass(thisclass).attr('title',mp_montreChamp);
817			}
818    });
819
820    /* confimation mot de passe = */
821    $("input[id=nouveauMotPasseCfm]").keyup(function(e) {
822      /* le bouton est a disabled par defaut */
823      $('#btnCreer').prop('disabled', true);
824      var message = "";
825
826      if( $(this).val() == $('#nouveauMotPasse').val()){
827        $('#btnCreer').prop('disabled', false);
828      } else {
829        $('#btnCreer').prop('disabled', true);
830      }
831    });
832
833	}
834
835	/* - - - Panier - - - */
836	if (p == '10_100'){
837    	$(document).on("change", ".quantiteCommandee", function(event){
838    		var $this = $(this);
839    		var $item = $(this).parents('.blocItem');
840
841    		$.ajax({
842				url : "inc/ajax/majPanierItem.cfm"
843				,type : "POST"
844				,data : {l: l, itemId: $this.data("itemid"), quantiteCommandee: $this.val()}
845				,cache : false
846				,dataType : "json"
847				,success : function(data){
848					if(data.estSucces == 1){
849						$item.find('.itemTotal').html(data.itemTotal);
850						$('#jsBoiteCodePromo').html(data.htmlCodePromo);
851						$('#jsBoiteTotaux').html(data.htmlTotaux);
852						$('#jsBoiteLivraisonGratuiteTexte').html(data.htmlLivraisonGratuiteTexte);
853					}
854
855					if(data.messageErreur.length > 0 || data.messageSucces.length > 0){
856						afficherMessage(data.messageErreur, data.messageSucces, '', 0);
857					}
858				}
859				,error : function(){}
860			});
861    	});
862
863    	$(document).on("click", ".afficherFormCodePromo", function(event){
864    		event.preventDefault();
865    		if($("#formCodePromo").hasClass("hidden")){
866    			$("#formCodePromo").removeClass('hidden');
867    		}else{
868    			$("#formCodePromo").addClass('hidden');
869    		}
870		});
871
872		$(document).on("click", "#btnSubmitFormCommande", function(event){
873        event.preventDefault();
874        $('#formCommande').submit();
875    });
876	}
877
878
879	/* - - - Commande - livraison - - -*/
880	if (p == '10_300'){
881
882		$('.estDifferenteAdresseLivrEtFact').on("change", function() {
883			var $sectionFact = $('#sectionFact');
884
885        if($(this).is(':checked')){
886            $sectionFact.removeClass('hidden');
887            $sectionFact.slideDown('600');
888
889            if($('input[name=factAdresseId]').val() == -1 || typeof $('input[name=factAdresseId]').val() === "undefined"){
890            	$sectionFact.find('input,select').not('.nonObligatoire').each(function(){
891	                $(this).prop('required', true);
892	            });
893            }
894        }else{
895            $sectionFact.slideUp();
896
897            $sectionFact.find('input,select').not('.nonObligatoire').each(function(){
898                $(this).prop('required', false);
899            });
900        }
901    });
902
903    $('input[name=livrAdresseId]').on("change", function() {
904			var $sectionLivrAjouterUneAdresse = $(this).parents('.sectionLivr').find('.sectionLivrAjouterUneAdresse');
905
906            if($(this).val() == -1){
907                $sectionLivrAjouterUneAdresse.removeClass('hidden');
908                $sectionLivrAjouterUneAdresse.slideDown('600');
909
910                $sectionLivrAjouterUneAdresse.find('input,select').not('.nonObligatoire').each(function(){
911                    $(this).prop('required', true);
912                });
913            }else{
914                $sectionLivrAjouterUneAdresse.slideUp();
915
916                $sectionLivrAjouterUneAdresse.find('input,select').not('.nonObligatoire').each(function(){
917                	$(this).prop('required', false);
918                });
919            }
920
921            $('input[name=transportDestinationProvinceId]').val($(this).data('provinceid'));
922            $('input[name=transportDestinationPaysId]').val($(this).data('paysid'));
923            $('input[name=transportDestinationCodePostal]').val($(this).data('codepostal'));
924
925            majCommandeAdresse();
926        });
927
928		$('input[name=factAdresseId]').on("change", function() {
929			var $sectionFactAjouterUneAdresse = $(this).parents('.sectionFact').find('.sectionFactAjouterUneAdresse');
930
931            if($(this).val() == -1){
932                $sectionFactAjouterUneAdresse.removeClass('hidden');
933                $sectionFactAjouterUneAdresse.slideDown('600');
934
935                $sectionFactAjouterUneAdresse.find('input,select').not('.nonObligatoire').each(function(){
936                    $(this).prop('required', true);
937                });
938            }else{
939                $sectionFactAjouterUneAdresse.slideUp();
940
941                $sectionFactAjouterUneAdresse.find('input,select').each(function(){
942                	$(this).prop('required', false);
943                });
944            }
945        });
946
947    $(document).on("change", "select[name=livrNouvelleAdresseProvinceId], select[name=livrNouvelleAdressePaysId], input[name=livrNouvelleAdresseCodePostal]", function(event){
948      $('input[name=transportDestinationProvinceId]').val($('select[name=livrNouvelleAdresseProvinceId]').val());
949      $('input[name=transportDestinationPaysId]').val($('select[name=livrNouvelleAdressePaysId]').val());
950      $('input[name=transportDestinationCodePostal]').val($('input[name=livrNouvelleAdresseCodePostal]').val());
951
952    	majCommandeAdresse();
953		});
954
955		$(document).on("change", "select[name=livrProvinceId], select[name=livrPaysId], input[name=livrCodePostal]", function(event){
956            $('input[name=transportDestinationProvinceId]').val($('select[name=livrProvinceId]').val());
957            $('input[name=transportDestinationPaysId]').val($('select[name=livrPaysId]').val());
958            $('input[name=transportDestinationCodePostal]').val($('input[name=livrCodePostal]').val());
959
960    		majCommandeAdresse();
961		});
962
963    $(document).on("click", "input[name=transportTarifId]", function(event){
964    	majCommandeTransportTarif();
965		});
966
967    majCommandeAdresse();
968
969    function majCommandeAdresse(){
970      var livraisonMethode = $('input[name=livraisonMethode]').val();
971      var transportDestinationProvinceId = $('input[name=transportDestinationProvinceId]').val();
972      var transportDestinationPaysId = $('input[name=transportDestinationPaysId]').val();
973      var transportDestinationCodePostal = $('input[name=transportDestinationCodePostal]').val();
974
975      $.ajax({
976				url : "inc/ajax/majCommandeAdresse.cfm"
977				,type : "POST"
978				,data : {
979          l: l,
980          livraisonMethode: livraisonMethode,
981          transportDestinationProvinceId: transportDestinationProvinceId,
982          transportDestinationPaysId: transportDestinationPaysId,
983          transportDestinationCodePostal: transportDestinationCodePostal
984        }
985				,cache : false
986				,dataType : "json"
987				,beforeSend: function() {
988					$('#jsBoiteTotaux').css('opacity', '0.5').addClass('load');
989					$('#jsBoiteTransportTarifs').css('opacity', '0.5').addClass('load');
990				}
991				,success : function(data){
992					$('#jsBoiteTotaux').css('opacity', '1').removeClass('load').html(data.htmlTotaux)
993					$('#jsBoiteTransportTarifs').css('opacity', '1').removeClass('load').html(data.htmlTransportTarifs);
994
995					if(data.messageErreur.length > 0 || data.messageSucces.length > 0){
996						afficherMessage(data.messageErreur, data.messageSucces, '', 0);
997					}
998				}
999				,error : function(errorMessage){
1000          //console.log(errorMessage);
1001        }
1002			});
1003        }
1004
1005      function majCommandeTransportTarif(){
1006        	var transportDestinationProvinceId = $('input[name=transportDestinationProvinceId]').val();
1007        	var transportTarifId = $('input[name=transportTarifId]:checked').val();
1008
1009          console.log(transportTarifId);
1010
1011      $.ajax({
1012				url : "inc/ajax/majCommandeTransportTarif.cfm"
1013				,type : "POST"
1014				,data : {l: l, transportTarifId: transportTarifId}
1015				,cache : false
1016				,dataType : "json"
1017				,beforeSend: function() {
1018					$('#jsBoiteTotaux').css('opacity', '0.5').addClass('load');
1019				}
1020				,success : function(data){
1021					$('#jsBoiteTotaux').css('opacity', '1').removeClass('load').html(data.htmlTotaux);
1022
1023					if(data.messageErreur.length > 0 || data.messageSucces.length > 0){
1024						afficherMessage(data.messageErreur, data.messageSucces, '', 0);
1025					}
1026				}
1027				,error : function(){}
1028			});
1029        }
1030	}
1031
1032	/* - - - Commande - paiement - - -*/
1033	if (p == "10_400"){
1034
1035    $(document).on('click','.paiementMethodes_item',function(event){
1036      configurerMethodePaiement( $(this) );
1037    })
1038
1039    var methodePaiementInit = $('.paiementMethodes_item.actif');
1040    configurerMethodePaiement(methodePaiementInit);
1041
1042    function configurerMethodePaiement(methodePaiement) {
1043      var elementHtmlChoix = methodePaiement;
1044      var formulaire = $('#finaliserPaiement');
1045      var methodeChoix = elementHtmlChoix.val();
1046      var methodeUrl = elementHtmlChoix.data('formactionurl');
1047      var methodeForm = elementHtmlChoix.attr('id');
1048
1049      $('input[name=paiementMethodeCode]').val(methodeChoix);
1050      formulaire.attr('action', methodeUrl);
1051
1052      $('.paiementMethodes_item').removeClass('actif');
1053      elementHtmlChoix.addClass('actif');
1054
1055     $('#paiementMethodes').find('input,select').each(function(){
1056        $(this).prop('disabled', true);
1057      });
1058
1059      $('[data-methodeform=' + methodeForm + ']').find('input,select').each(function(){
1060        $(this).prop('disabled', false);
1061      });
1062    }
1063
1064    $(document).on('click','input[id^=globalPaymentsCarteId]', configurerCarteChoisie)
1065
1066    function configurerCarteChoisie() {
1067      var carteChoix = $('input[id^=globalPaymentsCarteId]:checked').val();
1068
1069      $('[data-infocarte] input, [data-infocarte] select').prop('disabled', true);
1070      $('[data-infocarte=' + carteChoix + '] input, [data-infocarte=' + carteChoix + '] select').prop('disabled', false);
1071
1072    }
1073
1074    // Global Payments - option enregistrement/choix de carte
1075    if ( $('.carteOptionBloc').length ){
1076      verifierCarteOption();
1077
1078      $('.carteOptionBloc input.carteSelection').on("change", function() {
1079        verifierCarteOption();
1080      });
1081
1082      function verifierCarteOption(){
1083        $('.carteOptionBloc .carteChampsBloc').addClass('hidden');
1084        $('.carteOptionBloc input.carteSelection:checked').parents('.carteOptionBloc').find('.carteChampsBloc').removeClass('hidden');
1085      }
1086    }
1087
1088	}
1089
1090    /* - - - Formulaire adresse - - - */
1091    if (p == "20_321" || p == "10_300" || p == "08_400" || p == "13_110"){
1092        if(typeof objPays === "undefined"){
1093            objPays = {};
1094        }
1095
1096        function verifierProvince($selector){
1097
1098            var paysId = $selector.val();
1099            var $boiteSection = $selector.parents('fieldset');
1100            var $selectProvinceId = $boiteSection.find('select.provinceId');
1101            var $provinceIdLabel = $boiteSection.find('label.provinceIdLabel');
1102            var $inputProvince = $boiteSection.find('input.province');
1103            var $provinceLabel = $boiteSection.find('label.provinceLabel');
1104            var provinceId = $selectProvinceId.val();
1105
1106            var content = '';
1107            for (var i in objPays) {
1108                if(i === paysId){
1109                    for (var j in objPays[i]) {
1110                        itemProvince = objPays[i][j];
1111                        content += '<option value="'+itemProvince.PROVINCE_ID+'"'+ (provinceId == itemProvince.PROVINCE_ID ? ' selected' : '') +'>'+itemProvince.provinceNom+'</option>';
1112                    }
1113                }
1114            }
1115
1116            if(content.length > 0){
1117                $selectProvinceId.empty().html(content).trigger('render');
1118                $selectProvinceId.parents('.selectProvince').removeClass('hidden');
1119                $inputProvince.addClass('hidden').val('');
1120                $provinceLabel.addClass('hidden');
1121                $provinceIdLabel.removeClass('hidden');
1122                if(paysId.length > 0){
1123                	$selectProvinceId.prop('required', true);
1124									$selectProvinceId.closest('.labelSelect').addClass('estSelectionner');
1125                	$inputProvince.prop('required', false);
1126                }
1127            }else{
1128                $selectProvinceId.empty().html('<option value="">---</option>').trigger('render');
1129                $selectProvinceId.parents('.selectProvince').addClass('hidden');
1130                $inputProvince.removeClass('hidden');
1131                $provinceLabel.removeClass('hidden');
1132                $provinceIdLabel.addClass('hidden');
1133								$selectProvinceId.closest('.labelSelect').removeClass('estSelectionner');
1134                if(paysId.length > 0){
1135                	$selectProvinceId.prop('required', false);
1136                	$inputProvince.prop('required', true);
1137                }
1138            }
1139        }
1140
1141        function verifierFormatCodePostal($selector){
1142            var paysId = $selector.val();
1143            if(paysId.length > 0){
1144            	var $sectionAdresse = $selector.parents('fieldset');
1145            	var $formatCodePostal = $sectionAdresse.find('.formatCodePostal');
1146	            if(paysId == 1){ // canada
1147	            	$formatCodePostal.inputmask("A9A 9A9");
1148	            }else if (paysId == 2){ // us
1149	            	$formatCodePostal.inputmask({ mask: "99999[-9999]", greedy: fal
1149se });
1150	            }else{
1151	            	$formatCodePostal.inputmask('remove');
1152	            }
1153	        }
1154        }
1155
1156        $('.paysId').each(function(){
1157            verifierProvince($(this));
1158            verifierFormatCodePostal($(this));
1159        });
1160
1161        $('.paysId').on("change", function(){
1162            verifierProvince($(this));
1163            verifierFormatCodePostal($(this));
1164        });
1165    }
1166
1167	/* - - - Centre les nom de auteurs sans logo - - - */
1168	if (p == '02_200'){
1169		$('#auteurMosaique .sansLogo div').each(function( index ) {
1170			$(this).css('margin-top', '-' + ($(this).height()/2) + 'px' )
1171		});
1172	}
1173
1174	/* - - - Fallback logo svg - - - */
1175	if (!Modernizr.svg) {
1176		$("#logo img").attr("src", function() {
1177			return $(this).attr("src").replace(".svg", ".png");
1178		});
1179	}
1180
1181	/* - - - Evite le double-submit - - - */
1182	$('form').not("#filtre").on('submit',function(e){
1183		var $form = $(this);
1184		if ($form.data('submitted') === true) {
1185			e.preventDefault();
1186		} else {
1187			$form.data('submitted', true);
1188		}
1189	});
1190
1191	/* Renvoit une image par d?ut ?la place des images bris?s */
1192	$('img').one('error', function() { this.src = 'gx/00/defaut-produit.jpg'; });
1193
1194	$(document).on("focusin", ".form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form textarea, .formContact textarea, input", function() { champRempli($(this)); });
1195	$(document).on("blur", ".form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form textarea, .formContact textarea, input", function() { champRempli($(this)); });
1196
1197
1198	/* Ajouter la class permettant de mettre le label au dessus du input remplie */
1199	document.querySelectorAll("input, textarea").forEach(element => {
1200
1201		/* Condition pour ne pas ajouter la class rempli */
1202		if(["radio","checkbox","file"].includes(element.type)){
1203			return;
1204		}
1205		/* Ajouter class rempli aux input avec une valeurs */
1206		if(element.value.trim() !== ""){
1207				element.classList.add("rempli");
1208			}
1209			else{
1210				element.classList.remove("rempli");
1211			}
1212	});
1213
1214	/* Ajouter une class pemettre le label au dessous de l'option selectionner */
1215	document.querySelectorAll(".labelSelect select").forEach(select => {
1216		select.addEventListener("change", e => {
1217			const elmSelect = e.target.closest(".labelSelect");
1218
1219			if(select.value){
1220				elmSelect.classList.add("estSelectionner");
1221			}
1222			else{
1223				elmSelect.classList.remove("estSelectionner");
1224			}
1225		});
1226	});
1227
1228	/* Ajouter la class au select pour la flèche */
1229	document.querySelectorAll("select").forEach(select => {
1230
1231		select.addEventListener("click", function(){
1232			this.classList.toggle("active");
1233		});
1234
1235	});
1236
1237
1238	/* Ajouter une class pemettre le label au dessous de l'option selectionner au load de la page */
1239	document.querySelectorAll(".labelSelect select").forEach(select => {
1240		const elmSelect = document.getElementsByClassName("labelSelect");
1241		const elmSelectsArray = Array.from(elmSelect);
1242
1243			elmSelectsArray.forEach(element =>{
1244					if(select.value){
1245						element.classList.add("estSelectionner");
1246					}
1247					else{
1248						element.classList.remove("estSelectionner");
1249					}
1250			});
1251
1252	});
1253
1254	/* bouton upload pour afficher le nom du document téléchargé*/
1255	$('#Fichier').on('change',function() {
1256		var filename = document.getElementById('Fichier').files[0].name;
1257
1258		$(this).siblings('label').addClass('rempli');
1259		$('.labelFichier .nomFichier').html(filename);
1260	});
1261
1262	/* ========================= */
1263	/* - - - - Animation - - - - */
1264	/* ========================= */
1265	/* - - - Smooth scroll (Lien Haut de page) - - - */
1266	if ( p === '00_210'){
1267
1268		$('a[href*=\\#]:not([href=\\#])').on("click", function() {
1269		var offsetEntete = 100;
1270		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')) {
1271			var target = $(this.hash);
1272			target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
1273				if (target.length) {
1274					$('html,body').animate({ scrollTop: target.offset().top-offsetEntete}, 750);
1275					return false;
1276			}
1277		}
1278	});
1279	}
1280
1281	// Firefox ne respecte pas le autocomplete = off
1282	$('input[autocomplete=off]').attr("value","");
1283
1284	/* - - - Floaty label - - - */
1285	$('.floatyContainer input').on('input', function() {
1286		var $field = $(this);
1287		if (this.value) {
1288			$field.addClass('avecValeur');
1289		} else {
1290			$field.removeClass('avecValeur');
1291		}
1292	});
1293
1294	function viewport() {
1295	    var e = window, a = 'inner';
1296	    if (!('innerWidth' in window )) {
1297	        a = 'client';
1298	        e = document.documentElement || document.body;
1299	    }
1300	    return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
1301	}
1302
1303	browserWidth = viewport().width;
1304	pageJustLoaded = 1;
1305
1306	var etatCourant = "";
1307	function checkViewport(){
1308
1309		var slickInitial = "bureau";
1310		browserWidth = viewport().width;
1311
1312		if ( pageJustLoaded == 1){
1313			if ( browserWidth < 768){
1314				etatCourant = "mobile";
1315				slickInitial = "mobile";
1316			}
1317			else{
1318				etatCourant = "bureau";
1319			}
1320		}
1321
1322		pageJustLoaded = 0;
1323		if ( browserWidth < 768){
1324			etatCourant = "mobile";
1325		}else{
1326			etatCourant = "bureau";
1327		}
1328	}
1329
1330	checkViewport();
1331
1332	/* ====================== */
1333	/* - - - - Resize - - - - */
1334	/* ====================== */
1335	$(window).on("resize", function() {
1336		checkViewport();
1337
1338		/* - - - Centre les nom de auteurs sans logo - - - */
1339		if (p == '02_200'){
1340			$('#auteurMosaique .sansLogo div').each(function( index ) {
1341				$(this).css('margin-top', '-' + ($(this).height()/2) + 'px' )
1342			});
1343		}
1344
1345		verifierScrollPage();
1346	});
1347
1348  $(window).on("scroll", function() {
1349    verifierScrollPage();
1350  });
1351
1352	function champRempli(element) {
1353    element.each(function() {
1354        if ($(this)[0].value.length > 0) {
1355            $(this).addClass("rempli");
1356        } else {
1357            $(this).removeClass("rempli");
1358        }
1359    })
1360	}
1361
1362	$(document).on("click", ".ajouterPanierItem", function(event){
1363		event.preventDefault();
1364		ajouterPanierItem($(this));
1365		ajouterPanierItemGTM($(this));
1366	});
1367
1368	$(document).on("click", ".ajouterListeSouhaitItem", function(event){
1369		event.preventDefault();
1370		ajouterListeSouhaitItem($(this));
1371	});
1372
1373    $(document).on("click", ".supprimerListeSouhaitItem", function(event){
1374		event.preventDefault();
1375		supprimerListeSouhaitItem($(this));
1376	});
1377
1378  $(document).on('click','#annulerCreerCompte', function(event){
1379    event.preventDefault();
1380    $('[name=achatCreerCompte]').prop('checked',false);
1381    $('#conteneurErreurExtra').remove();
1382  })
1383});
1384
1385function initApercuImage(){
1386	$('.apercuImage').each(function(){
1387		var sliderImg = $(this);
1388		var hoverActif = 0;
1389		var timer;
1390		$(sliderImg).slick({
1391			dots: false,
1392			arrows: false,
1393			infinite: true,
1394			autoplay: false,
1395			waitForAnimate: false,
1396			fade: true,
1397			autoplaySpeed: 1100
1398		}).on('mouseenter',function(){
1399			hoverActif = 1;
1400			timer = setTimeout(function(){
1401				$(sliderImg).slick('slickNext').slick('slickPlay');
1402			}, 500);
1403		}).on('mouseleave',function(){
1404			if (hoverActif === 1){
1405				clearTimeout(timer);
1406				$(sliderImg).slick('slickGoTo',0).slick('slickPause');
1407				hoverActif = 0;
1408			}
1409		});
1410	});
1411}
1412
1413function afficherMessage(messageErreur, messageSucces, messageInfo, estScrollToMessage){
1414	$('.groupeMessage .conteneurMessage').html('');
1415	$('.groupeMessage .messageErreur, .groupeMessage .messageSucces, .groupeMessage .messageInfo').addClass('hidden');
1416	var avoirMessageAAfficher = 0;
1417
1418	if(typeof messageErreur !== 'undefined' && messageErreur.length > 0){
1419		$('.groupeMessage .messageErreur').removeClass('hidden').html(messageErreur);
1420		avoirMessageAAfficher = 1;
1421	}
1422
1423	if(typeof messageSucces !== 'undefined' && messageSucces.length > 0){
1424		$('.groupeMessage .messageSucces').removeClass('hidden').html(messageSucces);
1425		$('.groupeMessage .messageSucces .conteneurMessage').html(messageSucces);
1426		avoirMessageAAfficher = 1;
1427	}
1428
1429	if(typeof messageInfo !== 'undefined' && messageInfo.length > 0){
1430		$('.groupeMessage .messageInfo').removeClass('hidden').html(messageInfo);
1431		avoirMessageAAfficher = 1;
1432	}
1433
1434	if(typeof estScrollToMessage !== 'undefined' && estScrollToMessage == 1){
1435		$('html,body').animate({
1436          scrollTop: $('.groupeMessage').offset().top - 100
1437        }, 500);
1438	}
1439
1440	if(avoirMessageAAfficher === 1){
1441		$('.groupeMessage').slideDown('fast',function(){});
1442	}
1443}
1444
1445function fermerMessage(){
1446	afficherMessage('', '', '');
1447}
1448
1449function renouvelerCommande(langue,commandeID) {
1450   	$.ajax({
1451		url: "inc/ajax/renouvelerCommande.cfm",
1452		type: 'POST',
1453		async : true,
1454		cache : false,
1455		dataType : "json",
1456		data : {l: langue, commandeID: commandeID}
1457	}).done(function(data) {
1458		$.magnificPopup.open({
1459	  	  	items: {
1460	  		    src: data.popupContenu
1461	  	  	},
1462		  	type: 'inline',
1463	        fixedContentPos: false,
1464	        fixedBgPos: true,
1465	        overflowY: 'auto',
1466	        closeBtnInside: true,
1467	        preloader: false,
1468	        removalDelay: 300,
1469	        mainClass: 'my-mfp-zoom-in'
1470		});
1471
1472	}).fail(function(result) {
1473   	    console.log("erreur");
1474    });
1475};
1476
1477function ajouterPanierItem($selector){
1478    $.ajax({
1479        url : "inc/ajax/ajouterPanierItem.cfm",
1480        type : "POST",
1481        async : true,
1482        cache : false,
1483        data : {l : l, PRODUITSKU_ID : $selector.data('produitskuid'), quantiteCommandee : $selector.data('quantitecommandee'), rafraichirPanierDetails : $selector.data('rafraichirpanierdetails')},
1484        dataType : "json",
1485        error: function (xhr, ajaxOptions, thrownError) {},
1486        success : function(data){
1487        	if(data.popupContenu.length > 0){
1488        		afficherItemAjoutePopup(data.popupContenu);
1489        	}
1490        	if(data.panierDetails.length > 0){
1491        		$('#blocPanierDetails').html(data.panierDetails);
1492        	}
1493    		$('.nbPanierItems').text(data.nbPanierItems);
1494        }
1495    });
1496};
1497
1498/* DATALAYER */
1499function ajouterPanierItemGTM($selector){
1500	if(window.dataLayer) {
1501		dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
1502		dataLayer.push({
1503			event: "add_to_cart",
1504			ecommerce: {
1505				items: [{
1506					item_id: $selector.data('produitskucode'),
1507					item_name: $selector.data('produitnom'),
1508					item_brand: $selector.data('produitauteur'),
1509					item_category: $selector.data('produitcategorie'),
1510					price: $selector.data('produitprix'),
1511					currency: "CAD",
1512					quantity: $selector.data('quantitecommandee')
1513				}]
1514			}
1515		});
1516	}
1517};
1518
1519function ajouterListeSouhaitItem($selector){
1520    $.ajax({
1521        url : "inc/ajax/ajouterListeSouhaitItem.cfm",
1522        type : "POST",
1523        async : true,
1524        cache : false,
1525        data : {PRODUITSKU_ID : $selector.data('produitskuid'), quantiteCommandee : $selector.data('quantitecommandee')},
1526        dataType : "json",
1527        error: function (xhr, ajaxOptions, thrownError) {},
1528        success : function(data){
1529        	if(data.estSucces === 1){
1530	            $selector.addClass('listeSouhaitItemAjoute');
1531	            $selector.removeClass('ajouterListeSouhaitItem');
1532	            $selector.addClass('supprimerListeSouhaitItem');
1533	            $selector.find('.texte').text(l==='fr' ? "L'article a été ajouté" : "This item has been added");
1534	            $('.nbListeSouhaitItems').text(data.nbListeSouhaitItems);
1535        	}
1536        }
1537    });
1538};
1539
1540function supprimerListeSouhaitItem($selector){
1541    $.ajax({
1542        url : "inc/ajax/supprimerListeSouhaitItem.cfm",
1543        type : "POST",
1544        async : true,
1545        cache : false,
1546        data : {PRODUITSKU_ID : $selector.data('produitskuid')},
1547        dataType : "json",
1548        error: function (xhr, ajaxOptions, thrownError) {},
1549        success : function(data){
1550        	if(data.estSucces === 1){
1551	            $selector.removeClass('listeSouhaitItemAjoute');
1552	            $selector.removeClass('supprimerListeSouhaitItem');
1553	            $selector.addClass('ajouterListeSouhaitItem');
1554	            $selector.find('.texte').text(l==='fr' ? 'Ajouter à ma liste de souhaits' : 'Add to my wish list');
1555	            $('.nbListeSouhaitItems').text(data.nbListeSouhaitItems);
1556	        }
1557        }
1558    });
1559};
1560
1561function afficherItemAjoutePopup(popupContenu){
1562	$.magnificPopup.open({
1563	  	items: {
1564		    src: popupContenu
1565	  	},
1566	  	type: 'inline',
1567        fixedContentPos: false,
1568        fixedBgPos: true,
1569        overflowY: 'auto',
1570        closeBtnInside: true,
1571        preloader: false,
1572        removalDelay: 300,
1573        mainClass: 'my-mfp-zoom-in'
1574	});
1575}
1576
1577
1578
1579$(window).on('load', function(){
1580	if ($('#galerieProduit').length && $('#galerieProduit').hasClass("chargementCarrousel")){
1581		$('#thumbnailGalerie').on('click', '.slick-slide', function(event) {
1582			var nouvelIndex = this.dataset.slickIndex;
1583			$('#thumbnailGalerie .imageCourante').removeClass('imageCourante');
1584			this.classList.add('imageCourante');
1585			if(!this.classList.contains('slick-active')) {
1586				/* le carrousel doit s'ajuster pour rejoindre la bonne image */
1587				$('#thumbnailGalerie').slick('slickGoTo', nouvelIndex);
1588			}
1589			$('#galerieProduit').slick('slickGoTo', nouvelIndex);
1590		});
1591	}
1592});
1593
1594/* Pour enlever les console.log lorsqu'aucune console n'est disponible */
1595(function(){var e;var t=function(){};var n=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];var r=n.length;var i=window.console=window.console||{};while(r--){e=n[r];if(!i[e]){i[e]=t}}})()

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.