1// JavaScript Document 2 3 4 $(window).on('load', function() { 5 6 "use strict"; 7 8 9 /*----------------------------------------------------*/ 10 /* Preloader (Disabled for better Lighthouse performance) 11 /*----------------------------------------------------*/ 12 13 // var preloader = $('#loading'), 14 // loader = preloader.find('#loading-center-absolute'); 15 // loader.fadeOut(); 16 // preloader.delay(400).fadeOut('slow'); 17 18 }); 19 20 21 $(window).on('scroll', function() { 22 23 "use strict"; 24 25 26 /*----------------------------------------------------*/ 27 /* Navigtion Menu Scroll 28 /*----------------------------------------------------*/ 29 30 var b = $(window).scrollTop(); 31 32 if( b > 80 ){ 33 $(".wsmainfull").addClass("scroll"); 34 } else { 35 $(".wsmainfull").removeClass("scroll"); 36 } 37 38 }); 39 40 41 $(document).ready(function() { 42 43 "use strict"; 44 45 46 // Only initialize WOW.js animations on desktop (992px+) for better mobile performance 47 if (window.innerWidth >= 992) { 48 new WOW().init(); 49 } 50 51 52 /*----------------------------------------------------*/ 53 /* Mobile Menu Toggle 54 /*----------------------------------------------------*/ 55 56 if ( $(window).outerWidth() < 992 ) { 57 $('.wsmenu-list li.nl-simple, .wsmegamenu li, .sub-menu li').on('click', function() { 58 $('body').removeClass("wsactive"); 59 $('.sub-menu').slideUp('slow'); 60 $('.wsmegamenu').slideUp('slow'); 61 $('.wsmenu-click').removeClass("ws-activearrow"); 62 $('.wsmenu-click02 > i').removeClass("wsmenu-rotate"); 63 }); 64 } 65 66 if ( $(window).outerWidth() < 992 ) { 67 $('.wsanimated-arrow').on('click', function() { 68 $('.sub-menu').slideUp('slow'); 69 $('.wsmegamenu').slideUp('slow'); 70 $('.wsmenu-click').removeClass("ws-activearrow"); 71 $('.wsmenu-click02 > i').removeClass("wsmenu-rotate"); 72 }); 73 } 74 75 76 /*----------------------------------------------------*/ 77 /* ScrollUp 78 /*----------------------------------------------------*/ 79 80 $.scrollUp = function (options) { 81 82 // Defaults 83 var defaults = { 84 scrollName: 'scrollUp', // Element ID 85 topDistance: 600, // Distance from top before showing element (px) 86 topSpeed: 800, // Speed back to top (ms) 87 animation: 'fade', // Fade, slide, none 88 animationInSpeed: 200, // Animation in speed (ms) 89 animationOutSpeed: 200, // Animation out speed (ms) 90 scrollText: '', // Text for element 91 scrollImg: false, // Set true to use image 92 activeOverlay: false // Set CSS color to display scrollUp active point, e.g '#00FFFF' 93 }; 94 95 var o = $.extend({}, defaults, options), 96 scrollId = '#' + o.scrollName; 97 98 // Create element 99 $('<a/>', { 100 id: o.scrollName, 101 href: '#top', 102 title: o.scrollText 103 }).appendTo('body'); 104 105 // If not using an image display text 106 if (!o.scrollImg) { 107 $(scrollId).text(o.scrollText); 108 } 109 110 // Minium CSS to make the magic happen 111 $(scrollId).css({'display':'none','position': 'fixed','z-index': '99999'}); 112 113 // Active point overlay 114 if (o.activeOverlay) { 115 $("body").append("<div id='"+ o.scrollName +"-active'></div>"); 116 $(scrollId+"-active").css({ 'position': 'absolute', 'top': o.topDistance+'px', 'width': '100%', 'border-top': '1px dotted '+o.activeOverlay, 'z-index': '99999' }); 117 } 118 119 // Scroll function 120 $(window).on('scroll', function(){ 121 switch (o.animation) { 122 case "fade": 123 $( ($(window).scrollTop() > o.topDistance) ? $(scrollId).fadeIn(o.animationInSpeed) : $(scrollId).fadeOut(o.animationOutSpeed) ); 124 break; 125 case "slide": 126 $( ($(window).scrollTop() > o.topDistance) ? $(scrollId).slideDown(o.animationInSpeed) : $(scrollId).slideUp(o.animationOutSpeed) ); 127 break; 128 default: 129 $( ($(window).scrollTop() > o.topDistance) ? $(scrollId).show(0) : $(scrollId).hide(0) ); 130 } 131 }); 132 133 }; 134 135 $.scrollUp(); 136 137 138 /*----------------------------------------------------*/ 139 /* Tabs 140 /*----------------------------------------------------*/ 141 142 $('ul.tabs-1 li').on('click', function(){ 143 var tab_id = $(this).attr('data-tab'); 144 145 $('ul.tabs-1 li').removeClass('current'); 146 $('.tab-content').removeClass('current'); 147 148 $(this).addClass('current'); 149 $("#"+tab_id).addClass('current'); 150 }); 151 152 153 /*----------------------------------------------------*/ 154 /* Masonry Grid 155 /*----------------------------------------------------*/ 156 157 // PERF-04 â imagesloaded/isotope ne sont chargés que par les pages qui 158 // ont une maçonnerie : sans garde, l'appel lèverait et arrêterait tout 159 // le reste de ce fichier (menu, accordéon, formulaires). 160 if ($.fn.imagesLoaded && $.fn.isotope && $('.grid-loaded').length) $('.grid-loaded').imagesLoaded(function () { 161 162 // filter items on button click 163 $('.masonry-filter').on('click', 'button', function () { 164 var filterValue = $(this).attr('data-filter'); 165 $grid.isotope({ 166 filter: filterValue 167 }); 168 }); 169 170 // change is-checked class on buttons 171 $('.masonry-filter button').on('click', function () { 172 $('.masonry-filter button').removeClass('is-checked'); 173 $(this).addClass('is-checked'); 174 var selector = $(this).attr('data-filter'); 175 $grid.isotope({ 176 filter: selector 177 }); 178 return false;
179 }); 180 181 // init Isotope 182 var $grid = $('.masonry-wrap').isotope({ 183 itemSelector: '.masonry-image', 184 percentPosition: true, 185 transitionDuration: '0.7s', 186 masonry: { 187 // use outer width of grid-sizer for columnWidth 188 columnWidth: '.masonry-image', 189 } 190 }); 191 192 }); 193 194 195 /*----------------------------------------------------*/ 196 /* Accordion 197 /*----------------------------------------------------*/ 198 199 $(".accordion > .accordion-item.is-active").children(".accordion-panel").slideDown(); 200 201 $(".accordion > .accordion-item").on('click', function() { 202 $(this).siblings(".accordion-item").removeClass("is-active").children(".accordion-panel").slideUp(); 203 $(this).toggleClass("is-active").children(".accordion-panel").slideToggle("ease-out"); 204 }); 205 206 207 /*----------------------------------------------------*/ 208 /* Single Image Lightbox 209 /*----------------------------------------------------*/ 210 211 $('.image-link').magnificPopup({ 212 type: 'image' 213 }); 214 215 216 /*----------------------------------------------------*/ 217 /* Video Link #1 Lightbox 218 /*----------------------------------------------------*/ 219 220 $('.video-popup1').magnificPopup({ 221 type: 'iframe', 222 iframe: { 223 patterns: { 224 youtube: { 225 index: 'youtube.com/', 226 id: 'v=', 227 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 228 }, 229 vimeo: { 230 index: 'vimeo.com/', 231 id: '/', 232 src: '//player.vimeo.com/video/%id%?autoplay=1' 233 } 234 } 235 }, 236 mainClass: 'mfp-fade', 237 removalDelay: 160, 238 preloader: false, 239 fixedContentPos: false 240 }); 241 242 243 /*----------------------------------------------------*/ 244 /* Video Link #2 Lightbox 245 /*----------------------------------------------------*/ 246 247 $('.video-popup2').magnificPopup({ 248 type: 'iframe', 249 iframe: { 250 patterns: { 251 youtube: { 252 index: 'youtube.com/', 253 id: 'v=', 254 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 255 }, 256 vimeo: { 257 index: 'vimeo.com/', 258 id: '/', 259 src: '//player.vimeo.com/video/%id%?autoplay=1' 260 } 261 } 262 }, 263 mainClass: 'mfp-fade', 264 removalDelay: 160, 265 preloader: false, 266 fixedContentPos: false 267 }); 268 269 270 /*----------------------------------------------------*/ 271 /* Video Link #3 Lightbox 272 /*----------------------------------------------------*/ 273 274 $('.video-popup3').magnificPopup({ 275 type: 'iframe', 276 iframe: { 277 patterns: { 278 youtube: { 279 index: 'youtube.com/', 280 id: 'v=', 281 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 282 }, 283 vimeo: { 284 index: 'vimeo.com/', 285 id: '/', 286 src: '//player.vimeo.com/video/%id%?autoplay=1' 287 } 288 } 289 }, 290 mainClass: 'mfp-fade', 291 removalDelay: 160, 292 preloader: false, 293 fixedContentPos: false 294 }); 295 296 297 /*----------------------------------------------------*/ 298 /* Statistic Counter 299 /*----------------------------------------------------*/ 300 301 // Le nombre final est déjà dans le HTML : sous mouvement réduit, on le 302 // laisse tel quel plutôt que de le faire défiler depuis zéro. 303 var mouvementReduit = window.matchMedia 304 && window.matchMedia('(prefers-reduced-motion: reduce)').matches; 305 306 $('.count-element').each(function () { 307 if (mouvementReduit) { return; } 308 $(this).appear(function() { 309 $(this).prop('Counter',0).animate({ 310 Counter: $(this).text() 311 }, { 312 duration: 4000, 313 easing: 'swing', 314 step: function (now) { 315 $(this).text(Math.ceil(now)); 316 } 317 }); 318 },{accX: 0, accY: 0}); 319 }); 320 321 322 /*----------------------------------------------------*/ 323 /* Testimonials Rotator 324 /*----------------------------------------------------*/ 325 326 // Une personne qui a demandé moins d'animation ne doit pas subir un 327 // défilement automatique : le carrousel reste, la rotation s'arrête. 328 var defilementAuto = !(window.matchMedia 329 && window.matchMedia('(prefers-reduced-motion: reduce)').matches); 330 331 /** 332 * Ajoute une commande de pause au carrousel, exigée par WCAG 2.2.2 dès 333 * qu'un mouvement automatique dépasse cinq secondes. `autoplayHoverPause` 334 * ne couvrait que la souris : au clavier, rien n'arrêtait la rotation. 335 */ 336 function commandeDePause($carrousel) { 337 if (!$carrousel.length || !defilementAuto) { return; } 338 339 var enLecture = true; 340 var $bouton = $('<button>', { 341 type: 'button', 342 'class': 'fg-carousel-pause', 343 'aria-pressed': 'false' 344 }).text(figenTraduire('Mettre la rotation en pause')); 345 346 $bouton.on('click', function () { 347 enLecture = !enLecture; 348 $carrousel.trigger((enLecture ? 'play' : 'stop') + '.owl.autoplay'); 349 $bouton 350 .attr('aria-pressed', enLecture ? 'false' : 'true') 351 .text(figenTraduire(enLecture 352 ? 'Mettre la rotation en pause' 353 : 'Reprendre la rotation')); 354 }); 355 356 // La rotation s'interrompt aussi quand le clavier entre dans le 357 // carrousel, sans quoi le contenu se déroberait sous le focus. 358 $carrousel.on('focusin', function () { 359 if (enLecture) { $carrousel.trigger('stop.owl.autoplay'); } 360 }).on('focusout', function () { 361 if (enLecture) { $carrousel.trigger('play.owl.autoplay'); } 362 }); 363 364 $carrousel.before($bouton); 365 } 366 367 function figenTraduire(texte) { 368 var table = (window.figenLibelles || {}); 369 return table[texte] || texte; 370 } 371 372 var owl = $('.reviews-1-wrapper'); 373 owl.owlCarousel({ 374 items: 3, 375 loop:true, 376 autoplay: defilementAuto, 377 navBy: 1, 378 autoplayTimeout: 4500, 379 autoplayHoverPause: true, 380 smartSpeed: 1500, 381 responsive:{ 382 0:{ 383 items:1 384 }, 385 767:{ 386 items:1 387 }, 388 768:{ 389 items:2 390 }, 391 991:{ 392 items:3 393 }, 394 1000:{ 395 items:3 396 } 397 } 398 }); 399 400 401 /*----------------------------------------------------*/ 402 /* Testimonials Rotator 403 /*----------------------------------------------------*/ 404 405 commandeDePause($('.reviews-1-wrapper')); 406 407 var owl = $('.reviews-4-wrapper'); 408 owl.owlCarousel({ 409 items: 2, 410 loop:true, 411 autoplay: defilementAuto, 412 navBy: 1, 413 autoplayTimeout: 4500, 414 autoplayHoverPause: true, 415 smartSpeed: 1500, 416 responsive:{ 417 0:{ 418 items:1 419 }, 420 767:{ 421 items:1 422 }, 423 768:{ 424 items:2 425 }, 426 991:{ 427 items:2 428 }, 429 1000:{ 430 items:2 431 } 432 } 433 }); 434 435 436 commandeDePause($('.reviews-4-wrapper')); 437 438 439 /*----------------------------------------------------*/ 440 /* Brands Logo Rotator 441 /*----------------------------------------------------*/ 442 443 var owl = $('.brands-carousel'); 444 owl.owlCarousel({ 445 items: 5, 446 loop:true, 447 autoplay: defilementAuto, 448 navBy: 1, 449 nav:false, 450 autoplayTimeout: 4000, 451 autoplayHoverPause: false, 452 smartSpeed: 2000,
453 responsive:{ 454 0:{ 455 items:2 456 }, 457 550:{ 458 items:3 459 }, 460 767:{ 461 items:3 462 }, 463 768:{ 464 items:4 465 }, 466 991:{ 467 items:5 468 }, 469 1000:{ 470 items:5 471 } 472 } 473 }); 474 475 476 /*----------------------------------------------------*/ 477 /* Request Form Validation 478 /*----------------------------------------------------*/ 479 480 if ($.fn.validate && $(".request-form").length) $(".request-form").validate({ 481 rules:{ 482 name:{ 483 required: true, 484 minlength: 2, 485 maxlength: 16, 486 }, 487 email:{ 488 required: true, 489 email: true, 490 } 491 }, 492 messages:{ 493 name:{ 494 required: "Please enter no less than (2) characters" 495 }, 496 email:{ 497 required: "We need your email address to contact you", 498 email: "Your email address must be in the format of [email protected]" 499 }, 500 } 501 }); 502 503 504 /*----------------------------------------------------*/ 505 /* Contact Form Validation 506 /*----------------------------------------------------*/ 507 508 if ($.fn.validate && $(".contact-form").length) $(".contact-form").validate({ 509 rules:{ 510 name:{ 511 required: true, 512 minlength: 1, 513 maxlength: 255, 514 }, 515 email:{ 516 required: true, 517 email: true, 518 }, 519 subject:{ 520 required: true, 521 }, 522 message:{ 523 required: true, 524 minlength: 2, 525 } 526 }, 527 messages:{ 528 name:{ 529 required: "Veuillez saisir votre nom", 530 minlength: "Votre nom doit comporter au moins 1 caractère", 531 maxlength: "Votre nom ne doit pas dépasser 255 caractères" 532 }, 533 email:{ 534 required: "Veuillez saisir votre adresse email", 535 email: "Votre adresse email doit être au format [email protected]" 536 }, 537 subject:{ 538 required: "Veuillez sélectionner un sujet" 539 }, 540 message:{ 541 required: "Veuillez saisir votre message", 542 minlength: "Votre message doit comporter au moins 2 caractères" 543 }, 544 }, 545 errorPlacement: function(error, element) { 546 error.addClass('invalid-feedback'); 547 error.insertAfter(element); 548 }, 549 highlight: function(element) { 550 $(element).addClass('is-invalid').removeClass('is-valid'); 551 }, 552 unhighlight: function(element) { 553 $(element).removeClass('is-invalid').addClass('is-valid'); 554 } 555 }); 556 557 558 /*----------------------------------------------------*/ 559 /* Comment Form Validation 560 /*----------------------------------------------------*/ 561 562 if ($.fn.validate && $(".comment-form").length) $(".comment-form").validate({ 563 rules:{ 564 name:{ 565 required: true, 566 minlength: 1, 567 maxlength: 16, 568 }, 569 email:{ 570 required: true, 571 email: true, 572 }, 573 message:{ 574 required: true, 575 minlength: 2, 576 } 577 }, 578 messages:{ 579 name:{ 580 required: "Please enter no less than (1) characters" 581 }, 582 email:{ 583 required: "We need your email address to contact you", 584 email: "Your email address must be in the format of [email protected]" 585 }, 586 message:{ 587 required: "Please enter no less than (2) characters" 588 }, 589 } 590 }); 591 592 593 /*----------------------------------------------------*/ 594 /* Sign In Form Validation 595 /*----------------------------------------------------*/ 596 597 if ($.fn.validate && $(".sign-in-form").length) $(".sign-in-form").validate({ 598 rules:{ 599 password:{ 600 required: true, 601 minlength: 2, 602 maxlength: 16, 603 }, 604 email:{ 605 required: true, 606 email: true, 607 } 608 }, 609 messages:{ 610 password:{ 611 required: "Please enter no less than (2) characters" 612 }, 613 email:{ 614 required: "Please enter valid email address", 615 email: "Your email address must be in the format of [email protected]" 616 }, 617 } 618 }); 619 620 621 /*----------------------------------------------------*/ 622 /* Sign Up Form Validation 623 /*----------------------------------------------------*/ 624 625 if ($.fn.validate && $(".sign-up-form").length) $(".sign-up-form").validate({ 626 rules:{ 627 name:{ 628 required: true, 629 minlength: 2, 630 maxlength: 16, 631 }, 632 password:{ 633 required: true, 634 minlength: 2, 635 maxlength: 16, 636 }, 637 email:{ 638 required: true, 639 email: true, 640 } 641 }, 642 messages:{ 643 name:{ 644 required: "Please enter no less than (2) characters" 645 }, 646 password:{ 647 required: "Please enter no less than (2) characters" 648 }, 649 email:{ 650 required: "Please enter valid email address", 651 email: "Your email address must be in the format of [email protected]" 652 }, 653 } 654 }); 655 656 657 /*----------------------------------------------------*/ 658 /* Reset Form Validation 659 /*----------------------------------------------------*/ 660 661 if ($.fn.validate && $(".reset-password-form").length) $(".reset-password-form").validate({ 662 rules:{ 663 email:{ 664 required: true, 665 email: true, 666 }, 667 messages:{ 668 email:{ 669 required: "We need your email address to contact you", 670 email: "Your email address must be in the format of [email protected]" 671 }, 672 } 673 } 674 }); 675 676 677 /*----------------------------------------------------*/ 678 /* Show Password 679 /*----------------------------------------------------*/ 680 681 var showPass = 0; 682 $('.btn-show-pass').on('click', function(){ 683 if(showPass == 0) { 684 $(this).next('input').attr('type','text'); 685 $(this).find('span.eye-pass').removeClass('flaticon-visible'); 686 $(this).find('span.eye-pass').addClass('flaticon-hidden'); 687 showPass = 1; 688 } 689 else { 690 $(this).next('input').attr('type','password'); 691 $(this).find('span.eye-pass').addClass('flaticon-visible'); 692 $(this).find('span.eye-pass').removeClass('flaticon-hidden'); 693 showPass = 0; 694 } 695 696 }); 697 698 699 /*----------------------------------------------------*/ 700 /* Newsletter Subscribe Form 701 /*----------------------------------------------------*/ 702 703 if ($.fn.ajaxChimp && $('.newsletter-form').length) $('.newsletter-form').ajaxChimp({ 704 language: 'cm', 705 url: 'https://dsathemes.us3.list-manage.com/subscribe/post?u=af1a6c0b23340d7b339c085b4&id=344a494a6e' 706 //http://xxx.xxx.list-manage.com/subscribe/post?u=xxx&id=xxx 707 }); 708 709 if ($.ajaxChimp) $.ajaxChimp.translations.cm = { 710 'submit': 'Submitting...', 711 0: 'We have sent you a confirmation email', 712 1: 'Please enter your email address', 713 2: 'An email address must contain a single @',
714 3: 'The domain portion of the email address is invalid (the portion after the @: )', 715 4: 'The username portion of the email address is invalid (the portion before the @: )', 716 5: 'This email address looks fake or invalid. Please enter a real email address' 717 }; 718 719 720 });
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.