1function go_to_top() { 2 var stickyHeader = $(".sticky"); 3 var stickyHeaderHeight = stickyHeader.length ? stickyHeader.outerHeight() : 0; 4 $("html,body").animate( 5 { 6 scrollTop: $("#main_wrapper_interne").offset().top - stickyHeaderHeight, 7 }, 8 "fast" 9 ); 10} 11function isMobile() { 12 return window.innerWidth <= 768 || /Mobi|Android/i.test(navigator.userAgent); 13} 14$(document).ready(function () { 15 16 //nouvel éditeur, retirer le tag html contenteditable pell-content=textarea bbcode 17 document.querySelectorAll('[contenteditable]:not(.pell-content)').forEach(function(el) { 18 el.removeAttribute('contenteditable'); 19 }); 20 21 /*VG-073798*/ 22 $('.form_gestion_formulaire').on('submit', function(e) { 23 e.preventDefault(); 24 var allValid = true; 25 var errorMessage = ''; 26 $(".des-checkboxes").each(function() { 27 var requiredCheckboxes = $(this).find('input.required_class'); 28 var label= $(this).prev().find('.sp').text(); 29 var isChecked = false; 30 requiredCheckboxes.each(function() { 31 if ($(this).prop('checked')) { 32 isChecked = true; 33 } 34 }); 35 if (!isChecked) { 36 allValid = false; 37 errorMessage += "Veuillez sélectionner au moins une option du champ "+label+" .\n"; 38 } 39 }); 40 if (!allValid) { 41 alert(errorMessage); 42 return false; 43 } 44 var submitButton = $(this).find('input[type="submit"]:focus, button[type="submit"]:focus'); 45 if (submitButton.length > 0) { 46 var submitButtonName = submitButton.attr('name'); 47 var submitButtonValue = submitButton.val(); 48 $(this).append('<input type="hidden" name="' + submitButtonName + '" value="' + submitButtonValue + '">'); 49 } 50 this.submit(); 51 }); 52 53 /***** 069238 */ 54 //https://developers.facebook.com/docs/plugins/faqs#faq_1585575021764180 55 if (isMobile()) { 56 const iframes = document.querySelectorAll("iframe"); 57 iframes.forEach(function(iframe) { 58 console.log("iframe.src",iframe.src); 59 if (iframe.src && iframe.src.includes("www.facebook.com/plugins/page.php")) { 60 iframe.remove(); // Remove the iframe 61 } 62 }); 63 } 64 $("#modal_terme").on("shown.bs.modal", function (e) { 65 $("footer").css("z-index", "-1"); 66 $("#footer_wrapper").css("z-index", "-1"); 67 $("#entete_mod_0").css("z-index", "-1"); 68 $("header #main_nav").css("z-index", "-1"); 69 $("#modal_terme .modal-body").css({ "max-height": "500px" }); 70 }); 71 $("#modal_terme").on("hidden.bs.modal", function (e) { 72 $("footer").css("z-index", "1"); 73 $("header #main_nav").css("z-index", "4"); 74 $("#footer_wrapper").css("z-index", "1"); 75 $("#entete_mod_0").css("z-index", "5"); 76 }); 77 /***** fin 069238 */ 78 79 //69187 $size_ref 80 $(".modal_champs_custom").on("shown.bs.modal", function () { 81 $("#footer_wrapper").css("z-index", "-1"); 82 $("#header .container").css("z-index", "-1"); 83 $("#main-navbar").addClass("d-none"); 84 $("#legal_wrapper").css("z-index", "-1"); 85 }); 86 $(".modal_champs_custom").on("hidden.bs.modal", function () { 87 $("#footer_wrapper").css("z-index", "1"); 88 $("#header .container").css("z-index", "5"); 89 $("#main-navbar").removeClass("d-none"); 90 $("#legal_wrapper").css("z-index", "1"); 91 }); 92 /* -------------------- pagination ajax nouvelle --------------------------*/ 93 $("body").on("click", ".getresult_news", function () { 94 var url = $(this).attr("paginate"); 95 getresult_news(url); 96 go_to_top(); 97 }); 98 /* -------------------- pagination ajax repertoire membre --------------------------*/ 99 $("body").on("click", ".getresult_list_membre", function () { 100 var url = $(this).attr("paginate"); 101 getresult_list_membre(url); 102 }); 103 /* -------------------- pagination ajax evenement --------------------------*/ 104 $("body").on("click", ".go_to_page2", function () { 105 var num_page = $(this).attr("paginate"); 106 go_to_page2(num_page); 107 }); 108 $("body").on("click", ".go_to_page2_prev", function () { 109 previous2(); 110 }); 111 $("body").on("click", ".go_to_page2_next", function () { 112 next2(); 113 }); 114 // lien vers la carte du membre 115 $(".lien_versCarte").on("click", function () { 116 var width = document.getElementById("lacarte") 117 ? document.getElementById("lacarte").offsetWidth 118 : 0; 119 var height = document.getElementById("lacarte") 120 ? document.getElementById("lacarte").offsetHeight 121 : 0; 122 window.open( 123 $(".lien_versCarte").attr("data-link") +
124 "width=" + 125 width + 126 "&height=" + 127 height, 128 "_blank" 129 ); 130 }); 131 // bouton retour history pour csp 132 133 $(".RetourHistory").click(function () { 134 history.back(); 135 }); 136 //afficher / caché un element par class ou par id 137 $(".show_hide").click(function () { 138 var elem = $(this).attr("show_hide_elem"); 139 //$('#'+elem).toggle('fast'); 140 141 //fonctionnement avec les class bootstrap d-none / d-block 142 var has_class = $("#" + elem).hasClass("d-none"); 143 if (has_class) { 144 $("#" + elem).removeClass("d-none"); 145 $("#" + elem).addClass("d-block"); 146 } else { 147 $("#" + elem).addClass("d-none"); 148 $("#" + elem).removeClass("d-block"); 149 } 150 }); 151 //affiche/cache un element par class 152 $(".show_hide_by_class").click(function () { 153 var elem = $(this).attr("show_hide_elem"); 154 //$('.'+elem).toggle('fast'); 155 156 //fonctionnement avec les class bootstrap d-none / d-block 157 var has_class = $("." + elem).hasClass("d-none"); 158 if (has_class) { 159 $("." + elem).removeClass("d-none"); 160 $("." + elem).addClass("d-block"); 161 } else { 162 $("." + elem).addClass("d-none"); 163 $("." + elem).removeClass("d-block"); 164 } 165 }); 166 //cache un element 167 $(".hide_by_class").click(function () { 168 var elem = $(this).attr("show_hide_elem"); 169 170 var has_class = $("." + elem).hasClass("d-none"); 171 if (!has_class) { 172 $("." + elem).addClass("d-none"); 173 $("." + elem).removeClass("d-block"); 174 } 175 }); 176 177 $("#fast_login_form").submit(function (e) { 178 if ($("#fast_login_ajax").val() == 0) { 179 e.preventDefault(); // avoid to execute the actual submit of the form. 180 var url = "/boutique/ajax_check_login.php"; // the script where you handle the form input. 181 $.ajax({ 182 type: "POST", 183 url: url, 184 data: $("#fast_login_form").serialize(), // serializes the form's elements. 185 success: function (data) { 186 if ($.isNumeric(data)) { 187 if (data == 0) { 188 //if(data.match(/1/g)) 189 $("#fast_login_email_address").val(""); 190 $("#fast_login_password").val(""); 191 $("#msg_error_login").html( 192 "<br>Mot de passe ou identifiant invalide" 193 ); 194 } else if (data == 3) { 195 $("#code_email").val(""); 196 $("#msg_error_login").html( 197 "<br>Le code entré est incorrect il vous reste 2 essaie avant d'être bloqué" 198 ); 199 } else if (data == 4) { 200 $("#code_email").val(""); 201 $("#msg_error_login").html( 202 "<br>Le code entré est incorrect il vous reste 1 essaie avant d'être bloqué" 203 ); 204 } else if (data == 5) { 205 $("#code_email").val(""); 206 $("#msg_error_login").html("<br>compte bloqué"); 207 } else { 208 //2f 209 //affiche le champ reponse -> submit -> ajax -> en php check reponse -> log 210 $(".login-controls").hide(); 211 $("#auth2F-wrapper").show(); 212 $("#code_email").prop("disabled", false); 213 } 214 } else { 215 var redirect; 216 redirect=data; 217 // voir VG-065880-0 218 var currentURL = window.location.href; 219 const urlParams = new URL(currentURL).searchParams; 220 221 if(redirect==''){ 222 redirect = urlParams.get("redirect_secure_link"); 223 } 224 225 if (redirect != "" && redirect != null) { 226 if (redirect.includes("offre-benevolat")) { 227 var parts = redirect.split("?"); 228 if (parts.length === 2) { 229 var prefix = parts[0]; 230 var queryString = parts[1]; 231 queryString = queryString.replace("id=", ""); 232 233 var modifiedUrl = prefix + "/postuler/" + queryString; 234 235 data = modifiedUrl; 236 } else { 237 } 238 } else { 239 data = redirect; 240 } 241 } else { 242 data = "/boutique/account.php"; 243 } 244 window.location.href = data; 245 } 246 }, 247 }); 248 } 249 }); 250 251 $("#echange_document_form").submit(function (e) { 252 if ($("#fast_loginEchangeDoc_ajax").val() == 0) { 253 e.preventDefault(); 254 var url = "/gi2-modules/custom/echange_document/ajax_check_login.php"; 255 $.ajax({ 256 type: "POST", 257 url: url, 258 data: $("#echange_document_form").serialize(), 259 dataType: "json", 260 success: function (data) { 261 if (data.connexionOK == "0" || data.connexionOK == "-1") { 262 $("#echangeDocUser").val(""); 263 $("#echangeDocPassword").val(""); 264 if (data.connexionOK == "0") { 265 $("#msg_error_echangeDoc").html( 266 "<br>Mot de passe ou code d'utilisateur invalide" 267 ); 268 } else { 269 $("#msg_error_echangeDoc").html("<br>Ce projet est inactif"); 270 } 271 } else { 272 $("#fast_loginEchangeDoc_ajax").val("1"); 273 $("#projetId").val(data.projetId); 274 $("#echange_document_form").submit(); 275 } 276 }, 277 }); 278 } 279 }); 280 281 //sidebar account ----------------------------------------------------------------------------- 282 $("#sidebarCollapse").on("click", function () { 283 $("#sidebar").toggleClass("active"); 284 if ($("#sidebar").hasClass("active")) {
285 //$('.container_content_all').removeClass('side_active'); 286 $("#master_all").removeClass("side_active"); 287 } else { 288 //$('.container_content_all').addClass('side_active'); 289 $("#master_all").addClass("side_active"); 290 } 291 }); 292 $("#sidebar_fixe").mCustomScrollbar({ 293 theme: "minimal", 294 }); 295 if ($(window).width() < 900) { 296 $("#sidebar").addClass("active"); 297 //$('.container_content_all').removeClass('side_active'); 298 $("#master_all").removeClass("side_active"); 299 } else { 300 //load 301 /*if ($("#sidebar").hasClass("active")) { 302 $('.container_content_all').removeClass('side_active'); 303 }else{ 304 $('.container_content_all').addClass('side_active2'); 305 }*/ 306 } 307 308 // Formulaire de contact flottant 309 $("#contactUs-tab").click(function () { 310 $("#request-contactUs").toggleClass("visible"); 311 }); 312 313 $(".contactUs-close").click(function () { 314 $("#request-contactUs").removeClass("visible"); 315 }); 316 317 //scrolling top 318 $(window).scroll(function () { 319 if ($(this).scrollTop() >= 150) { 320 $("#return-to-top").fadeIn(200); 321 } else { 322 $("#return-to-top").fadeOut(200); 323 } 324 }); 325 $("#return-to-top").click(function () { 326 $("body,html").animate( 327 { 328 scrollTop: 0, 329 }, 330 500 331 ); 332 }); 333 334 //---------------- menu sticky----------------- 335 336 var body = document.body, 337 html = document.documentElement; 338 var total_height = Math.max( 339 body.scrollHeight, 340 body.offsetHeight, 341 html.clientHeight, 342 html.scrollHeight, 343 html.offsetHeight 344 ); 345 346 // Get the navbar 347 var navbar = document.getElementById("menu_principal"); 348 var logo = document.getElementById("logo_sticky_nav"); 349 const logo2 = document.querySelector("#link_logo_nav"); 350 // var change_lang = document.getElementById("changeLang_sticky_nav"); 351 // Get the offset position of the navbar 352 if (navbar) { 353 //Sticky Nav 354 // When the user scrolls the page, execute stickyNav 355 window.onscroll = function () { 356 if (window.scrollY == 0) { 357 //user scrolled to the top of the page 358 359 navbar.classList.remove("sticky"); 360 logo.classList.remove("sticky_nav_logo"); 361 if (logo2) { 362 //VG-066072-0 363 logo.classList.add("d-none"); 364 } 365 } else { 366 stickyNav(total_height); 367 //VG-066072-0 368 logo.classList.remove("d-none"); 369 } 370 }; 371 var sticky = navbar.offsetTop; 372 } 373 374 // Add the sticky class to the navbar when you reach its scroll position. 375 // Remove "sticky" when you leave the scroll position 376 function stickyNav(total_height) { 377 if (window.pageYOffset >= sticky && total_height > "1300") { 378 navbar.classList.add("sticky"); 379 logo.classList.add("sticky_nav_logo"); 380 381 if (logo.style.display === "none") { 382 logo.style.display = "table-cell"; 383 } 384
385 /*if (change_lang.style.display === "none"){ 386 change_lang.style.display = "table-cell"; 387 } */ 388 } else { 389 navbar.classList.remove("sticky"); 390 logo.classList.remove("sticky_nav_logo"); 391 392 if (logo.style.display === "table-cell") { 393 logo.style.display = "none"; 394 } 395 396 /* if (change_lang.style.display === "table-cell"){ 397 change_lang.style.display = "none"; 398 } */ 399 } 400 } 401 402 $(".change_submit_url").change(function () { 403 window.location = $(this).children("option:selected").val(); 404 }); 405 406 openAnchorAccordion(); //ouvrir un accordeon specific au load de la page ex.: https://ville.lorraine.qc.ca/loisirs-et-culture/parcs-et-espaces-verts#collapse45 pour ouvrir l'accordeon #45 407 408 $('[data-toggle="tooltip"]').tooltip({ 409 template: 410 '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner large"></div></div>', 411 }); 412 413 $(".modal_frame_btn").click(function () { 414 var modal_target = $(this).attr("data-show-id"); 415 var src = $(this).attr("data-src"); //pour les images, ajouter 20px à la heuteur et largeur de l'image, pour éviter les scrollbar 416 var width = $(this).attr("data-width"); 417 if (width == null) { 418 width = "1200"; 419 } 420 var height = $(this).attr("data-height"); 421 if (height == null) { 422 height = "700"; 423 } 424 var dataFrame = { 425 src: src, 426 height: height, 427 width: width, 428 }; 429 if ($("#" + modal_target).length) { 430 $("#" + modal_target) 431 .find(".iframe_modal") 432 .attr(dataFrame); 433 $("#" + modal_target).modal("show"); 434 } else if ($("." + modal_target).length) { 435 $("." + modal_target) 436 .find(".iframe_modal") 437 .attr(dataFrame); 438 $("." + modal_target).modal("show"); 439 } 440 }); 441 442 //duplicate admin /admin/jquerycode.js.php 443 $("#ajouter_image_crop").click(function () { 444 if (!$.trim($(this).attr("stringfieldvide"))) { 445 let numero = parseInt($(this).val()); 446 let maxLimit; 447 if ($(this).attr("maxLimit")) { 448 maxLimit = $(this).attr("maxLimit"); 449 } else { 450 maxLimit = 10; 451 } 452 if (!$("#image_crop" + numero).length && numero < maxLimit + 1) { 453 $(this).val(numero + 1); 454 let txtAreaName; 455 if ($(this).attr("txtAreaName").includes("numberToChange")) { 456 txtAreaName = $(this) 457 .attr("txtAreaName") 458 .replace("numberToChange", numero); 459 } 460 /*else{ 461 txtAreaName="numberToChange", numero 462 }*/ 463 464 $.ajax({ 465 type: "POST", 466 url: "/boutique/ajax/ajax_image_crop.php", 467 data: { 468 data_target: "resize_custom_db_photo" + numero, 469 imageId: $(this).attr("imageId"), 470 field_id_img: $(this).attr("field_id_img"), 471 field_img: $(this).attr("field_img") + numero, 472 table_img: $(this).attr("table_img"), 473 inputImgName: "image_crop" + numero, 474 path: $(this).attr("path"), 475 imgResizeThumb: "img_resize_image_crop" + numero, 476 height: $(this).attr("height"), 477 width: $(this).attr("width"), 478 adminBack: $(this).attr("adminBack"), 479 txtAreaName: txtAreaName, 480 txtAreaContent: $(this).attr("txtAreaContent"), 481 field_additional_text: 482 $(this).attr("field_additional_text") + numero, 483 name_additional_text: $(this).attr("name_additional_text"), 484 }, 485 dataFilter: function (data, type) { 486 return data || "{}"; 487 }, 488 success: function (response) { 489 //$( "#result_photos" ).html( response ); 490 //console.log("requete"); 491 }, 492 }).done(function (data) { 493 $("#result_image_crop").html(data); 494 }); 495 } 496 } else { 497 let options = $(this).attr("stringFieldVide").split(","); 498 let numero = options[0].replace("photo", ""); 499 500 let txtAreaName; 501 if ($(this).attr("txtAreaName").includes("numberToChange")) { 502 txtAreaName = $(this) 503 .attr("txtAreaName") 504 .replace("numberToChange", numero); 505 //console.log(txtAreaName); 506 } 507 /*else{ 508 txtAreaName="numberToChange", numero 509 } */ 510 511 let stringRestantFieldVide = ""; 512 let premier = 0; 513 for (let i = 1; i < options.length; i++) { 514 if (premier == 0) {
515 stringRestantFieldVide += options[i]; 516 premier = 1; 517 } else { 518 stringRestantFieldVide += "," + options[i]; 519 } 520 } 521 522 $(this).attr("stringFieldVide", stringRestantFieldVide); 523 524 $.ajax({ 525 type: "POST", 526 url: "/boutique/ajax/ajax_image_crop.php", 527 data: { 528 data_target: "resize_custom_db_photo" + numero, 529 imageId: $(this).attr("imageId"), 530 field_id_img: $(this).attr("field_id_img"), 531 field_img: $(this).attr("field_img") + numero, 532 table_img: $(this).attr("table_img"), 533 inputImgName: "image_crop" + numero, 534 path: $(this).attr("path"), 535 imgResizeThumb: "img_resize_image_crop" + numero, 536 height: $(this).attr("height"), 537 width: $(this).attr("width"), 538 adminBack: $(this).attr("adminBack"), 539 txtAreaName: txtAreaName, 540 txtAreaContent: $(this).attr("txtAreaContent"), 541 field_additional_text: $(this).attr("field_additional_text") + numero, 542 name_additional_text: $(this).attr("name_additional_text"), 543 }, 544 dataFilter: function (data, type) { 545 return data || "{}"; 546 }, 547 success: function (response) { 548 //$( "#result_photos" ).html( response ); 549 //console.log("requete"); 550 }, 551 }).done(function (data) { 552 $("#result_image_crop").html(data); 553 }); 554 } 555 }); 556 557 //auto open accordeon si l'ancre est active 558 if (window.location.hash) { 559 var jQuerytarget = jQuery("body").find(window.location.hash); 560 561 if (jQuerytarget.hasClass("collapse")) { 562 var jQuerytargetAccordion = jQuerytarget.find(".collapse"); 563 jQuerytarget.collapse("show"); 564 } 565 } 566 567 /**** datepicker ***/ 568 $(function () { 569 $.datepicker.regional['fr'] = { 570 closeText: 'Fermer', 571 prevText: '<Préc', 572 nextText: 'Suiv>', 573 currentText: 'Aujourd\'hui', 574 monthNames: ['Janvier','Fevrier','Mars','Avril','Mai','Juin', 575 'Juillet','Aout','Septembre','Octobre','Novembre','Decembre'], 576 monthNamesShort: ['Jan','Fev','Mar','Avr','Mai','Jun', 577 'Jul','Aou','Sep','Oct','Nov','Dec'], 578 dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], 579 dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], 580 dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'] 581 }; 582 583 $.datepicker.setDefaults($.datepicker.regional['fr']); 584 585 $(".datepicker, .jqdatepicker").datepicker({ 586 changeMonth: true, 587 changeYear: true, 588 yearRange: "-100:+20", 589 dateFormat: "yy-mm-dd" 590 }); 591 }); 592 $('body').on('focus',".datepicker, .jqdatepicker", function(){ //reload datepicker dynamic DOM 593 $(this).datepicker({ 594 changeMonth: true, 595 changeYear: true, 596 yearRange: "-100:+20", 597 dateFormat: "yy-mm-dd" 598 }); 599 }); 600 601 /*-----------------------PAGINATION - docready--------------------*/ 602 var show_per_page = 10; 603 var number_of_items = $("#wrapper_list_paginate").children( 604 ".list_paginate" 605 ).length; 606 var number_of_pages = Math.ceil(number_of_items / show_per_page); 607 608 $("#nav_prev").click(function () { 609 previous(); 610 }); 611 $("#nav_next").click(function () { 612 next(); 613 }); 614 615 var data_lang = $("#show_lang").val(); 616 var lang_suivant = "Suivant"; 617 var lang_precedent = "Précedent"; 618 619 if (data_lang == "EN") { 620 lang_suivant = "Next"; 621 lang_precedent = "Previous"; 622 } 623 624 if (number_of_pages > 1) { 625 $("#current_page").val(0); 626 $("#show_per_page").val(show_per_page); 627 628 var navigation_html = 629 '<a class="prev" id="nav_prev" ooonclick="previous()">'+lang_precedent+'</a>'; 630 var current_link = 0; 631 while (number_of_pages > current_link) { 632 navigation_html += 633 '<a class="page" onclick="go_to_page(' + 634 current_link + 635 ')" longdesc="' + 636 current_link + 637 '">' + 638 (current_link + 1) + 639 "</a>"; 640 current_link++; 641 } 642 navigation_html += 643 '<a class="next" id="nav_next" ooonclick="next()">'+lang_suivant+'</a>'; 644 645 $(".controls_pagination").html(navigation_html); 646 $(".controls_pagination .page:first").addClass("active"); 647 648 //$('#wrapper_list_paginate').children().css('display', 'none'); 649 $("#wrapper_list_paginate").children().removeClass("d-block"); // d-flex 650 $("#wrapper_list_paginate").children().addClass("d-none"); 651 //$('#wrapper_list_paginate').children().slice(0, show_per_page).css('display', 'flex'); 652 $("#wrapper_list_paginate") 653 .children() 654 .slice(0, show_per_page) 655 .removeClass("d-none"); 656 $("#wrapper_list_paginate") 657 .children() 658 .slice(0, show_per_page) 659 .addClass("d-block"); // d-flex 660 } 661 662 var mode = ""; 663 if (document.getElementById("spc_mod") != null) { 664 mode = document.getElementById("spc_mod").value; 665 } 666 667 if (mode == "table") { 668 var number_of_items = $("#list_item") 669 .children("tbody") 670 .children(".oneItem_wrapper").length; 671 var show_per_page = 10; 672 if (document.getElementById("show_per_page_table") != null) { 673 var show_per_page = document.getElementById("show_per_page_table").value; 674 } 675 } else { 676 //alert(document.getElementById('default_show_per_page').value); 677 var number_of_items = $("#list_item").children(".oneItem_wrapper").length; 678 // alert(number_of_items); 679 if (document.getElementById("default_show_per_page") != null) { 680 var show_per_page = document.getElementById( 681 "default_show_per_page" 682 ).value; 683 } else { 684 var show_per_page = 6; 685 } 686 } 687 688 var number_of_pages = Math.ceil(number_of_items / show_per_page); 689 if (number_of_pages > 1) { 690 $("#current_page").val(0); 691 $("#show_per_page").val(show_per_page); 692 693 var navigation_html = 694 '<a class="prev go_to_page2_prev" id="precedent_pagination_event" >'+lang_precedent+'</a>'; 695 var current_link = 0; 696 while (number_of_pages > current_link) { 697 navigation_html += 698 '<a class="page go_to_page2" paginate="' + 699 current_link + 700 '" longdesc="' + 701 current_link + 702 '">' + 703 (current_link + 1) + 704 "</a>"; 705 current_link++; 706 } 707 708 navigation_html += 709 '<a class="next go_to_page2_next" id="suivant_pagination_event">'+lang_suivant+'</a>'; 710 711 $(".controls_pagination").html(navigation_html); 712 //trigger_suivant(); 713 $(".controls_pagination .page:first").addClass("active"); 714 715 if (mode == "table") { 716 //removeClass 717 $("#list_item") 718 .children("tbody") 719 .children(".oneItem_wrapper") 720 .removeClass("d-block"); // d-flex 721 $("#list_item") 722 .children("tbody") 723 .children(".oneItem_wrapper") 724 .addClass("d-none"); 725 //$('#list_item').children('tbody').children(".oneItem_wrapper").slice(0, show_per_page).css('display', 'table-row'); 726 $("#list_item") 727 .children("tbody") 728 .children(".oneItem_wrapper") 729 .slice(0, show_per_page) 730 .removeClass("d-none"); 731 $("#list_item") 732 .children("tbody") 733 .children(".oneItem_wrapper") 734 .slice(0, show_per_page) 735 .addClass("d-block"); // d-flex 736 } else { 737 //$('#list_item').children().css('display', 'none'); 738 739 $("#list_item").children().removeClass("d-block"); // d-flex 740 $("#list_item").children().addClass("d-none"); 741 //$('#list_item').children().slice(0, show_per_page).css('display', 'flex'); 742 $("#list_item").children().slice(0, show_per_page).removeClass("d-none"); 743 $("#list_item") 744 .children(".oneItem_wrapper") 745 .slice(0, show_per_page) 746 .addClass("d-block"); // d-flex 747 } 748 749 $("a.next").prev().css("display", "inline-block"); 750 $("a.next").prev().prev().css("display", "inline-block"); 751 } 752
753 $(".interuupteur_toggle").click(function (e) { 754 switch_interrupteur($(e.target).next("input").val()); 755 }); 756 757 //validation des extensions / type de fichier dans un input file 758 $('.input_file_img').on( "change", function() { 759 var validImageTypes = ["image/gif", "image/jpeg", "image/png", "image/bmp"]; 760 for (var i = 0; i < this.files.length; i++) { 761 var file = this.files[i]; 762 /*console.log(file.name); 763 console.log(file.type); 764 console.log(file);*/ 765 if ($.inArray(file.type, validImageTypes) < 0) { 766 alert('Type de fichier incorrect (images autorisés type jpg/jpeg/png/gif/bmp)'); 767 this.value = ''; 768 return false; 769 } 770 } 771 }); 772 $('.input_file_doc').on( "change", function() { 773 var validImageTypes = ["application/pdf", "text/plain"]; 774 for (var i = 0; i < this.files.length; i++) { 775 var file = this.files[i]; 776 if ($.inArray(file.type, validImageTypes) < 0) { 777 alert('Type de fichier incorrect (Documents autorisés type txt/pdf)'); 778 this.value = ''; 779 return false; 780 } 781 } 782 }); 783 $('.input_file_all').on( "change", function() { 784 var validImageTypes = ["application/pdf", "text/plain", "image/gif", "image/jpeg", "image/png", "image/bmp"]; 785 for (var i = 0; i < this.files.length; i++) { 786 var file = this.files[i]; 787 if ($.inArray(file.type, validImageTypes) < 0) { 788 alert('Type de fichier incorrect (Documents autorisés type txt/pdf/image)'); 789 this.value = ''; 790 return false; 791 } 792 } 793 }); 794 795}); //------------------------------- FIN $(document).ready(function () ---------------------------------- 796 797function go_to_page2(page_num) { 798 var mode = ""; 799 if (document.getElementById("spc_mod") != null) { 800 mode = document.getElementById("spc_mod").value; 801 } 802 var show_per_page = parseInt($("#show_per_page").val(), 0); 803 start_from = page_num * show_per_page; 804 end_on = start_from + show_per_page; 805 if (mode == "table") { 806 // VG-066035-0 807 $("#list_item") 808 .children("tbody") 809 .children(".oneItem_wrapper") 810 .removeClass("d-block"); 811 $("#list_item") 812 .children("tbody") 813 .children(".oneItem_wrapper") 814 .removeClass("d-none"); 815 $("#list_item") 816 .children("tbody") 817 .children(".oneItem_wrapper") 818 .css("display", "none") 819 .slice(start_from, end_on) 820 .css("display", "table-row"); 821 } else { 822 //$('#list_item').children().css('display', 'none').slice(start_from, end_on).css('display', 'flex'); 823 $("#list_item") 824 .children() 825 .addClass("d-none") 826 .slice(start_from, end_on) 827 .addClass("d-block"); // d-flex 828 $("#list_item") 829 .children(".oneItem_wrapper") 830 .removeClass("d-block") 831 .slice(start_from, end_on) 832 .removeClass("d-none"); //d-flex 833 } 834 835 $(".page[longdesc=" + page_num + "]") 836 .addClass("active") 837 .siblings(".active") 838 .removeClass("active"); 839 $("#current_page").val(page_num); 840 841 $("a.page").css("display", "none"); 842 $("a.page").removeClass("prev_nav"); 843 $("a.active").css("display", "inline-block"); 844 845 $("a.active").prev().css("display", "inline-block"); 846 $("a.active").prev().prev().css("display", "inline-block"); 847 848 $("a.active").next().css("display", "inline-block"); 849 $("a.active").next().next().css("display", "inline-block"); 850 851 $("a.prev").next().css("display", "inline-block"); 852 $("a.prev").next().next().css("display", "inline-block"); 853 854 $("a.next").prev().css("display", "inline-block"); 855 $("a.next").prev().prev().css("display", "inline-block"); 856 857 if (page_num >= 5) { 858 $("a.active").prev().prev().addClass("prev_nav"); 859 } 860 go_to_top(); 861} 862 863function previous2() { 864 new_page = parseInt($("#current_page").val(), 0) - 1; 865 //if there is an item before the current active link run the function 866 if ($(".active").prev(".page").length == true) { 867 go_to_page2(new_page); 868 } 869} 870 871function next2() { 872 new_page = parseInt($("#current_page").val(), 0) + 1; 873 //if there is an item after the current active link run the function 874 if ($(".active").next(".page").length == true) { 875 go_to_page2(new_page); 876 } 877} 878 879/* ------ pagination module nouvelle ----------*/ 880 881function getresult_news(url) { 882 $.ajax({ 883 url: url, 884 type: "GET", 885 data: { 886 rowcount: $("#rowcount").val(), 887 pagination_setting: $("#pagination-setting").val(), 888 }, 889 //beforeSend: function(){$("#overlay").show();}, 890 success: function (data) { 891 $("#pagination-result").html(data); 892 //setInterval(function() {$("#overlay").hide(); },500); 893 }, 894 error: function () {}, 895 }); 896} 897function changePagination(option) { 898 if (option != "") { 899 getresult_news("/gi2-modules/standard/news/client/fe_list_news.php"); 900 } 901} 902 903//--------------------------------------------------------------------------------------------------------------------------- 904//-------------- probleme quand le menu sticky embarque par dessus un input required ---------------------------------------- 905//Offset should be the height of your header and delay is how long you want it to take to scroll to the element.
906var delay = 0; 907var offset = 150; 908 909document.addEventListener( 910 "invalid", 911 function (e) { 912 $(e.target).addClass("invalid"); 913 $("html, body").animate( 914 { scrollTop: $($(".invalid")[0]).offset().top - offset }, 915 delay 916 ); 917 }, 918 true 919); 920document.addEventListener( 921 "change", 922 function (e) { 923 $(e.target).removeClass("invalid"); 924 }, 925 true 926); 927 928$(document).on("click", ".trigger_tuile", function () { 929 var tuile_id = $(this).attr("tuile_id"); 930 toggle_tuile(tuile_id); 931 $(this).addClass("tuile_active"); 932}); 933 934function toggle_tuile(tuile_id) { 935 $(".fix_tuile_height").removeClass("tuile_active"); 936 937 $(".tuile_detail.d-block").toggleClass("d-block d-none"); 938 $("#tuile_detail_" + tuile_id).toggleClass("d-none d-block"); 939} 940 941function openAnchorAccordion() { 942 if (window.location.hash) { 943 var $target = $("body").find(window.location.hash); 944 if ($target.hasClass("collapse")) { 945 //console.log('hasClass collapse'); 946 $(".in").removeClass("in"); 947 $target.removeClass("collapse"); 948 //$('a[href*="' + window.location.hash + '"]').click(); 949 } 950 } 951} 952 953function isNumeric(n) { 954 return !isNaN(parseFloat(n)) && isFinite(n); 955} 956 957//----------------------- event - nav by cat --------------- 958/*event cat*/ 959function changeSrcImage(image, id) { 960 var element = document.getElementById(id); 961 element.src = "/client_file/themes/default/interface/st_lin/" + image + ""; 962} 963 964/*event cat*/ 965function changeBg(color, id) { 966 var element = document.getElementById(id); 967 element.style.background = "#" + color + ""; 968} 969 970/*event cat*/ 971function detail_cat(cat_id, link_id, aa = "", mm = "", jj = "") { 972 $(".secondary_cat_wrapper").empty(); 973 var data_cat = { cat_id: cat_id, aa: aa, mm: mm, jj: jj }; 974 var url = "/gi2-modules/custom/cust_fiq_evenement/ajax_cat.php"; 975 $.ajax({ 976 type: "POST", 977 url: url, 978 data: data_cat, 979 success: function (result) { 980 jQuery("#detail_cat_" + cat_id).html(result); // result is the HTML text 981 jQuery("#detail_cat_" + cat_id).show("slow"); 982 //jQuery("#detail_cat").show("slow"); 983 }, 984 }); 985 $(".event_primary_cat").removeClass("picto_cat_active"); 986 if (link_id) { 987 $("#" + link_id).toggleClass("picto_cat_active"); 988 } 989} 990 991/*maj list event*/ 992function maj_event(cat_id, aa, mm, jj, typeC = "") { 993 // typec VG-067212-0 994 var data_cat = { cat_id: cat_id, aa: aa, mm: mm, jj: jj, type: typeC }; 995 var url = "/gi2-modules/custom/cust_fiq_evenement/ajax_cal.php"; 996 $.ajax({ 997 type: "POST", 998 url: url, 999 data: data_cat, 1000 success: function (result) { 1001 jQuery("#wrapper_calendar").html(result); // result is the HTML text 1002 //jQuery("#wrapper_calendar").show("slow"); 1003 }, 1004 }); 1005 1006 var url = "/gi2-modules/custom/cust_fiq_evenement/ajax_event.php"; 1007 $.ajax({ 1008 type: "POST", 1009 url: url, 1010 data: data_cat, 1011 success: function (result) { 1012 jQuery("#wrapper_list_event").html(result); // result is the HTML text 1013 listevent(); 1014 }, 1015 }); 1016 if (typeC == "region") { 1017 jQuery(".row_region_event").removeClass("active"); 1018 jQuery("#region_evnt" + cat_id).addClass("active"); 1019 } 1020 jQuery(".controls_pagination").html(""); 1021 if (typeC != "region") { 1022 // typec VG-067212-0 1023 //texte de la catégorie 1024 data_cat = { cat_id: cat_id, mod: "cat_desc" }; 1025 $.ajax({ 1026 type: "POST", 1027 url: url, 1028 data: data_cat, 1029 success: function (result) { 1030 jQuery("#cat_desc").html(result); // result is the HTML text 1031 }, 1032 }); 1033 } 1034} 1035 1036//----------------------------- news - nav by cat --------------------- 1037/*news cat*/ 1038function detail_cat_news(cat_id, link_id) { 1039 //$('.secondary_cat_wrapper').empty(); 1040 var data_cat = { cat_id: cat_id }; 1041 var url = "/gi2-modules/standard/news/ajax_cat.php"; 1042 $.ajax({ 1043 type: "POST", 1044 url: url, 1045 data: data_cat, 1046 success: function (result) { 1047 jQuery("#detail_cat_" + cat_id).html(result); // result is the HTML text 1048 jQuery("#detail_cat_" + cat_id).show("slow"); 1049 //jQuery("#detail_cat").show("slow"); 1050 }, 1051 }); 1052 //$('.event_primary_cat').removeClass('picto_cat_active'); 1053 //$('#'+link_id).toggleClass('picto_cat_active'); 1054} 1055 1056/*maj list news*/ 1057function maj_news(cat_id) { 1058 var data_cat = { cat_id: cat_id }; 1059 var url = "/gi2-modules/standard/news/ajax_news.php"; //rebuild $_SESSION['news_query'] 1060 $.ajax({ 1061 type: "POST", 1062 url: url, 1063 data: data_cat, 1064 success: function (result) { 1065 //jQuery("#wrapper_calendar").show("slow"); 1066 getresult_news("/gi2-modules/standard/news/client/fe_list_news.php"); //reload les news avec la nouvelle query $_SESSION['news_query'] 1067 }, 1068 }); 1069 jQuery(".controls_pagination").html(""); 1070 1071 //texte de la catégorie 1072 data_cat = { cat_id: cat_id, mod: "cat_desc" }; 1073 $.ajax({ 1074 type: "POST", 1075 url: url, 1076 data: data_cat, 1077 success: function (result) { 1078 jQuery("#cat_desc").html(result); // result is the HTML text 1079 }, 1080 }); 1081} 1082 1083function input_numeric_only(evt, allow_negatif) { 1084 var theEvent = evt || window.event; 1085 1086 // Handle paste 1087 if (theEvent.type === "paste") { 1088 key = event.clipboardData.getData("text/plain"); 1089 } else { 1090 // Handle key press 1091 var key = theEvent.keyCode || theEvent.which;
1092 key = String.fromCharCode(key); 1093 } 1094 if (allow_negatif == "1") { 1095 var regex = /[0-9]|\.|\-/; 1096 } else { 1097 var regex = /[0-9]|\./; 1098 } 1099 if (!regex.test(key)) { 1100 theEvent.returnValue = false; 1101 if (theEvent.preventDefault) theEvent.preventDefault(); 1102 } 1103} 1104 1105function changeBgNews(color, id) { 1106 var element = document.getElementById(id); 1107 element.style.background = "" + color + ""; 1108} 1109 1110//modal img 1111$(function () { 1112 $(".image_fullsize").on("click", function () { 1113 if ($(this).attr("src")) { 1114 var src = $(this).attr("src"); 1115 } else { 1116 var src = $(this).find("img").attr("src"); 1117 } 1118 1119 $("#text_img_fullsize").html(""); 1120 $(".imagepreview").attr("src", src); 1121 var desc = $(this).attr("alt"); 1122 if (!desc) { 1123 desc = $(this).attr("title"); 1124 } 1125 $("#text_img_fullsize").html(desc); 1126 $("#imagemodal").modal("show"); 1127 }); 1128}); 1129 1130function isValidDate(dateString) { 1131 var regEx = /^\d{4}-\d{2}-\d{2}$/; 1132 if (!dateString.match(regEx)) return false; // Invalid format 1133 var d = new Date(dateString); 1134 var dNum = d.getTime(); 1135 if (!dNum && dNum !== 0) return false; // NaN value, Invalid date 1136 return d.toISOString().slice(0, 10) === dateString; 1137} 1138 1139function check_double_submit(id, form, txt) { 1140 btn_sbm = document.getElementById(id); 1141 btn_sbm.disabled = true; 1142 btn_sbm.value = txt; 1143 // btn_sbm.style.display ='none'; 1144 return true; 1145} 1146 1147function home_event_tab(evt, tabName) { 1148 var i, tabcontent, tablinks; 1149 1150 // Get all elements with class="tabcontent" and hide them 1151 tabcontent = document.getElementsByClassName("home_event_tabcontent"); 1152 for (i = 0; i < tabcontent.length; i++) { 1153 tabcontent[i].style.display = "none"; 1154 } 1155 1156 // Get all elements with class="tablinks" and remove the class "active" 1157 tablinks = document.getElementsByClassName("tablinks"); 1158 for (i = 0; i < tablinks.length; i++) { 1159 tablinks[i].className = tablinks[i].className.replace(" active", ""); 1160 } 1161 1162 // Show the current tab, and add an "active" class to the button that opened the tab 1163 document.getElementById(tabName).style.display = "block"; 1164 evt.currentTarget.className += " active"; 1165} 1166 1167function cart_login() { 1168 $(".login-box").slideToggle(); 1169 $("html, body").animate({ scrollTop: 0 }, "slow"); 1170} 1171 1172function show_password(id_input_pass) { 1173 var x = document.getElementById(id_input_pass); 1174 if (x.type === "password") { 1175 x.type = "text"; 1176 } else { 1177 x.type = "password"; 1178 } 1179} 1180 1181 1182function trigger_album(id, idparent) { 1183 if (eval("jb_" + id) !== undefined) { 1184 width = 1300; 1185 if (eval(idparent) !== undefined) { 1186 width = eval(idparent).offsetWidth; 1187 } 1188 eval("jb_" + id).setGallerySize(width - 30, 700); 1189 } 1190} 1191 1192/**** interrugpteur ***/ 1193function switch_interrupteur(id) { 1194 choix1 = document.getElementById("choix1_interrupteur_" + id).value; 1195 choix2 = document.getElementById("choix2_interrupteur_" + id).value; 1196 choix1_label = document.getElementById("label1_interrupteur_" + id).value; 1197 choix2_label = document.getElementById("label2_interrupteur_" + id).value; 1198 interrupt = document.getElementById("interrupteur_value_" + id).value; 1199 if (interrupt == choix2) { 1200 document.getElementById("interrupteur_value_" + id).value = choix1; 1201 document.getElementById("label_interrupteur_" + id).innerHTML = 1202 choix1_label; 1203 document.getElementById("field_" + id).value = choix1; 1204 } else { 1205 document.getElementById("interrupteur_value_" + id).value = choix2; 1206 document.getElementById("label_interrupteur_" + id).innerHTML = 1207 choix2_label; 1208 document.getElementById("field_" + id).value = choix2; 1209 } 1210} 1211 1212/** 1213 * ============================================================================= 1214 * Voir un mot de passe 1215 * ============================================================================= 1216 */ 1217$(document).ready(function () { 1218 $(".see_password_js").on("click", function () { 1219 target = $(this).attr("data-target"); 1220 1221 if ($(target).attr("type") === "password") { 1222 $(target).attr("type", "text"); 1223 } else { 1224 $(target).attr("type", "password"); 1225 } 1226 }); 1227}); 1228 1229/*********** statistique ************/ 1230/*$(document).ready(function () { 1231 1232if($('#counter_section')){ 1233 observer = new MutationObserver(function(mutationsList, observer){ 1234 1235 document.querySelector("#pourc_"+mutationsList[0].target.getAttribute("cat-id")).setAttribute("stroke-dasharray", mutationsList[0].target.innerHTML+", 100"); 1236 }); 1237var div_top = $('#counter_section').offset().top; 1238 1239 $(window).scroll(function(){ 1240 if(($(window).scrollTop() + $(window).height()) > div_top){ 1241 $('.counter').each(function() { 1242 var this_wind = $(this), 1243 countTo = this_wind.attr('data-count'); 1244 $({ countNum: this_wind.text()}).animate({ 1245 countNum: countTo 1246 }, 1247 { 1248 duration: 3000, 1249 easing:'swing', 1250 step: function() { 1251 this_wind.text(Math.floor(this.countNum)); 1252 }, 1253 complete: function() { 1254 this_wind.text(this.countNum); 1255 //alert('finished'); 1256 } 1257 }); 1258 }); 1259 } 1260 }); 1261 1262} 1263 1264}) */ 1265 1266$(document).ready(function () { 1267 /*------------debut input masks---------------------*/ 1268 $(".mask_phone").inputmask({ mask: "999 999-9999" }); 1269 $(".mask_phone_full").inputmask("999 999-9999 \\#99999"); 1270 1271 $('.mask_postcode').each(function(){ 1272 var addr_type = $(this).attr("type_adresse"); 1273 //si province même typ_addr = hors canada, on applique pas le mask sur le postcode //$(".mask_postcode").inputmask("a9a 9a9"); 1274 if($("[name='addr["+addr_type+"][entry_state]']").find(":selected").val()!='Hors Canada'){ 1275 $(this).inputmask("a9a 9a9"); 1276 } 1277 }); 1278 $(".numeric_only").on("keyup", function () { 1279 this.value = this.value.replace(/[^0-9\.]/g, ""); 1280 }); 1281 $(".numeric_int_only").on("keyup", function () { 1282 this.value = this.value.replace(/[^0-9]/g, ""); 1283 }); 1284 $(".mask_courriel").inputmask('email'); 1285 /** mask pour le champs custom type=Monetaire */ 1286 $(".monetaire").inputmask('numeric', { 1287 groupSeparator: ',', 1288 radixPoint: '.', 1289 autoGroup: true, 1290 rightAlign: false, 1291 allowMinus: false, 1292 integerDigits: 10, 1293 digits: 2, 1294 suffix: ' $', 1295 placeholder: '0', 1296 onBeforeMask: function (value, opts) { 1297 var cleanedValue = value.replace(/\s+/g, ""); // Remove spaces 1298 return cleanedValue; // Return cleaned value to be formatted 1299 }, 1300 1301 }); 1302 1303 //si on change la province vers hors canada ou inversement, on applique ou pas le mask sur le postcode 1304 $('select[field_name="entry_state"]').on( "change", function() { 1305 var addr_type = $(this).attr("type_adresse"); 1306 if($(this).find(":selected").val()=='Hors Canada'){ 1307 $("[name='addr["+addr_type+"][entry_postcode]']").inputmask('remove'); 1308 }else{ 1309 $("[name='addr["+addr_type+"][entry_postcode]']").inputmask("a9a 9a9"); 1310 } 1311 1312 }); 1313 /*------------fin input masks---------------------*/ 1314 1315 1316});
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.