1// JavaScript Document 2;(function ($) { 3 4 /* 5 * 6 * Application principale 7 * 8 */ 9 var appChild = { 10 11 init : function() { 12 this.eventListeners(); 13 }, 14 15 eventListeners : function() { 16 17 // EventListeners 18 $(document) 19 20 /* ----------------------------------------------------- */ 21 /* EVENEMENTS GENERIQUES */ 22 /* ----------------------------------------------------- */ 23 24 .on('click', '.prevent-default', function(e) { 25 e.preventDefault(); 26 }) 27 28 /* ----------------------------------------------------- */ 29 /* COOKIES */ 30 /* ----------------------------------------------------- */ 31 .on('click', '.open-cookies', function(event) { 32 event.preventDefault(); 33 34 tarteaucitron.userInterface.openPanel(); 35 return false; 36 }) 37 38 /* ----------------------------------------------------- */ 39 /* NAV FULLPAGE JS */ 40 /* ----------------------------------------------------- */ 41 .on('click', '.next_slide_prime, .next_slide', function(e) { 42 $.fn.fullpage.moveSectionDown(); 43 }) 44 .on('click', '.prev_slide', function(e) { 45 $.fn.fullpage.moveSectionUp(); 46 }) 47 ; 48 49 }, 50 51 intro : function() { 52 53 $('.intro').addClass('animate'); 54 setTimeout(function()Â { 55 $('.intro').addClass('animated'); 56 }, 4200); 57 58 }, 59 60 61 update : function() { 62 63 } 64 65 }; 66 67 68 /* ----------------------------------------------------- */ 69 /* ON READY */ 70 /* ----------------------------------------------------- */ 71 $(document).ready(function() { 72 73 /* Initialisation du composant principal */ 74 appChild.init(); 75 appChild.intro(); 76 77 78 /* Si Hors Mobile, on declenche le parallax */ 79 if (!device.isMobile() || $(window).innerWidth() > 768 ) { 80 $('html').addClass('parallax'); 81 parallax.init(); 82 } 83 84 85 /* Initialisation des modules */ 86 ui.init(); 87 menu.init(); 88 ajax.init(); 89 90 // socialwall.init(); 91 sliders.init(); 92 93 map.init(); 94 // profile.init(); 95 popup.init(); 96 // gallery.init(); 97 calendar.init(); 98 99 cours.init(); 100 resultats.init(); 101 102 $('.screen__loader').removeClass('visible'); 103 104 // Flashdata 105 setTimeout(function() { 106 $('.admin_message').fadeOut(600); 107 }, 2000); 108 109 $('.admin_message').click(function(e) { 110 $('.admin_message').fadeOut(600); 111 }); 112 113 }); 114 115 116})(jQuery) 117;(function ($) { 118 119 /* 120 * 121 * Panier, et mini-panier 122 * 123 */ 124 account = { 125 init : function() { 126 this.events(); 127 }, 128 129 events : function() { 130 $(document) 131 .on('click', '.account__dashboard__header__toggle .btn', function(e) { 132 var div = $(this).data('toggle'); 133 $('.' + div).toggleClass('open'); 134 }) 135 .on('click', '.account__dashboard__menu__nav__item .has-children', function(e) { 136 e.preventDefault(); 137 138 var submenu = $(this).siblings('ul'), 139 parent = $(this).parent(); 140 141 $('.account__dashboard__menu__nav__item').not(parent).removeClass('active'); 142 $('.account__dashboard__submenu').not(submenu).slideUp(200); 143 144 parent.toggleClass('active'); 145 submenu.slideToggle(200); 146 }) 147 148 // Options sur les lignes de table 149 // .on('click', '.account__dashboard__box__main__table__td.options button', function(e) { 150 // e.preventDefault(); 151 152 // var optionsBox = $(this).siblings('.options__box'); 153 154 // $('.options__box').not(optionsBox).hide(); 155 // $(this).siblings('.options__box').toggle(100); 156 // }) 157 158 // Choisir un creneau dans le calendrier 159 .on('click', '.choisir-creneau', function(e) { 160 e.preventDefault(); 161 162 // recuperation du timestamp du creneau 163 var date = $(this).data('date'); 164 console.log(date); 165 }) 166 167 // Annuler un rdv 168 .on('click', '.annuler-rdv', function(e) { 169 e.preventDefault(); 170 171 // recuperation du timestamp du creneau 172 var rdv = $(this).data('rdv'); 173 console.log(rdv); 174 }) 175 176 // Choisir une date pour un rdv deja pris 177 .on('click', '.choisir-rdv', function(e) { 178 e.preventDefault(); 179 180 // recuperation du timestamp du creneau 181 var rdv = $(this).data('rdv'); 182 console.log(rdv); 183 }) 184 185 // Ouvrir le detail d'une facture 186 .on('click', '.open-details', function(e) { 187 e.preventDefault(); 188 189 // recuperation du timestamp du creneau 190 var details = $(this).parents('.details').find('.detail-prestations'); 191 $(this).toggleClass('active'); 192 details.toggleClass('hidden'); 193 }) 194 195 /* ----------------------------------------------------- */ 196 /* switch d'affichage en fonction du select */ 197 /* ----------------------------------------------------- */ 198 .on('change', 'select.content', function(e) { 199 var val = $(this).val(); 200 // console.log(val); 201 }) 202 ; 203 } 204 } 205 206 jQuery(document).ready(function($) { 207 account.init(); 208 }); 209 210})(jQuery) 211;(function ($) { 212 213 /* 214 /* 215 /* Fonctions AJAX 216 /* 217 */ 218 ajax = { 219 220 init : function() { 221 this.filterEvents(); 222 // this.filterPosts();
223 // this.filterItems(); 224 this.loadMore(); 225 // this.suggest(); 226 // this.tabs(); 227 this.events(); 228 }, 229 230 events : function () { 231 232 $(document) 233 234 235 // Filtres de recherche d'items 236 .on('change', '.items-search select', function(event) { 237 ajax.filterItems($(this)); 238 }) 239 240 // Filtre de recherche par tag 241 .on('click', '.btn-tag-filter', function(e) { 242 $(this).toggleClass('active'); 243 ajax.filterItems($(this)); 244 }) 245 246 // Remplacement du chargement classique par de l'ajax 247 .on('click', '.btn-ajax', function(event) { 248 event.preventDefault(); 249 250 var template = $(this).data('ajax-tpl'); 251 var refresh = $('.tab-contents'); 252 253 $('.loader').addClass('display'); 254 255 $.ajax({ 256 257 type: "post", 258 url: ajax_var.url, 259 data: "action=gtp&nonce="+ajax_var.nonce+"&template="+template, 260 261 success: function(msg){ 262 263 // On vide le slider et on le deconstruit 264 refresh.empty(); 265 266 // On le re-remplit 267 refresh.html(msg); 268 269 $('.loader').removeClass('display'); 270 271 } 272 273 }); 274 275 }) 276 277 .on('click', '.page-tabs .tab-button', function(e) { 278 e.preventDefault(); 279 ajax.tabs($(this), $(this).attr('href')); 280 }) 281 282 .on('click', '.items__all .tab-button', function(e) { 283 e.preventDefault(); 284 285 var btn = $('.page-tabs .tab-button[href="' + $(this).attr('href') + '"'); 286 287 ajax.tabs(btn, btn.attr('href')); 288 289 $(window).scrollTop(0); 290 }) 291 292 // Chargement ajax des evenements 293 .on('click', '.filters_home_slider .tabs a', function(e) { 294 295 if ( $(this).data('start') ) { 296 297 298 e.preventDefault(); 299 300 var 301 btn = $(this), 302 start = $(this).data('start'), 303 end = $(this).data('end'), 304 type = 'event', 305 ordre = 'desc', 306 tri = '', 307 perpage = '-1' 308 ; 309 310 if ( start && end ) { 311 312 $('.events-loader').addClass('display'); 313 314 $.ajax({
315 316 type: "post", 317 url: ajax_var.url, 318 data: "action=filter_events&nonce="+ajax_var.nonce+"&type="+type+"&start="+start+"&end="+end+"&ordre="+ordre+"&tri="+tri+"&perpage="+perpage, 319 320 success: function(msg){ 321 322 $('.filters_home_slider .tabs > li').removeClass('active'); 323 btn.parent().addClass('active'); 324 325 // On vide le slider et on le deconstruit 326 $('.home_slider .events.slick-slider').empty(); 327 // var slider = $('.events-items-slider').getSlick(); 328 $('.home_slider .events.slick-slider').slick('unslick'); 329 // slider.unslick(); 330 331 // On le re-remplit 332 $('.home_slider .events').html(msg); 333 334 // on relance l'init du slider 335 sliders.init(); 336 337 $('.events-loader').removeClass('display'); 338 339 } 340 341 }); 342 343 } 344 345 } 346 347 }) 348 349 ; 350 351 window.onpopstate = function (e) { 352 ajax.history(e); 353 } 354 355 }, 356 357 // Filtrage des items 358 filterItems : function( el ) { 359 360 var 361 form, 362 item, 363 itemid, 364 types, 365 thematic, 366 region, 367 template, 368 refresh, 369 data, 370 tags = [], 371 btns 372 ; 373 374 form = $(el).parents('form'); 375 376 // On parcourt les enfants du formulaire pour recuperer les valeurs 377 for (var i = 0; i < form.children().length; i++) { 378 var el = form.children()[i]; 379 380 switch ( el.name ) { 381 382 case 'stakeholder_typology': 383 types = $(el).val(); 384 break; 385 case 'thematic': 386 thematic = $(el).val(); 387 break; 388 case 'region': 389 region = $(el).val(); 390 break; 391 392 } 393 } 394 395 // s'il y a des tags 396 if ( form.find('.btn-tag-filter').length > 0 ) { 397 btns = form.find('.btn-tag-filter'); 398 399 $(btns).each(function(i, e) { 400 if ( $(e).hasClass('active') ) { 401 tags.push($(e).data('tag-id')); 402 } 403 }); 404 } 405 406 item = form.find('input[name="item"]').val(); 407 itemid = form.find('input[name="itemid"]').val(); 408 template = form.find('input[name="template"]').val(); 409 refresh = form.parents('section').find('.ajax-items-refresh'); 410 411 data = "action=filter_items"; 412 data += "&nonce="+ajax_var.nonce; 413 data += "&item="+item; 414 data += "&itemid="+itemid; 415 data += "&types="+types; 416 data += "&thematic="+thematic; 417 data += "®ion="+region; 418 data += "&tags="+tags; 419 data += "&template="+template; 420 421 $('.loader').addClass('display'); 422 423 $.ajax({ 424 425 type: "post", 426 url: ajax_var.url, 427 data: data, 428 429 success: function(msg){ 430 431 // On vide le slider et on le deconstruit 432 refresh.empty(); 433 434 // On le re-remplit 435 refresh.html(msg); 436 437 $('.loader').removeClass('display'); 438 439 // Mise a jour de la carte 440 if ( $('.items-map').length ) { 441 442 map.filterMarkers(region, thematic, types); 443 444 } 445 446 } 447 448 }); 449 450 451 452 }, 453 454 // Filtrage des evenements 455 filterEvents : function(start, end) { 456 457 $(document).on('click', '.events-filter', function(e) { 458 e.preventDefault(); 459 460 var type, start, end, params, ordre, tri, perpage; 461 462 $('.events-filter').not($(this)).removeClass('active'); 463 $(this).toggleClass('active'); 464 465 /* Si le bouton est actif on filtre, */ 466 /* ----------------------------------------------------- */ 467 if ( $(this).hasClass('active')) { 468 469 type = $(this).data('type'); 470 start = $(this).data('start'); 471 end = $(this).data('end'); 472 473 } 474 /* Sinon on affiche les resultats de base */ 475 /* ----------------------------------------------------- */ 476 else { 477 478 type = ''; 479 start = $(this).data('start'); 480 end = $(this).data('end'); 481 482 } 483 484 params = $('#events-params'); 485 ordre = params.data('ordre'); 486 perpage = params.data('perpage'); 487 tri = params.data('tri'); 488 489 if ( start && end ) { 490 491 $('.events-loader').addClass('display'); 492 493 $.ajax({
494 495 type: "post", 496 url: ajax_var.url, 497 data: "action=refresh_events&nonce="+ajax_var.nonce+"&type="+type+"&start="+start+"&end="+end+"&ordre="+ordre+"&tri="+tri+"&perpage="+perpage, 498 499 success: function(msg){ 500 501 // On vide le slider et on le deconstruit 502 $('.events-items-slider').empty(); 503 // var slider = $('.events-items-slider').getSlick(); 504 $('.events-items-slider').slick('unslick'); 505 // slider.unslick(); 506 507 // On le re-remplit 508 $('.events-items-slider').html(msg); 509 510 // on relance l'init du slider 511 appChild.sliders(); 512 513 $('.events-loader').removeClass('display'); 514 515 } 516 517 }); 518 519 } 520 521 }) 522 523 }, 524 525 // Filtrage des news 526 filterPosts : function() { 527 528 $(document).on('click', '.btn-tag-filter', function(e) { 529 e.preventDefault(); 530 531 var container, tags, params, ordre, tri, perpage, taxonomy, data; 532 533 $(this).toggleClass('active'); 534 535 container = $(this).data('tags-container'); 536 taxonomy = $(this).data('tax'); 537 538 // Datas 539 post_type = $(container).data('post_type'); 540 order = $(container).data('order'); 541 orderby = $(container).data('orderby'); 542 posts_per_page = $(container).data('posts_per_page'); 543 library = $(container).data('library'); 544 545 refresh = $(container).data('refresh'); 546 tpl = $(refresh).data('tpl'); 547 548 // On recupere les tags actifs 549 tags = []; 550 551 if ( $(this).data('tag-id') != '0' ) { 552 553 $('.btn-tag-filter.all-filter').removeClass('active'); 554 555 $(container).find('.btn-tag-filter.active').each(function(i,e) { 556 tags.push( $(e).data('tag-id') ); 557 }); 558 559 } else { 560 561 $('.btn-tag-filter').not($(this)).removeClass('active'); 562 563 } 564 565 // Parametres de la recherche 566 data = "action=refresh_posts" 567 + "&nonce=" + ajax_var.nonce 568 + "&post_type=" + post_type 569 + "&posts_per_page=" + posts_per_page 570 + "&orderby=" + orderby 571 + "&order=" + order 572 + "&taxonomy=" + taxonomy 573 + "&tags=" + tags 574 + "&tpl=" + tpl 575 ; 576 577 $('.loader').addClass('display'); 578 579 $.ajax({
580 581 type: "post", 582 url: ajax_var.url, 583 data: data, 584 585 success: function(msg){ 586 $(refresh).find('.row').empty(); 587 $(refresh).find('.row').html(msg); 588 $('.loader').removeClass('display'); 589 } 590 591 }); 592 }); 593 594 }, 595 596 597 // Bouton Charger + 598 loadMore : function() { 599 600 $(document).on('click', '.btn-load-more', function(e) { 601 e.preventDefault(); 602 603 var btn, tpl, post_type, posts_per_page, paged, orderby, order, refresh, tax, tags; 604 605 btn = $(this); 606 607 post_type = $(this).data('p'); 608 posts_per_page = $(this).data('pp'); 609 paged = $(this).data('pd'); 610 orderby = $(this).data('ob'); 611 order = $(this).data('o'); 612 meta = $(this).data('mt'); 613 metaType = $(this).data('mtp'); 614 s = $(this).data('s'); 615 tpl = $(this).data('tpl'); 616 617 container = $(this).data('container'); 618 619 if ( $(container).length ) { 620 refresh = $(container).data('refresh'); 621 tpl = $(refresh).data('tpl'); 622 tax = $(container).data('tax'); 623 } 624 625 626 // On recupere les tags actifs 627 tags = []; 628 629 $(container).find('.btn-tag-filter.active').each(function(i,e) { 630 tags.push( $(e).data('tag-id') ); 631 }); 632 633 634 // Parametres de la recherche 635 data = "action=load_more" 636 + "&nonce=" + ajax_var.nonce 637 638 + "&p=" + post_type 639 + "&pp=" + posts_per_page 640 + "&pd=" + (parseInt(paged)) 641 + "&ob=" + orderby 642 + "&o=" + order 643 + "&tpl=" + tpl 644 + "&tax=" + tax 645 + "&tags=" + tags 646 + "&mt=" + meta 647 + "&mtp=" + metaType 648 ; 649 650 // $('.news-loader').addClass('display'); 651 btn.addClass('loading'); 652 653 $.ajax({
654 655 type: "post", 656 url: ajax_var.url, 657 data: data, 658 659 success: function(msg){ 660 var response = JSON.parse(msg); 661 $(response.tpl).appendTo($(refresh)); 662 // msg.appendTo($(refresh)); 663 664 // $.data(btn, 'pd', 5); 665 btn.data('pd', (parseInt(paged) + 1)); 666 // btn.attr('data-pd', 5); 667 668 if ( response.max_num_pages > response.page ) { 669 btn.parents('.more_results').css('display', 'inline-block'); 670 } else { 671 btn.parents('.more_results').css('display', 'none'); 672 } 673 674 675 $('.news-loader').removeClass('display'); 676 btn.removeClass('loading'); 677 } 678 679 }); 680 681 }); 682 }, 683 684 // SUGGESTION DE RECHERCHE 685 suggest : function() { 686 $('.search-form__field').keyup(function(e) { 687 688 val = $(this).val(); 689 690 // On ne déclenche que s'il y a 3 caracteres tapes 691 if ( val.length > 2 ) { 692 693 // Parametres de la recherche 694 data = "action=suggest" 695 + "&nonce=" + ajax_var.nonce 696 + "&search=" + val 697 + "&perpage=3" 698 ; 699 700 $.ajax({
701 702 type: "post", 703 url: ajax_var.url, 704 data: data, 705 706 success: function(msg){ 707 if ( msg != '' ) { 708 $('.search-form__suggestions').html(msg).addClass('visible'); 709 } else { 710 $('.search-form__suggestions').empty().removeClass('visible'); 711 } 712 } 713 714 }); 715 716 } 717 718 }); 719 720 $('.search-form__field').blur(function(e) { 721 $('.search-form__suggestions').empty().removeClass('visible'); 722 }); 723 }, 724 725 // Onglets des pages 726 tabs : function(btn = null, tab = '', history = false) { 727 728 // Si on n'a pas de bouton ni tab, on checke l'url 729 if ( btn == null ) { 730 if ( tab == '' ) { 731 tab = ajax.getUrlParameter('tab'); 732 } 733 734 btn = $('.tab-button[data-objects="' + tab + '"]'); 735 } 736 else { 737 tab = btn.attr('href'); 738 } 739 740 /* Variables */ 741 var 742 objects = btn.data('objects'), 743 item = btn.data('item'), 744 itemid = btn.data('itemid'), 745 data, 746 title, 747 url = window.location.href, 748 urlArray = url.split('/'), 749 currentTab = urlArray[urlArray.length - 1], 750 slug = urlArray.pop() 751 ; 752 753 754 // Toggle du bouton 755 btn.parents('.tabs').find('.tab').removeClass('tab-active'); 756 btn.parents('.tab').addClass('tab-active'); 757 758 // HISTORY & BREADCRUMB 759 if ( tab !== 'undefined' && tab !== '' ) { 760 761 $('.loader').addClass('display'); 762 763 if ( !history ) { 764 window.history.pushState({id: tab}, tab, '?tab=' + tab); 765 } 766 767 data = "action=gtp"; 768 data += "&nonce="+ajax_var.nonce; 769 data += "&objects="+objects; 770 data += "&item="+item; 771 data += "&itemid="+itemid; 772 773 if ( objects == 'profile' ) { 774 data += "&template=template-parts/" + item + "s/" + objects; 775 } 776 else { 777 data += "&template=template-parts/" + item + "s/" + objects; 778 } 779 780 $.ajax({
781 782 type: "post", 783 url: ajax_var.url, 784 data: data, 785 786 success: function(msg){ 787 788 // On vide le conteneur 789 $('.tab-contents').empty(); 790 791 // On le re-remplit 792 $('.tab-contents').html(msg); 793 794 // Fil d'ariane 795 ajax.breadcrumbRefresh(tab); 796 797 // On vide le slider et on le deconstruit 798 if ( $('.thematics__slider').length ) { 799 // on relance l'init du slider 800 appChild.sliders(); 801 } 802 803 804 // On initialise la map 805 map.init(); 806 807 $('.loader').removeClass('display'); 808 809 } 810 811 }); 812 813 map.reinit(); 814 815 } 816 817 }, 818 819 singleAjax : function(btn = null) { 820 821 if ( btn !== null ) { 822 823 var 824 tpl = btn.data('tpl'), 825 item = btn.data('item'), 826 id = btn.data('item-id'), 827 slug = btn.data('slug'), 828 title = btn.data('title'), 829 refresh = btn.parents('.ajax-items-refresh') 830 ; 831 832 data = "action=get_single"; 833 data += "&nonce="+ajax_var.nonce; 834 data += "&tpl="+tpl; 835 data += "&id="+id; 836 837 $('.loader').addClass('display'); 838 839 // HISTORY 840 window.history.pushState({id: item+id}, null, '?' + item + '=' + slug + '&id=' + id); 841 842 $.ajax({
843 844 type: "post", 845 url: ajax_var.url, 846 data: data, 847 848 success: function(msg){ 849 850 refresh.empty(); 851 852 // On le re-remplit 853 refresh.html(msg); 854 855 $('.loader').removeClass('display'); 856 857 } 858 859 }); 860 861 } 862 863 }, 864 865 /* Gestion de l'historique */ 866 /* ----------------------------------------------------- */ 867 history : function(e) { 868 // var tab; 869 // if (e.state.id != '' ) 870 // tab = e.state.id; 871 // else { 872 // tab = profile; 873 // } 874 875 // ajax.tabs(null, tab, true); 876 }, 877 878 /* MaJ du breadcrumb */ 879 /* ----------------------------------------------------- */ 880 breadcrumbRefresh : function(item) { 881 882 var spans = $('.breadcrumbs span'); 883 884 // on fait le tour des span du fil d'ariane 885 spans.each(function(i, e) { 886 887 // Pour le dernier, 888 if ( i == (spans.length - 1) ) { 889 890 // on verifie s'il a été généré par bvt ou non 891 if ( $(e).hasClass('post')) { 892 // à ce moment là on ajoute notre span 893 $('.breadcrumbs').append(' → <span class="custom">' + item.charAt(0).toUpperCase() + item.slice(1) + '</span>'); 894 } 895 else { 896 $(e).addClass('custom').text(item.charAt(0).toUpperCase() + item.slice(1)); 897 } 898 } 899 }); 900 901 }, 902 903 /* Helper */ 904 /* ----------------------------------------------------- */ 905 getUrlParameter : function(name) { 906 name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); 907 var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); 908 var results = regex.exec(window.location.search); 909 910 return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); 911 } 912 913 }; 914 915 916})(jQuery) 917;(function ($) { 918 919 /* 920 * 921 * ASIDE 922 * 923 */ 924 aside = { 925 init : function() { 926 this.events(); 927 }, 928 929 events : function() { 930 $(document) 931 .on('click', '.site__aside .site__aside__header', function(e) { 932 aside.toggle(); 933 }) 934 .on('click', '.site__aside__local .site__aside__header', function(e) { 935 aside.toggle('local'); 936 }) 937 .on('click', '.open-aside', function(e) { 938 $(this).toggleClass('active'); 939 aside.toggle(); 940 }) 941 .on('click', '.open-aside-local', function(e) { 942 $(this).toggleClass('active'); 943 aside.toggle('local'); 944 }) 945 .on('keyup', function(e) { 946 if ( e.which == 27 && $('body').hasClass('aside-open')) { 947 aside.close(); 948 } 949 }) 950 ; 951 952 /* Hover */ 953 /* ----------------------------------------------------- */ 954 $('.site__aside').hover( 955 function() { 956 aside.open(); 957 }, 958 function() { 959 aside.close(); 960 } 961 ); 962 963 $('.site__aside__local').hover( 964 function() { 965 aside.open('local'); 966 }, 967 function() { 968 aside.close('local'); 969 } 970 ); 971 }, 972 973 scroll : function() { 974 if ( $(document).scrollTop() > ($('section:first-of-type').offset().top + $('section:first-of-type').innerHeight() )) { 975 aside.close(); 976 aside.close('local'); 977 aside.reduce(); 978 } else { 979 aside.expand(); 980 } 981 }, 982 983 open : function($l='') { 984 if ( $l != '' ) { 985 aside.close(); 986 $('body').addClass('aside-open-local'); 987 } else { 988 aside.close('local'); 989 $('body').addClass('aside-open'); 990 } 991 }, 992 993 close : function($l='') { 994 if ( $l != '' ) { 995 $('.open-aside-local').removeClass('active'); 996 $('body').removeClass('aside-open-local'); 997 } else { 998 $('.open-aside').removeClass('active'); 999 $('body').removeClass('aside-open'); 1000 } 1001 }, 1002 1003 toggle : function($l='') { 1004 if ( $l != '' ) { 1005 aside.close(); 1006 $('body').toggleClass('aside-open-local'); 1007 } else { 1008 aside.close('local'); 1009 $('body').toggleClass('aside-open'); 1010 } 1011 }, 1012 1013 reduce : function() { 1014 $('.site__aside, .site__aside__local').addClass('reduced'); 1015 }, 1016 1017 expand : function() { 1018 $('.site__aside, .site__aside__local').removeClass('reduced'); 1019 } 1020 1021 } 1022 1023 jQuery(document).ready(function($) { 1024 aside.init(); 1025 }); 1026 1027 jQuery(window).scroll(function($) { 1028 aside.scroll(); 1029 }); 1030 1031})(jQuery) 1032// JavaScript Document 1033;(function ($) { 1034 1035 /* 1036 * 1037 * Lancement du FlatPickr 1038 * 1039 */ 1040 calendar = { 1041 1042 init : function() { 1043 var today = new Date(), 1044 options = new Array(), 1045 reservations = new Array(); 1046 reservations2 = new Array(); 1047 // var tomorrow = new Date(today.getFullYear() + '-' + today.getMonth() + '-' + (today.getDate() + 1)); 1048 1049 $('.flatpickr').each(function(i, e) { 1050 1051 if ( $(e).attr('value') != '' ) { 1052 var day = $(e).attr('value'); 1053 } else { 1054 var day = new Date(); 1055 } 1056 1057 /* ----------------------------------------------------- */ 1058 /* JOURS RESERVES */ 1059 /* ----------------------------------------------------- */ 1060 if ( $(e).data('highlight') ) { 1061 reservations = $(e).data('highlight'); 1062 } 1063 1064 if ( $(e).data('highlight2') ) { 1065 reservations2 = $(e).data('highlight2'); 1066 } 1067 1068 if ( $(e).data('options') ) { 1069 options = $(e).data('options'); 1070 1071 if ( $(e).data('defaultDate') ) { 1072 options.defaultDate = new Date($(e).data('defaultDate')); 1073 } 1074 1075 if ( $(e).data('block') ) { 1076 var joursBloques = $(e).data('block'); 1077 1078 options.enable = [ 1079 function( date ) { 1080 return (joursBloques.indexOf(date.getDay()) >= 0); 1081 } 1082 ] 1083 } 1084 1085 if ( reservations.length > 0 ) { 1086 options.onDayCreate = function(dObj, dStr, fp, dayElem) { 1087 nb = 0; 1088 1089 // Si la date correspond a une date reservee 1090 for (var i = 0; i < reservations.length; i++) { 1091 var d = reservations[i], 1092 date = new Date(d * 1000); 1093 1094 // si le jour, mois et annee correspondent : 1095 if ( date.getFullYear() == dayElem.dateObj.getFullYear() 1096 && date.getMonth() == dayElem.dateObj.getMonth() 1097 && date.getDate() == dayElem.dateObj.getDate() 1098 ) { 1099 dayElem.classList.add('flatpickr-booked'); 1100 nb++; 1101 } 1102 } 1103 1104 // NB D'EVENEMENTS 1105 if ( nb > 0 ) { 1106 var badge = document.createElement('div'); 1107 badge.classList.add('nb'); 1108 badge.innerHTML = nb; 1109 1110 dayElem.append(badge); 1111 } 1112 } 1113 1114 options.onChange = function(selectedDates, dateStr, instance) { 1115 1116 var elem = $(instance.selectedDateElem); 1117 if ( $(elem).hasClass('flatpickr-booked') ) { 1118 window.location.href = '/evenement?start=' + dateStr; 1119 } 1120 } 1121 } 1122 } 1123 /* ----------------------------------------------------- */ 1124 /* QUAND ON N'A PAS D'OPTIONS */ 1125 /* ----------------------------------------------------- */ 1126 else { 1127 options = { 1128 'dateFormat' : 'd/m/Y', 1129 'defaultDate' : today, 1130 'shorthandCurrentMonth' : true, 1131 'disable' : [ 1132 { 1133 function(date) { 1134 return (date.getDay() === 0 || date.getDay() === 6); 1135 } 1136 } 1137 ], 1138 'locale' : 'fr', 1139 'inline': true 1140 }; 1141 } 1142 1143 $(e).flatpickr(options); 1144 }); 1145 1146 } 1147 1148 }; 1149 1150})(jQuery) 1151;(function ($) { 1152 1153 /* 1154 * 1155 * Panier, et mini-panier 1156 * 1157 */ 1158 cart = { 1159 1160 init : function() { 1161 this.events(); 1162 }, 1163 1164 events : function() { 1165 $(document) 1166 /* ------------------------------------------------------------ */ 1167 /* AVANT MD, ON OUVRE LE MINIPANIER AU CLICK SUR L'ITEM DU BAS */ 1168 /* ---------------------------------------------------------- */ 1169 .on('click', '.minicart-toggle', function(e) { 1170 e.preventDefault(); 1171 1172 $(this).parent().toggleClass('active'); 1173 $('html, body').scrollTop(0); 1174 $('body').toggleClass('minicart-open'); 1175 }) 1176 1177 .on('click', '.minicart-close', function(e) { 1178 $('.minicart-toggle').removeClass('active'); 1179 $('body').removeClass('minicart-open'); 1180 }) 1181 1182 /* ----------------------------------------------------- */ 1183 /* QUANTITES */ 1184 /* ----------------------------------------------------- */ 1185 .on('click', '.item__price__quantite button', function(e) { 1186 e.preventDefault(); 1187 1188 var 1189 container = $(this).parents('.item__price__quantite'),
1190 nb = container.find('.nb_container'), 1191 qteActuelle = parseInt(nb.text()), 1192 qteActualisee = parseInt($(this).data('qte')) 1193 ; 1194 1195 if ( qteActualisee >= 0 ) { 1196 1197 // AJAX 1198 1199 // MISE A JOUR 1200 nb.text(qteActualisee); 1201 container.find('.plus button').data('qte', qteActualisee + 1); 1202 container.find('.moins button').data('qte', qteActualisee - 1); 1203 1204 $('.puce').text(qteActualisee).addClass('animate'); 1205 1206 setTimeout(function() { 1207 $('.puce').removeClass('animate'); 1208 }, 2000); 1209 1210 } 1211 }) 1212 1213 /* ----------------------------------------------------- */ 1214 /* RECAP DU PANIER */ 1215 /* ----------------------------------------------------- */ 1216 .on('click', '.toggle-recapitulatif', function(e) { 1217 e.preventDefault(); 1218 1219 $(this).toggleClass('active'); 1220 $('.cart__paiement__recapitulatif__produits').slideToggle(400); 1221 }) 1222 1223 /* ----------------------------------------------------- */ 1224 /* TOGGLE CB */ 1225 /* ----------------------------------------------------- */ 1226 .on('click', '.cart__paiement__item__title', function(event) { 1227 if ( $(this).siblings('.cart__paiement__item__content').length ) { 1228 if ( $(this).find('input[type="radio"]').prop('checked', true) ) { 1229 $(this).siblings('.cart__paiement__item__content').slideDown(400); 1230 } 1231 else { 1232 $(this).siblings('.cart__paiement__item__content').slideUp(400); 1233 } 1234 } else { 1235 $('.cart__paiement__item__content').slideUp(400); 1236 } 1237 }) 1238 ; 1239 } 1240 1241 }; 1242 1243 jQuery(document).ready(function($) { 1244 cart.init(); 1245 }); 1246 1247})(jQuery) 1248// JavaScript Document 1249;(function ($) { 1250 1251 /* 1252 * 1253 * Cours 1254 * 1255 */ 1256 cours = { 1257 1258 init : function() { 1259 this.events(); 1260 this.checkMode(); 1261 }, 1262 1263 events : function() { 1264 1265 $(document) 1266 1267 /* ----------------------------------------------------- */ 1268 /* Affiche les cours d'un jour particulier sur la Home */ 1269 /* ----------------------------------------------------- */ 1270 .on('click', '.cours__jour.active', function(e) { 1271 1272 var 1273 btn = $(this), 1274 jour = $(this).data('day') 1275 ; 1276 1277 if ( jour ) { 1278 1279 var data = new Object(); 1280 1281 data['jour'] = jour; 1282 1283 $('.cours__search select').each(function(i,e) { 1284 if ( $(e).val() != '' ) { 1285 var id = $(e).attr('id'); 1286 data[id] = $(e).val(); 1287 } 1288 }); 1289 1290 $.ajax({
1291 'url' : base_url + 'cours/change_jour', 1292 'type' : 'GET', 1293 'data' : data, 1294 'success' : function( response ) { 1295 1296 $('.cours__jour.active').removeClass('open'); 1297 btn.addClass('open'); 1298 1299 $('.cours__list').empty().html( response ); 1300 }, 1301 'error' : function(request,error) 1302 { 1303 alert('une erreur est survenue'); 1304 } 1305 }); 1306 1307 } 1308 1309 }) 1310 1311 /* ----------------------------------------------------- */ 1312 /* Modifie les cours du planning au select sur un dojo */ 1313 /* ----------------------------------------------------- */ 1314 .on('change', 'select#dojo', function(e) { 1315 var dojo = e.target.value; 1316 1317 $.ajax({ 1318 'url' : base_url + 'cours/change_dojo_select', 1319 'type' : 'GET', 1320 'data' : { 1321 'rid_dojo' : dojo, 1322 }, 1323 'success' : function( response ) { 1324 if ( response != '' ) { 1325 var tab = JSON.parse( response ); 1326 1327 $('.cours__jours').empty().html( tab['semaine'] ); 1328 $('.cours__list').empty().html( tab['next'] ); 1329 } 1330 else { 1331 alert('Aucun cours'); 1332 } 1333 }, 1334 'error' : function(request,error) 1335 { 1336 alert('Une erreur est survenue'); 1337 } 1338 }); 1339 }) 1340 1341 /* ----------------------------------------------------- */ 1342 /* Change les cours en fonction du dojo */ 1343 /* ----------------------------------------------------- */ 1344 .on('click', '.choose_dojo', function(event) { 1345 event.preventDefault(); 1346 1347 var dojo = $(this).data('dojo'), btn = $(this); 1348 1349 if ( dojo ) { 1350 1351 $.ajax({
1352 'url' : base_url + 'cours/change_dojo', 1353 'type' : 'GET', 1354 'data' : { 1355 'rid_dojo' : dojo, 1356 }, 1357 'success' : function( response ) { 1358 1359 $('.choose_dojo').removeClass('btn-default').addClass('btn-primary'); 1360 btn.removeClass('btn-primary').addClass('btn-default'); 1361 1362 var tab = JSON.parse( response ); 1363 1364 $('.cours__week__lessons').empty().html( tab['planning'] ); 1365 $('.cours__block').empty().html( tab['block'] ); 1366 $('.cours__dojo').empty().html( tab['dojo'] ); 1367 1368 1369 }, 1370 'error' : function(request,error) 1371 { 1372 alert('une erreur est survenue'); 1373 } 1374 }); 1375 1376 } 1377 1378 }) 1379 1380 /* ----------------------------------------------------- */ 1381 /* Change le mode de visualisation dans la page dediee */ 1382 /* ----------------------------------------------------- */ 1383 .on('click', '.choose_mode', function(e) { 1384 e.preventDefault(); 1385 1386 var mode = $(this).data('mode'); 1387 1388 $('.choose_mode').not($(this)).removeClass('btn-default').addClass('btn-primary'); 1389 $(this).removeClass('btn-primary').addClass('btn-default'); 1390 1391 if (mode == "grid") { 1392 $('.cours__block').css({'display': 'block'}); 1393 $('.cours__week').css({'display': 'none'}); 1394 } else { 1395 $('.cours__block').css({'display': 'none'}); 1396 $('.cours__week').css({'display': 'block'}); 1397 } 1398 1399 }) 1400 1401 /* ----------------------------------------------------- */ 1402 /* Charge un cours en ajax */ 1403 /* ----------------------------------------------------- */ 1404 .on('click', '.cours__lecon, .cours__block__session', function(event) { 1405 event.preventDefault(); 1406 1407 var id = $(this).data('cours'), btn = $(this); 1408 1409 if ( id ) { 1410 1411 var data = new Object(); 1412 1413 data['id_cours'] = id; 1414 1415 $('.cours__search select').each(function(i,e) { 1416 if ( $(e).val() != '' ) { 1417 var id = $(e).attr('id'); 1418 data[id] = $(e).val(); 1419 } 1420 }); 1421 1422 $.ajax({
1423 'url' : base_url + 'cours/charge_cours', 1424 'type' : 'GET', 1425 'data' : data, 1426 'success' : function( response ) { 1427 $('.cours__lecon').removeClass('active'); 1428 btn.addClass('active'); 1429 1430 $('.cours__container__ajax').empty().html( response ); 1431 1432 $('html, body').animate({ 1433 'scrollTop': $('.cours__container__ajax').offset().top - $('header').innerHeight() }, 1434 500 1435 ); 1436 }, 1437 'error' : function(request,error) 1438 { 1439 alert('une erreur est survenue'); 1440 } 1441 }); 1442 1443 } 1444 1445 }) 1446 1447 /* ----------------------------------------------------- */ 1448 /* Filtre les cours en fonction de la recherche */ 1449 /* ----------------------------------------------------- */ 1450 .on('change', '.cours__search select', function(e) { 1451 1452 var data = new Object(); 1453 1454 $('.cours__search select').each(function(i,e) { 1455 if ( $(e).val() != '' ) { 1456 var id = $(e).attr('id'); 1457 data[id] = $(e).val(); 1458 } 1459 }); 1460 1461 $.ajax({
1462 'url' : base_url + 'cours/filtre_cours', 1463 'type' : 'GET', 1464 'data' : data, 1465 'success' : function( response ) { 1466 1467 var tab = JSON.parse( response ); 1468 1469 // $('.cours__week__lessons').empty().html( tab['planning'] ); 1470 $('.cours__jours').empty().html( tab['semaine'] ); 1471 $('.cours__list').empty().html( tab['next'] ); 1472 }, 1473 'error' : function(request,error) 1474 { 1475 alert('une erreur est survenue'); 1476 } 1477 }); 1478 1479 }) 1480 ; 1481 1482 }, 1483 1484 checkMode : function() { 1485 if ( $('.cours__week').length && $('body').hasClass('club_cours')) { 1486 if ( $(window).innerWidth() <= 768 ) { 1487 $('.cours__week').css('display', 'none'); 1488 $('.cours__block').css('display', 'block'); 1489 $('.choose_mode[data-mode="semaine"]').removeClass('btn-default').addClass('btn-primary'); 1490 $('.choose_mode[data-mode="grid"]').removeClass('btn-primary').addClass('btn-default'); 1491 } 1492 else { 1493 $('.cours__week').css('display', 'block'); 1494 $('.cours__block').css('display', 'none'); 1495 $('.choose_mode[data-mode="grid"]').removeClass('btn-default').addClass('btn-primary'); 1496 $('.choose_mode[data-mode="semaine"]').removeClass('btn-primary').addClass('btn-default'); 1497 } 1498 } 1499 } 1500 1501 } 1502 1503 $(window).resize(function($) { 1504 cours.checkMode(); 1505 }); 1506 1507})(jQuery) 1508 1509 1510;(function ($) { 1511 1512 /* 1513 * 1514 * Detection des devices 1515 * 1516 */ 1517 device = { 1518 1519 isMobile : function() { 1520 return $('html').hasClass('mobile'); 1521 }, 1522 1523 isTablet : function() { 1524 return $('html').hasClass('tablet'); 1525 }, 1526 1527 isiOS : function() { 1528 return $('html').hasClass('ios'); 1529 } 1530 1531 }; 1532 1533})(jQuery) 1534// JavaScript Document 1535;(function ($) { 1536 1537 /* 1538 * 1539 * Gestion des evenements 1540 * 1541 */ 1542 var events = { 1543 1544 init : function() { 1545 1546 // Recuperation des dates des evenements 1547 if ( $('#the_events').length ) { 1548 var dates = JSON.parse($('#the_events').val()); 1549 } 1550 1551 if ( jQuery().flatpickr ) { 1552 $("#events_calendar").flatpickr({ 1553 inline: true, 1554 static: true, 1555 onDayCreate: function(dObj, dStr, fp, dayElem){ 1556 console.log(dObj, dStr, fp, dayElem); 1557 } 1558 }); 1559 } 1560 1561 this.events(); 1562 // this.checkMode(); 1563 }, 1564 1565 events : function() { 1566 $(document) 1567 /* ----------------------------------------------------- */ 1568 /* Change le mode de visualisation dans la page dediee */ 1569 /* ----------------------------------------------------- */ 1570 .on('click', '.choose_mode', function(e) { 1571 e.preventDefault(); 1572 1573 var mode = $(this).data('mode'); 1574 1575 $('.choose_mode').not($(this)).removeClass('btn-default').addClass('btn-primary'); 1576 $(this).removeClass('btn-primary').addClass('btn-default'); 1577 1578 if (mode == "list") { 1579 $('.list-toggle').css({'display': 'block'}); 1580 $('.calendar-toggle').css({'display': 'none'}); 1581 } else { 1582 $('.list-toggle').css({'display': 'none'}); 1583 $('.calendar-toggle').css({'display': 'block'}); 1584 } 1585 1586 }) 1587 1588 /* ----------------------------------------------------- */ 1589 /* LIENS ENTRE TYPES D'EVENEMENT ET TYPE DE COMPETITION */ 1590 /* ----------------------------------------------------- */ 1591 .on('change', '#libelleType', function() { 1592 var type = $(this).val(), 1593 competitions = new Object(), 1594 select, 1595 option, 1596 i; 1597 1598 switch ( type ) { 1599 case "STAGE": 1600 competitions = [ 1601 'STAGE' 1602 ]; 1603 break 1604 case "COMPETITION": 1605 competitions = [ 1606 'INDIVIDUELLE', 1607 'EQUIPE', 1608 '1/2 FINALES' 1609 ]; 1610 break 1611 case "PASSAGE DE GRADE": 1612 competitions = [ 1613 'UV1 - KATA', 1614 'UV2 - TECHNIQUE', 1615 'UV3 - TEC (shiaï)', 1616 'UV4 - ENGAGEMENT PERSONNEL', 1617 'EXPRESSION TECHNIQUE' 1618 ]; 1619 break 1620 case "JUJITSU": 1621 competitions = [ 1622 'NE WAZA', 1623 'COMBAT', 1624 'EXPRESSION TECHNIQUE' 1625 ]; 1626 break 1627 case "KATA SPORTIF": 1628 competitions = [ 1629 'MINIMES', 1630 'ANIMATION', 1631 'ELITE' 1632 ]; 1633 break 1634 1635 case "": 1636 default: 1637 competitions = [ 1638 'STAGE', 1639 'INDIVIDUELLE', 1640 'EQUIPE', 1641 '1/2 FINALES', 1642 'UV1 - KATA',
1643 'UV2 - TECHNIQUE', 1644 'UV3 - TEC (shiaï)', 1645 'UV4 - ENGAGEMENT PERSONNEL', 1646 'EXPRESSION TECHNIQUE', 1647 'NE WAZA', 1648 'COMBAT', 1649 'MINIMES', 1650 'ANIMATION', 1651 'ELITE' 1652 ]; 1653 break; 1654 1655 } 1656 1657 if ( $('#libelleCompet').length ) { 1658 $('#libelleCompet').empty(); 1659 select = document.getElementById('libelleCompet'); 1660 option = document.createElement("option"); 1661 option.value = ''; 1662 option.text = 'Type de compétition'; 1663 select.add(option); 1664 1665 for (i = 0; i <= competitions.length - 1; i++) { 1666 option = document.createElement("option"); 1667 option.value = competitions[i]; 1668 option.text = competitions[i]; 1669 1670 select.add(option); 1671 } 1672 } 1673 1674 }) 1675 ; 1676 }, 1677 1678 checkMode : function() { 1679 1680 if ( $('.calendar-toggle').length && !$('#recherche').length ) { 1681 1682 if ( $(window).innerWidth() <= 768 ) { 1683 $('.calendar-toggle').css('display', 'none'); 1684 $('.list-toggle').css('display', 'block'); 1685 $('.choose_mode[data-mode="calendar"]').removeClass('btn-default').addClass('btn-primary'); 1686 $('.choose_mode[data-mode="list"]').removeClass('btn-primary').addClass('btn-default'); 1687 } 1688 else { 1689 $('.calendar-toggle').css('display', 'block'); 1690 $('.list-toggle').css('display', 'none'); 1691 $('.choose_mode[data-mode="list"]').removeClass('btn-default').addClass('btn-primary'); 1692 $('.choose_mode[data-mode="calendar"]').removeClass('btn-primary').addClass('btn-default'); 1693 } 1694 } 1695 } 1696 1697 }, 1698 1699 /* 1700 * 1701 * Lancement du FlatPickr 1702 * 1703 */ 1704 flatpickr = { 1705 1706 init : function() { 1707 var today = new Date(); 1708 // var tomorrow = new Date(today.getFullYear() + '-' + today.getMonth() + '-' + (today.getDate() + 1)); 1709 1710 $('.flatpickr').each(function(i, e) { 1711 1712 if ( $(e).attr('value') != '' ) { 1713 var day = $(e).attr('value'); 1714 } else { 1715 var day = new Date(); 1716 } 1717 1718 $(e).flatpickr({ 1719 'dateFormat' : 'd/m/Y', 1720 'defaultDate' : today, 1721 'shorthandCurrentMonth' : true, 1722 'locale' : 'fr', 1723 }); 1724 }); 1725 1726 } 1727 1728 } 1729 ; 1730 1731 $(document).ready(function($) { 1732 events.init(); 1733 }); 1734 1735 $(window).resize(function($) { 1736 // events.checkMode(); 1737 }); 1738 1739})(jQuery) 1740;(function ($) { 1741 1742 /* 1743 * 1744 * Galeries 1745 * 1746 */ 1747 gallery = { 1748 1749 // isotope, masonry, ... 1750 library : 'masonry', 1751 1752 init : function() { 1753 1754 $(document).on('click', '.btn-tag-filter-hide', function() { 1755 1756 $('.btn-tag-filter-hide').not($(this)).removeClass('active'); 1757 $(this).toggleClass('active'); 1758 1759 gallery.filterTags($(this)); 1760 1761 }) 1762 1763 if ( $('#gallery').length ) { 1764 switch ( gallery.library ) { 1765 case 'isotope': 1766 gallery.refreshLibrary( 'isotope', '#gallery', '.gallery-item'); 1767 break; 1768 case 'masonry': 1769 gallery.refreshLibrary( 'masonry', '#gallery', '.gallery__album__grid__home__item'); 1770 break; 1771 } 1772 } 1773 1774 }, 1775 1776 filterTags : function(btn) { 1777 1778 var 1779 filterList = btn.data('tags-container'), 1780 tagId = btn.data('tag-id'), 1781 1782 library = $(filterList).data('library'), 1783 objects = $(filterList).data('objects'), 1784 refresh = $(filterList).data('refresh'), 1785 1786 tags, 1787 tagsData 1788 ; 1789 1790 1791 $(objects).each(function(i, e ) { 1792 1793 tagsData = $(e).data('tags'); 1794 1795 if ( tagsData.length > 0 ) { 1796 1797 tags = JSON.parse(tagsData); 1798 1799 if ( tagId !== '' ) { 1800 1801 if ( tags == tagId ) { 1802 gallery.displayItem($(e)); 1803 } 1804 else { 1805 gallery.hideItem($(e)); 1806 } 1807 1808 } else { 1809 gallery.displayItem($(e)); 1810 } 1811 1812 } 1813 else { 1814 gallery.hideItem($(e)); 1815 } 1816 1817 }) 1818 1819 if ( library ) { 1820 gallery.refreshLibrary(library, $(refresh), objects); 1821 } 1822 1823 }, 1824 1825 displayItem : function( obj ) { 1826 obj.addClass('display'); 1827 }, 1828 1829 hideItem : function( obj ) { 1830 obj.removeClass('display'); 1831 1832 }, 1833 1834 refreshLibrary : function ( library, container, item ) { 1835 1836 if ( typeof container == "string" ) { 1837 container = $(container); 1838 } 1839 1840 switch ( library ) { 1841 case 'isotope': 1842 var $grid = container.isotope({ 1843 percentPosition: true, 1844 horizontalOrder: true, 1845 itemSelector: item, 1846 masonry: { 1847 columnWidth: '.gallery-sizer', 1848 // gutter: '.5rem' 1849 }, 1850 // filter: '.display', 1851 stagger: 30 1852 });
1853 1854 $grid.imagesLoaded().progress( function() { 1855 $grid.isotope('layout'); 1856 }); 1857 break; 1858 1859 case 'masonry': 1860 container.masonry({ 1861 // options 1862 itemSelector: item, 1863 columnWidth: '.gallery__album__sizer', 1864 percentPosition: true, 1865 gutter: 8, 1866 // horizontalOrder: true 1867 }).masonry('layout'); 1868 1869 setTimeout(function() { 1870 container.masonry('layout') 1871 }, 500); 1872 break; 1873 } 1874 1875 } 1876 1877 }; 1878 1879})(jQuery) 1880;(function ($) { 1881 1882/* 1883 * 1884 * Carte interactive 1885 * 1886 */ 1887 map = { 1888 1889 parameters : null, 1890 1891 lmap: null, 1892 container: '', 1893 maps: [], 1894 1895 type: '', 1896 lat: '', 1897 lng: '', 1898 height: '', 1899 zoom: '', 1900 apiKey: '', 1901 tiles: '', 1902 URL: '', 1903 1904 all: null, 1905 clusterLayer: null, 1906 markersJSON: '', 1907 markers: [], 1908 lmarker: null, 1909 activeMarkers: new Array(), 1910 bounds: new Array(), 1911 1912 reinit : function() { 1913 if ( map.maps.length > 0 ) { 1914 for (var i = 0; i < map.maps.length; i++) { 1915 map.maps[i].invalidateSize(); 1916 } 1917 } 1918 1919 if ( map.lmap !== null ) { 1920 map.lmap.invalidateSize(); 1921 } 1922 }, 1923 1924 /* ----------------------------------------------------- */ 1925 /* INITIALISATION DU MODULE */ 1926 /* ----------------------------------------------------- */ 1927 init : function() { 1928 map.events(); 1929 1930 /* Parametres d'initialisation des maps */ 1931 /* ----------------------------------------------------- */ 1932 if ( $('.items_map_parameters').length > 0 ) { 1933 1934 $('.items_map_parameters').each(function(i,e) { 1935 1936 map.parameters = $(e); 1937 map.container = map.parameters.data('container'); 1938 map.markersJSON = map.parameters.data('markers'); 1939 map.type = map.parameters.data('type'); 1940 map.lat = map.parameters.data('lat'); 1941 map.lng = map.parameters.data('lng'); 1942 map.height = map.parameters.data('height'); 1943 map.zoom = map.parameters.data('zoom'); 1944 map.tiles = map.parameters.data('tiles'); 1945 map.apiKey = map.parameters.data('apikey'); 1946 map.cluster = map.parameters.data('cluster'); 1947 1948 switch ( map.type ) { 1949 case 'gmap' : 1950 map.gmap(); 1951 break; 1952 1953 case 'osm' : 1954 map.osm(); 1955 break; 1956 1957 case 'ign' : 1958 map.ign(); 1959 break; 1960 1961 case 'mapbox' : 1962 map.mapbox(); 1963 break; 1964 1965 default : 1966 alert( 'Veuillez indiquer un type de carte' ); 1967 break; 1968 } 1969 1970 }); 1971 1972 } 1973 1974 1975 if ( $('#map_parameters').length > 0 ) { 1976 1977 map.parameters = $('#map_parameters'); 1978 map.container = map.parameters.data('container'); 1979 map.markersJSON = map.parameters.data('markers'); 1980 map.type = map.parameters.data('type'); 1981 map.lat = map.parameters.data('lat'); 1982 map.lng = map.parameters.data('lng'); 1983 map.height = map.parameters.data('height'); 1984 map.zoom = map.parameters.data('zoom'); 1985 map.tiles = map.parameters.data('tiles'); 1986 map.apiKey = map.parameters.data('apikey'); 1987 map.cluster = map.parameters.data('cluster'); 1988 1989 switch ( map.type ) { 1990 case 'gmap' : 1991 map.gmap(); 1992 break; 1993 1994 case 'osm' : 1995 map.osm(); 1996 break; 1997 1998 case 'ign' : 1999 map.ign(); 2000 break; 2001 2002 case 'mapbox' : 2003 map.mapbox(); 2004 break; 2005 2006 default : 2007 alert( 'Veuillez indiquer un type de carte' ); 2008 break; 2009 } 2010 2011 } 2012 }, 2013 2014 /* ----------------------------------------------------- */ 2015 /* EVENEMENTS */ 2016 /* ----------------------------------------------------- */ 2017 events : function() { 2018 $(document) 2019 2020 /* Fermeture de la popup de carte */ 2021 /* ----------------------------------------------------- */ 2022 .on('click', '.map_popup_close', function() { 2023 map.hidePopup(); 2024 }) 2025 2026 2027 /* Selection d'un point quand on clique sur son item */ 2028 /* ----------------------------------------------------- */ 2029 .on('click', '.object .select-marker', function(e) { 2030 e.preventDefault(); 2031 $('.objects-list .object').removeClass('active'); 2032 $(this).parents('.object').toggleClass('active'); 2033 map.selectMarker($(this).data('lat'), $(this).data('lng')); 2034 }) 2035 2036 /* Filtrage par tag */ 2037 /* ----------------------------------------------------- */ 2038 .on('click', '.btn-tag-map', function(e) { 2039 e.preventDefault(); 2040 2041 $(this).toggleClass('active'); 2042 2043 // map.lmap.closePopup(); 2044 2045 var tags = []; 2046 2047 $($(this).data('tags-container')).find('.btn-tag-map').each(function(i,e) { 2048 2049 if ( $(e).hasClass('active') ) { 2050 tags.push($(e).data('tag-id')); 2051 } 2052 });
2053 2054 map.filterMarkers( tags ); 2055 2056 $('html,body').animate({ 2057 'scrollTop': $('#' + map.container).offset().top }, 2058 500 2059 ); 2060 2061 }) 2062 ; 2063 }, 2064 2065 /* ----------------------------------------------------- */ 2066 /* GOOGLE MAPS */ 2067 /* ----------------------------------------------------- */ 2068 gmap : function() { 2069 map.tiles = ''; 2070 }, 2071 2072 /* ----------------------------------------------------- */ 2073 /* OPEN STREET MAP */ 2074 /* ----------------------------------------------------- */ 2075 osm : function() { 2076 2077 if ( map.tiles == '' ) { 2078 map.tiles = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"; 2079 } 2080 2081 if ( map.height != '' ) { 2082 $('#' + map.container).css('height', map.height); 2083 } 2084 2085 map.lmap = new L.map( 2086 map.container, 2087 { 2088 attributionControl: false, 2089 worldCopyJump: true, 2090 scrollWheelZoom: false, 2091 maxZoom: 18, 2092 } 2093 ).setView( 2094 [ 2095 map.lat, 2096 map.lng 2097 ], 2098 map.zoom 2099 ); 2100 2101 /* Ajout au tableau de maps */ 2102 /* ----------------------------------------------------- */ 2103 map.maps.push(map.lmap); 2104 2105 /* Creation des POI sur la map */ 2106 /* ----------------------------------------------------- */ 2107 map.createMarkers(); 2108 2109 L.tileLayer( 2110 map.tiles, 2111 { 2112 attribution: 'Contributeurs © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' 2113 } 2114 ).addTo(map.lmap); 2115 2116 // L.control.layers(null, overlaysMap, {collapsed: false}).addTo(lmap); 2117 2118 // $('.leaflet-control-layers-list').prepend('<label>Legende</label>'); 2119 2120 // all.addTo(lmap) 2121 2122 }, 2123 2124 /* ----------------------------------------------------- */ 2125 /* IGN */ 2126 /* ----------------------------------------------------- */ 2127 ign : function() { 2128 2129 map.URL = "https://wxs.ign.fr/" + map.apiKey + "/geoportail/wmts?" + 2130 "&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0" + 2131 "&STYLE=normal" + 2132 "&TILEMATRIXSET=PM" + 2133 "&FORMAT=image/jpeg"+ 2134 "&LAYER=ORTHOIMAGERY.ORTHOPHOTOS"+ 2135 "&TILEMATRIX={z}" + 2136 "&TILEROW={y}" + 2137 "&TILECOL={x}" 2138 ; 2139 2140 2141 if ( map.height > 0 ) { 2142 $('#' + map.container).css('height', map.height); 2143 } 2144 2145 var lmap = new L.map( 2146 map.container 2147 ).setView( 2148 [ 2149 map.lat, 2150 map.lng 2151 ], 2152 map.zoom 2153 ); 2154 2155 L.tileLayer( 2156 map.URL, 2157 { 2158 minZoom : 0, 2159 maxZoom : 18, 2160 attribution : "IGN-F/Geoportail", 2161 tileSize : 256 2162 } 2163 ).addTo(map.lmap) ; 2164 }, 2165 2166 /* ----------------------------------------------------- */ 2167 /* MAPBOX */ 2168 /* ----------------------------------------------------- */ 2169 mapbox : function() { 2170 map = this; 2171 2172 mapboxgl.accessToken = map.apiKey; 2173 2174 map.lmap = new mapboxgl.Map({ 2175 container: map.container, 2176 style: map.tiles, 2177 center: [map.lng, map.lat], 2178 zoom: map.zoom, 2179 scrollZoom: false, 2180 renderWorldCopies: false, 2181 }); 2182 2183 var nav = new mapboxgl.NavigationControl({ 2184 showCompass: true, 2185 showZoom: true 2186 }); 2187 map.lmap.addControl(nav, 'top-left'); 2188 2189 // Legende 2190 // Tableau de categories 2191 var catsArray = new Array(); 2192 var markers = $.parseJSON( $('#map_markers').val() ); 2193 2194 for (var i = 0; i < markers.length; i++) { 2195 var marker = markers[i]; 2196 for (var j = 0; j < marker.tags.length; j++) { 2197 if ( catsArray.indexOf(marker.tags[j]) < 0 ) { 2198 catsArray.push(marker.tags[j]); 2199 } 2200 } 2201 } 2202 2203 /* CREATION DES LEGENDES */ 2204 /* ----------------------------------------------------- */ 2205 // if ( catsArray.length > 0 ) { 2206 // var text = ""; 2207 // text += "<div class='tags-container'>"; 2208 2209 // for (var j = 0; j < catsArray.length; j++) { 2210 // var cat = catsArray[j]; 2211 // text += '<a href="" class="btn-tag-map active" data-tags-container=".tags-container" data-tag-id="' + cat.term_id + '" ><img src="../../images/map/marker_' + cat.slug + '.png" /><span>' + cat.name + '</span></a>'; 2212 // } 2213 2214 // text += "</div>"; 2215 // $('#map_legend').html(text); 2216 // } 2217 2218 2219 /* CREATION DES MARKERS */ 2220 /* ----------------------------------------------------- */ 2221 map.createMarkers(); 2222 }, 2223 2224 /* ----------------------------------------------------- */ 2225 /* MARKERS */ 2226 /* ----------------------------------------------------- */ 2227 /* 2228 * Cree les markers a mettre sur la carte 2229 * 2230 * markersArray ( array/null ) : tableau de markers filtres 2231 * init ( bool ) : initialisation de la map ou filtrage. Si filtrage, on ne recree pas tous les markers 2232 */ 2233 createMarkers : function( markersArray = null, init = true ) { 2234 var markers = new Array(); 2235 if ( markersArray !== null ) { 2236 markers = markersArray; 2237 } 2238 else if ( $('#' + map.markersJSON).length ) { 2239 markers = $.parseJSON( $('#' + map.markersJSON).val() ); 2240 } 2241 else if ( $('#map_markers').length ) { 2242 markers = $.parseJSON( $('#map_markers').val() ); 2243 } 2244 2245 if ( markers.length > 0 ) { 2246 switch (map.type) { 2247 case 'gmap': 2248 break; 2249 2250 case 'osm': 2251 2252 /* Creation d'un cluster de points */ 2253 /* ----------------------------------------------------- */ 2254 if ( map.cluster ) { 2255 map.clusterLayer = L.markerClusterGroup({ 2256 showCoverageOnHover: true, 2257 // zoomToBoundsOnClick: true, 2258 // removeOutsideVisibleBounds: true, 2259 spiderfyOnMaxZoom: true, 2260 // singleMarkerMode: true, 2261 });
2262 2263 /* Ajout du layer de cluster a la map */ 2264 /* ----------------------------------------------------- */ 2265 map.lmap.addLayer(map.clusterLayer); 2266 // map.lmap.fitBounds(new L.featureGroup(map.markers).getBounds()); 2267 } 2268 2269 for (var i = 0; i < markers.length; i++) { 2270 var marker = markers[i]; 2271 if ( marker.lat !== null && marker.lng !== null ) { 2272 //console.log(marker); 2273 map.createMarker(marker, init); 2274 } 2275 } 2276 2277 2278 break; 2279 2280 case 'ign': 2281 break; 2282 2283 case 'mapbox': 2284 for (var i = 0; i < markers.length; i++) { 2285 var marker = markers[i]; 2286 map.createMarker(marker, init); 2287 } 2288 break; 2289 2290 } 2291 } 2292 2293 }, 2294 2295 /* Creation d'un marker unique */ 2296 /* ----------------------------------------------------- */ 2297 /* 2298 * createMarker 2299 * marker ( Marker ) : objet marker 2300 * init ( Bool ) : verifie si on est a l'initialisation ou non 2301 */ 2302 createMarker : function( marker, init = true ) { 2303 switch ( map.type ) { 2304 case 'gmap': 2305 break; 2306 2307 case 'osm': 2308 2309 var lmarker = L.marker( 2310 [ 2311 marker['lat'], 2312 marker['lng'] 2313 ] 2314 ); 2315 2316 if ( map.cluster ) { 2317 map.clusterLayer.addLayer(lmarker); 2318 } else { 2319 lmarker.addTo(map.lmap); 2320 } 2321 2322 /* Changement de l'icon de base */ 2323 /* ----------------------------------------------------- */ 2324 var iconUrl = ''; 2325 2326 if ( marker['type'] ) { 2327 iconUrl = marker['type'] + '.svg'; 2328 } else { 2329 iconUrl = 'default.svg'; 2330 } 2331 // iconUrl: '/nexa/www/content/themes/nexa/assets/images/map/marker_' + iconUrl, 2332 var icon = L.icon( 2333 { 2334 iconUrl: 'assets/images/map/marker_' + iconUrl, 2335 iconSize: [36, 50], 2336 iconAnchor: [18, 50], 2337 popupAnchor: [0, -50], 2338 } 2339 ); 2340 2341 if (icon) { 2342 lmarker.setIcon(icon); 2343 } 2344 2345 if ( init ) { 2346 map.markers.push(lmarker); 2347 } 2348 2349 lmarker.id = marker['id']; 2350 lmarker.class = iconUrl; 2351 lmarker.title = marker['title']; 2352 lmarker.content = marker['content']; 2353 lmarker.image = marker['image']; 2354 lmarker.link = marker['link']; 2355 lmarker.type = marker['type'], 2356 lmarker.region = marker['region'], 2357 lmarker.typology = marker['typology'], 2358 lmarker.thematic = marker['thematic']; 2359 2360 // lmarker.on('click', function(e) { 2361 // $('.objects-list').remove(); 2362 // }); 2363 2364 var popup = map.createPopup(lmarker); 2365 lmarker.bindPopup(popup); 2366 break; 2367 2368 case 'ign': 2369 break; 2370 2371 case 'mapbox': 2372 2373 var el = document.createElement('div'); 2374 el.className = 'marker' + ' marker_' + marker.tags[0].slug; 2375 2376 var lmarker = new mapboxgl.Marker({ 2377 'element' : el, 2378 'anchor' : 'bottom', 2379 }) 2380 .setLngLat([marker.lng, marker.lat]) 2381 .addTo(map.lmap); 2382 2383 lmarker.id = marker.id; 2384 lmarker.title = marker.title; 2385 lmarker.content = marker.content; 2386 lmarker.image = marker.image; 2387 lmarker.link = marker.link; 2388 2389 var popup = map.createPopup(lmarker); 2390 2391 lmarker.setPopup(popup); 2392 2393 if ( init ) { 2394 map.markers.push(lmarker); 2395 } 2396 2397 break; 2398 2399 } 2400 2401 }, 2402 2403 /* Cree une liste d'objets cliquables */ 2404 /* ----------------------------------------------------- */ 2405 createMarkersList : function( markers ) { 2406 2407 // On recree la popup 2408 var popup = '<div class="objects-list">'; 2409 2410 for (var i = 0; i < markers.length; i++) { 2411 var mrkr = markers[i]; 2412 popup += '<div class="object">'; 2413 2414 popup += '<a href="" class="select-marker" data-lat="' + mrkr.lat + '" data-lng="' + mrkr.lng + '">' + mrkr.title + '</a>'; 2415 popup += '<div class="object-actions">'; 2416 //popup += '<div class="object-position"><a href="" class="select-marker" data-lat="' + mrkr.lat + '" data-lng="' + mrkr.lng + '"><i class="fas fa-map-marker-alt"></i></a></div>'; 2417 popup += '<div class="object-link"><a href="' + mrkr.link + '"><i class="fas fa-angle-right"></i></a></div>'; 2418 popup += '</div>'; 2419 popup += '</a>'; 2420 2421 popup += '</div>'; 2422 } 2423 popup += '</div>'; 2424 2425 return popup; 2426 2427 }, 2428 2429 /* Filtre les markers en fonction des tags */ 2430 /* ----------------------------------------------------- */ 2431 filterMarkers : function( region, thematic, typology ) { 2432 2433 map.activeMarkers = new Array(); 2434 2435 for ( var i = 0; i < map.markers.length; i++ ) { 2436 var marker = map.markers[i];
2437 var active = false; 2438 2439 if ( active ) { 2440 map.activeMarkers.push(marker); 2441 } 2442 else { 2443 $('.mapboxgl-marker').remove(); 2444 marker.remove(); 2445 } 2446 2447 } 2448 2449 map.refreshMarkers(); 2450 }, 2451 2452 /* Rafraichit l'affichage des clusters */ 2453 /* ----------------------------------------------------- */ 2454 refreshMarkers : function() { 2455 2456 switch ( map.type ) { 2457 case 'gmap': 2458 break; 2459 2460 case 'osm': 2461 case 'ign': 2462 2463 if ( map.cluster ) { 2464 map.clusterLayer.clearLayers(); 2465 } 2466 2467 if ( map.activeMarkers ) { 2468 var activeMarkersArray = new Array(); 2469 2470 for ( var j = 0; j < map.activeMarkers.length; j++ ) { 2471 2472 var marker = map.activeMarkers[j], lmarker = new Array(); 2473 2474 lmarker['id'] = marker.id; 2475 lmarker['title'] = marker.title; 2476 lmarker['content'] = marker.content; 2477 lmarker['image'] = marker.image; 2478 lmarker['link'] = marker.link; 2479 lmarker['tags'] = marker.tags; 2480 lmarker['lat'] = marker.getLatLng().lat; 2481 lmarker['lng'] = marker.getLatLng().lng; 2482 lmarker['type'] = marker.type, 2483 lmarker['region'] = marker.region, 2484 lmarker['typology'] = marker.typology, 2485 lmarker['thematic'] = marker.thematic; 2486 2487 activeMarkersArray.push(lmarker); 2488 } 2489 } 2490 2491 break; 2492 2493 case 'mapbox': 2494 if ( map.activeMarkers ) { 2495 var activeMarkersArray = new Array(); 2496 2497 for ( var j = 0; j < map.activeMarkers.length; j++ ) { 2498 2499 var marker = map.activeMarkers[j], lmarker = new Array(); 2500 2501 lmarker['id'] = marker.id; 2502 lmarker['title'] = marker.title; 2503 lmarker['content'] = marker.content; 2504 lmarker['image'] = marker.image; 2505 lmarker['link'] = marker.link; 2506 lmarker['tags'] = marker.tags; 2507 lmarker['lat'] = marker.getLngLat()['lat']; 2508 lmarker['lng'] = marker.getLngLat()['lng']; 2509 2510 activeMarkersArray.push(lmarker); 2511 } 2512 2513 } 2514 break; 2515 2516 } 2517 2518 map.createMarkers(activeMarkersArray, false); 2519 2520 }, 2521 2522 /* Selectionne un marker en fonction du click sur un item */ 2523 /* ------------------------------------------------------ */ 2524 selectMarker : function( lat, lng ) { 2525 2526 for (var i = map.markers.length - 1; i >= 0; i--) { 2527 marker = map.markers[i]; 2528 2529 if ( marker._latlng['lat'] == lat && marker._latlng['lng'] == lng ) { 2530 map.cluster.zoomToShowLayer(marker); 2531 marker.openPopup(); 2532 } 2533 } 2534 2535 }, 2536 2537 /* ----------------------------------------------------- */ 2538 /* INFOWINDOW */ 2539 /* ----------------------------------------------------- */ 2540 createPopup : function(marker) { 2541 2542 // On recree la popup 2543 var popup, p = ''; 2544 2545 if ( marker.title != '' ) { 2546 popup = ''; 2547 popup += '<div class="map_popup">'; 2548 popup += '<div class="map_popup_content">'; 2549 //if ( marker.link != '' ) { popup += '<a href="' + marker.link + '">'; } 2550 2551 if ( marker.image != '' ) { 2552 popup += '<div class="map_popup_content_image">';
2553 popup += '<img src="' + marker.image + '" />'; 2554 popup += '</div>'; 2555 } 2556 2557 // if ( marker.type != '' ) { 2558 // popup += '<div class="map_popup_content_type">'; 2559 // popup += '<a href="" class="btn btn-'+marker.type+'">' + marker.type + '</a>'; 2560 // popup += '</div>'; 2561 // } 2562 2563 popup += '<div class="map_popup_content_container">'; 2564 if ( marker.title != '' ) { popup += '<div class="map_popup_content_titre">' + marker.title + '</div>'; } 2565 if ( marker.content != '' ) { popup += '<div class="map_popup_content_texte">' + marker.content + '</div>'; } 2566 popup += '</div>'; 2567 2568 // if ( marker.link != '' ) { popup += '</a>'; } 2569 popup += '</div>'; 2570 popup += '</div>'; 2571 2572 if ( popup != '' ) { 2573 2574 switch ( map.type ) { 2575 case 'gmap': 2576 break; 2577 2578 case 'osm': 2579 case 'ign': 2580 p = L.popup({ 2581 minWidth: 250, 2582 maxWidth: 500, 2583 }).setContent(popup); 2584 break; 2585 2586 case 'mapbox': 2587 var coords = marker.getLngLat(); 2588 var p = new mapboxgl.Popup({ 2589 closeButton: false, 2590 }) 2591 .setMaxWidth("240px") 2592 .setLngLat([coords.lng, coords.lat]) 2593 .setHTML(popup); 2594 break; 2595 2596 } 2597 } 2598 } 2599 2600 return p; 2601 2602 }, 2603 2604 /* ----------------------------------------------------- */ 2605 /* POPUPWINDOW */ 2606 /* ----------------------------------------------------- */ 2607 popupWindow : function(item) { 2608 2609 // On vide la popup si elle etait visible 2610 $('#map_popup_container').empty(); 2611 2612 var titre, texte, image, lien, popup; 2613 2614 titre = item.titre; 2615 texte = item.texte; 2616 image = item.image; 2617 lien = item.lien; 2618 2619 // On recree la popup 2620 popup = '<div class="map_popup">'; 2621 popup += '<div class="map_popup_content">'; 2622 popup += '<div class="map_popup_close"><i class="icn icn-cross"></i></div>'; 2623 if ( lien != '' ) { popup += '<a href="' + lien + '">'; } 2624 if ( image != '' ) { popup += '<div class="map_popup_content_image"><img src="' + image.sizes.medium + '" /></div>'; } 2625 if ( titre != '' ) { popup += '<p class="map_popup_content_titre">' + titre + '</p>'; } 2626 if ( texte != '' ) { popup += '<p class="map_popup_content_texte">' + texte + '</p>'; } 2627 if ( lien != '' ) { popup += '</a>'; } 2628 popup += '</div>'; 2629 popup += '</div>'; 2630 2631 // Position du point 2632 var top = $('g#town-' + item.ville.value).position().top; 2633 var left = $('g#town-' + item.ville.value).position().left; 2634 2635 // Position du parent 2636 var ptop = $('#carteinteractive').position().top; 2637 var pleft = $('#carteinteractive').position().left; 2638 2639 $(popup).appendTo('#map_popup_container'); 2640 map.showPopup((top - ptop), (left - pleft)); 2641 2642 }, 2643 2644 showPopup : function(top, left) { 2645 $('#map_popup_container').css({'top': top, 'left': left}); 2646 $('#map_popup_container').addClass('open'); 2647 }, 2648 2649 hidePopup : function() { 2650 $('#map_popup_container').removeClass('open'); 2651 } 2652 2653 }; 2654 2655})(jQuery) 2656;(function ($) { 2657 2658 2659 menu = { 2660 2661 init : function() { 2662 2663 $(document) 2664 /* ----------------------------------------------------- */ 2665 /* OUVERTURE DES SOUS MENUS */ 2666 /* ----------------------------------------------------- */ 2667 .on('click', '.site__header__menu__item > a.has_children', function(event) { 2668 event.preventDefault(); 2669 /* Act on the event */ 2670 var id = $(this).parent().data('menu'); 2671 2672 if ( id && id != 0 ) { 2673 $('.site__header__menu').addClass('submenu-open'); 2674 $(this).parent().find('.site__header__submenu[data-menu="' + id + '"]').toggleClass('open'); 2675 $(this).parents('.site__header__menu').scrollTop(0).addClass('noscroll'); 2676 } 2677 }) 2678 2679 .on('click', '.site__header__submenu .back', function(event) { 2680 event.preventDefault(); 2681 /* Act on the event */ 2682 $(this).parents('.site__header__submenu').removeClass('open'); 2683 $(this).parents('.site__header__menu').removeClass('submenu-open').scrollTop(0).removeClass('noscroll'); 2684 }) 2685 2686 .on('click', '.site__header__submenu__item .has_children', function(event) { 2687 event.preventDefault(); 2688 /* Act on the event */ 2689 var id = $(this).parent().data('submenu-level2'); 2690 2691 if ( id && id != 0 ) { 2692 $(this).parent().find('.menu__mobile__submenu__level2[data-submenu-level2="' + id + '"]').toggleClass('open'); 2693 $(this).parents('.site__header__submenu').scrollTop(0).addClass('noscroll'); 2694 } 2695 }) 2696 2697 .on('click', '.site__header__submenu__level2 .back', function(event) { 2698 event.preventDefault(); 2699 /* Act on the event */ 2700 $(this).parents('.menu__mobile__submenu__level2').removeClass('open'); 2701 $(this).parents('.menu__mobile__submenu').scrollTop(0).removeClass('noscroll'); 2702 }) 2703 2704 .on('click', '.menu-close', function(event) { 2705 menu.close(); 2706 }) 2707 2708 /* Fermeture sur ESC */ 2709 /* ----------------------------------------------------- */ 2710 .on('keyup', function(e) { 2711 if ( e.which == 27 ) { 2712 // console.log(e.which); 2713 menu.close(); 2714 } 2715 }) 2716 ; 2717 }, 2718 2719 close : function() { 2720 $('body').removeClass('menu-open search-open big-menu-open'); 2721 $('html, body').scrollTop(0); 2722 $('.site__header__submenu').removeClass('open'); 2723 $('.site__header__menu').removeClass('submenu-open'); 2724 } 2725 }; 2726 2727 2728})(jQuery) 2729;(function ($) { 2730 2731 /* 2732 * 2733 * Mur social 2734 * 2735 */ 2736 parallax = { 2737 2738 init : function() { 2739 // init controller 2740 var controller = new ScrollMagic.Controller(); 2741 2742 /* Image Texte */ 2743 /* ----------------------------------------------------- */ 2744 if ( $('section.img_txt').length ) { 2745 $('section.img_txt').each(function() { 2746 2747 var tween = new TimelineMax().add([ 2748 TweenMax.from($(this).find('.section__title'), 1, {y: '-10%', autoAlpha: 0.5}), 2749 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-5%'}), 2750 TweenMax.from($(this).find('.img__container'), 1, {y: '20%', autoAlpha: 0.5}), 2751 ]); 2752 2753 var Sc = new ScrollMagic.Scene({ 2754 triggerElement: this, 2755 triggerHook: 1, 2756 duration: '200%', 2757 }) 2758 .setTween(tween) 2759 .addTo(controller) 2760 ; 2761 }); 2762 } 2763 2764 /* Texte Image */ 2765 /* ----------------------------------------------------- */ 2766 if ( $('section.txt_img').length ) { 2767 $('section.txt_img').each(function() { 2768 2769 var tween = new TimelineMax().add([ 2770 TweenMax.from($(this).find('.section__title'), 1, {y: '-10%', autoAlpha: 0.5}), 2771 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-5%'}), 2772 TweenMax.from($(this).find('.img__container'), 1, {y: '20%', autoAlpha: 0.5}), 2773 ]); 2774 2775 var Sc = new ScrollMagic.Scene({ 2776 triggerElement: this, 2777 triggerHook: 1, 2778 duration: '200%', 2779 }) 2780 .setTween(tween) 2781 .addTo(controller) 2782 ; 2783 }); 2784 } 2785 2786 /* Section avec un chien */ 2787 /* ----------------------------------------------------- */ 2788 if ( $('section.chien').length ) { 2789 $('section.chien').each(function() { 2790 2791 var tween = new TimelineMax().add([ 2792 TweenMax.from($(this).find('.chien'), 1, {y: '-20%'}) 2793 ]); 2794 2795 var Sc = new ScrollMagic.Scene({ 2796 triggerElement: this, 2797 triggerHook: 1, 2798 duration: '200%', 2799 }) 2800 .setTween(tween) 2801 .addTo(controller) 2802 ; 2803 }); 2804 } 2805 2806 /* Section avec un chat */ 2807 /* ----------------------------------------------------- */ 2808 if ( $('section.chat').length ) { 2809 $('section.chat').each(function() { 2810 2811 var tween = new TimelineMax().add([ 2812 TweenMax.from($(this).find('.chat'), 1, {y: '-20%'}) 2813 ]); 2814 2815 var Sc = new ScrollMagic.Scene({ 2816 triggerElement: this, 2817 triggerHook: 1, 2818 duration: '200%', 2819 }) 2820 .setTween(tween) 2821 .addTo(controller) 2822 ; 2823 }); 2824 } 2825 2826 /* Section avec une machine */ 2827 /* ----------------------------------------------------- */ 2828 if ( $('section.machine').length ) { 2829 $('section.machine').each(function() { 2830 2831 var tween = new TimelineMax().add([ 2832 TweenMax.from($(this).find('.machine'), 1, {y: '0%'}) 2833 ]); 2834 2835 var Sc = new ScrollMagic.Scene({ 2836 triggerElement: this, 2837 triggerHook: 1, 2838 duration: '200%', 2839 }) 2840 .setTween(tween) 2841 .addTo(controller) 2842 ; 2843 }); 2844 } 2845 2846 /* Section Equipe */ 2847 /* ----------------------------------------------------- */ 2848 if ( $('section.equipe').length ) { 2849 $('section.equipe').each(function() { 2850 2851 var tween = new TimelineMax().add([ 2852 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 2853 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 2854 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 2855 TweenMax.from($(this).find('.equipe__person'), 1, {y: '20%', autoAlpha: 0.5}), 2856 ]); 2857 2858 var Sc = new ScrollMagic.Scene({ 2859 triggerElement: this, 2860 triggerHook: 1, 2861 duration: '200%', 2862 }) 2863 .setTween(tween) 2864 .addTo(controller) 2865 ; 2866 }); 2867 } 2868 2869 /* Section services */ 2870 /* ----------------------------------------------------- */ 2871 if ( $('section.services').length ) { 2872 $('section.services').each(function() { 2873 2874 var tween = new TimelineMax().add([ 2875 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 2876 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 2877 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 2878 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 2879 TweenMax.from($(this).find('.services__links'), 1, {y: '15%', autoAlpha: 0.5}), 2880 TweenMax.from($(this).find('.services__text'), 1, {y: '25%', autoAlpha: 0.5}), 2881 ]); 2882 2883 var Sc = new ScrollMagic.Scene({ 2884 triggerElement: this, 2885 triggerHook: 1, 2886 duration: '200%', 2887 }) 2888 .setTween(tween) 2889 .addTo(controller) 2890 ; 2891 }); 2892 } 2893 2894 /* Section quote */ 2895 /* ----------------------------------------------------- */ 2896 if ( $('section.quote').length ) { 2897 $('section.quote').each(function() { 2898 2899 var tween = new TimelineMax().add([ 2900 TweenMax.from($(this).find('.quote__logo'), 1, {y: '-50%'}), 2901 TweenMax.from($(this).find('.quote__text'), 1, {y: '55%', autoAlpha: 0.5}), 2902 ]); 2903 2904 var Sc = new ScrollMagic.Scene({ 2905 triggerElement: this, 2906 triggerHook: 1, 2907 duration: '200%', 2908 }) 2909 .setTween(tween) 2910 .addTo(controller) 2911 ; 2912 }); 2913 } 2914 2915 /* Section formations */ 2916 /* ----------------------------------------------------- */ 2917 if ( $('section.formations').length ) { 2918 $('section.formations').each(function() { 2919 2920 var tween = new TimelineMax().add([ 2921 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-40%'}), 2922 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 2923 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 2924 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 2925 TweenMax.from($(this).find('.section__link'), 1, {y: '15%', autoAlpha: 0.5}), 2926 TweenMax.from($(this).find('.img__container'), 1, {y: '25%', autoAlpha: 0.5}), 2927 ]); 2928 2929 var Sc = new ScrollMagic.Scene({ 2930 triggerElement: this, 2931 triggerHook: 1, 2932 duration: '200%', 2933 }) 2934 .setTween(tween) 2935 .addTo(controller) 2936 ; 2937 }); 2938 } 2939 2940 /* Section news homeslider */ 2941 /* ----------------------------------------------------- */ 2942 if ( $('section.news.homeslider').length ) { 2943 $('section.news.homeslider').each(function() { 2944 2945 var tween = new TimelineMax().add([ 2946 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-40%'}), 2947 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 2948 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 2949 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 2950 TweenMax.from($(this).find('.section__link'), 1, {y: '15%', autoAlpha: 0.5}), 2951 TweenMax.from($(this).find('.homeslider__container'), 1, {autoAlpha: 0.0}), 2952 ]); 2953 2954 var Sc = new ScrollMagic.Scene({ 2955 triggerElement: this, 2956 triggerHook: 1, 2957 duration: '200%', 2958 }) 2959 .setTween(tween) 2960 .addTo(controller) 2961 ; 2962 }); 2963 } 2964 2965 /* Section pratiques */ 2966 /* ----------------------------------------------------- */ 2967 if ( $('section.pratiques').length ) { 2968 $('section.pratiques').each(function() { 2969 2970 var tween = new TimelineMax().add([ 2971 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 2972 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 2973 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 2974 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 2975 TweenMax.from($(this).find('.pratiques__links'), 1, {y: '25%', autoAlpha: 0.5}), 2976 TweenMax.from($(this).find('.pratiques__image'), 1, {y: '15%', autoAlpha: 0.5}), 2977 TweenMax.from($(this).find('.pratiques__text'), 1, {y: '25%', autoAlpha: 0.5}), 2978 ]); 2979 2980 var Sc = new ScrollMagic.Scene({ 2981 triggerElement: this, 2982 triggerHook: 1, 2983 duration: '200%', 2984 }) 2985 .setTween(tween) 2986 .addTo(controller) 2987 ; 2988 }); 2989 } 2990 2991 /* Section contact */ 2992 /* ----------------------------------------------------- */ 2993 if ( $('section.contact').length ) { 2994 $('section.contact').each(function() { 2995 2996 var tween = new TimelineMax().add([ 2997 TweenMax.from($(this).find('.chat'), 1, {y: '-20%'}), 2998 2999 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3000 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 3001 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3002 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 3003 3004 TweenMax.from($(this).find('.contact__quote'), 1, {y: '15%', autoAlpha: 0.5}), 3005 TweenMax.from($(this).find('.contact__coords'), 1, {y: '25%', autoAlpha: 0.5}), 3006 TweenMax.from($(this).find('.contact__form'), 1, {y: '25%', autoAlpha: 0.5}), 3007 ]); 3008 3009 var Sc = new ScrollMagic.Scene({ 3010 triggerElement: this, 3011 triggerHook: 1, 3012 duration: '200%', 3013 }) 3014 .setTween(tween) 3015 .addTo(controller) 3016 ; 3017 }); 3018 } 3019 3020 /* Section page__top */ 3021 /* ----------------------------------------------------- */ 3022 if ( $('section.page__top').length ) { 3023 $('section.page__top').each(function() { 3024 3025 var tween = new TimelineMax().add([ 3026 TweenMax.from($(this).find('.chat'), 1, {y: '-20%'}), 3027 3028 TweenMax.from($(this).find('.page__title'), 1, {y: '-10%'}), 3029 TweenMax.from($(this).find('.page__thumbnail'), 1, {transform: 'scale(0.8)', autoAlpha: 0.5}), 3030 ]); 3031 3032 var Sc = new ScrollMagic.Scene({ 3033 triggerElement: this, 3034 triggerHook: 1, 3035 duration: '200%', 3036 }) 3037 .setTween(tween) 3038 .addTo(controller) 3039 ; 3040 }); 3041 } 3042 3043 /* Section title_img_txt_img */ 3044 /* ----------------------------------------------------- */ 3045 if ( $('section.title_img_txt_img').length ) { 3046 $('section.title_img_txt_img').each(function() { 3047 3048 var tween = new TimelineMax().add([ 3049 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3050 TweenMax.from($(this).find('.section__title'), 1, {y: '-25%', autoAlpha: 0.5}), 3051 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3052 TweenMax.from($(this).find('.item3'), 1, {y: '20%', autoAlpha: 0.5}), 3053 TweenMax.from($(this).find('.item4'), 1, {y: '20%', autoAlpha: 0.5}), 3054 TweenMax.from($(this).find('.section__text'), 1, {y: '20%', autoAlpha: 0.5}), 3055 ]); 3056 3057 var Sc = new ScrollMagic.Scene({ 3058 triggerElement: this, 3059 triggerHook: 1, 3060 duration: '200%', 3061 }) 3062 .setTween(tween) 3063 .addTo(controller) 3064 ; 3065 }); 3066 } 3067 3068 /* Section title_video_text_text */ 3069 /* -----------------------
3069------------------------------ */ 3070 if ( $('section.title_video_text_text').length ) { 3071 $('section.title_video_text_text').each(function() { 3072 3073 var tween = new TimelineMax().add([ 3074 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3075 TweenMax.from($(this).find('.section__title'), 1, {y: '-25%', autoAlpha: 0.5}), 3076 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3077 TweenMax.from($(this).find('.section__text'), 1, {y: '20%', autoAlpha: 0.5}), 3078 TweenMax.from($(this).find('.video'), 1, {transform: 'scale(0.8)', autoAlpha: 0.5}), 3079 TweenMax.from($(this).find('.row-text'), 1, {y: '20%', autoAlpha: 0.5}), 3080 ]); 3081 3082 var Sc = new ScrollMagic.Scene({ 3083 triggerElement: this, 3084 triggerHook: 1, 3085 duration: '200%', 3086 }) 3087 .setTween(tween) 3088 .addTo(controller) 3089 ; 3090 }); 3091 } 3092 3093 /* Section title_img_quote */ 3094 /* ----------------------------------------------------- */ 3095 if ( $('section.title_img_quote').length ) { 3096 $('section.title_img_quote').each(function() { 3097 3098 var tween = new TimelineMax().add([ 3099 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3100 TweenMax.from($(this).find('.section__title'), 1, {y: '-25%', autoAlpha: 0.5}), 3101 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3102 TweenMax.from($(this).find('.section__text'), 1, {y: '20%', autoAlpha: 0.5}), 3103 TweenMax.from($(this).find('.img1'), 1, {y: '20%', autoAlpha: 0.5}), 3104 TweenMax.from($(this).find('.img2'), 1, {y: '35%', autoAlpha: 0.5}), 3105 TweenMax.from($(this).find('.img3'), 1, {y: '50%', autoAlpha: 0.5}), 3106 TweenMax.from($(this).find('.quote'), 1, {y: '30%', autoAlpha: 0.5}), 3107 ]); 3108 3109 var Sc = new ScrollMagic.Scene({ 3110 triggerElement: this, 3111 triggerHook: 'onEnter', 3112 duration: '200%', 3113 }) 3114 .setTween(tween) 3115 .addTo(controller) 3116 ; 3117 }); 3118 } 3119 3120 /* Section simple_img_txt */ 3121 /* ----------------------------------------------------- */ 3122 if ( $('section.simple_img_txt').length ) { 3123 $('section.simple_img_txt').each(function() { 3124 3125 var tween = new TimelineMax().add([ 3126 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3127 TweenMax.from($(this).find('.section__title'), 1, {y: '-25%', autoAlpha: 0.5}), 3128 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3129 TweenMax.from($(this).find('.section__text'), 1, {y: '20%', autoAlpha: 0.5}), 3130 TweenMax.from($(this).find('img'), 1, {y: '20%', autoAlpha: 0.5}), 3131 ]); 3132 3133 var Sc = new ScrollMagic.Scene({ 3134 triggerElement: this, 3135 triggerHook: 'onEnter', 3136 duration: '200%', 3137 }) 3138 .setTween(tween) 3139 .addTo(controller) 3140 ; 3141 }); 3142 } 3143 3144 /* Section double_img_txt */ 3145 /* ----------------------------------------------------- */ 3146 if ( $('section.double_img_txt').length ) { 3147 $('section.double_img_txt').each(function() { 3148 3149 var tween = new TimelineMax().add([ 3150 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3151 TweenMax.from($(this).find('.section__title'), 1, {y: '-25%', autoAlpha: 0.5}), 3152 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3153 TweenMax.from($(this).find('.section__text'), 1, {y: '20%', autoAlpha: 0.5}), 3154 TweenMax.from($(this).find('img'), 1, {y: '20%', autoAlpha: 0.5}), 3155 ]); 3156 3157 var Sc = new ScrollMagic.Scene({ 3158 triggerElement: this, 3159 triggerHook: 'onEnter', 3160 duration: '200%', 3161 }) 3162 .setTween(tween) 3163 .addTo(controller) 3164 ; 3165 }); 3166 } 3167 3168 /* Section services2 */ 3169 /* ----------------------------------------------------- */ 3170 if ( $('section.services2').length ) { 3171 $('section.services2').each(function() { 3172 3173 var tween = new TimelineMax().add([ 3174 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3175 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 3176 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3177 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 3178 TweenMax.from($(this).find('.services__links'), 1, {y: '15%', autoAlpha: 0.5}), 3179 TweenMax.from($(this).find('.services__text'), 1, {y: '25%', autoAlpha: 0.5}), 3180 ]); 3181 3182 var Sc = new ScrollMagic.Scene({ 3183 triggerElement: this, 3184 triggerHook: 1, 3185 duration: '200%', 3186 }) 3187 .setTween(tween) 3188 .addTo(controller) 3189 ; 3190 }); 3191 } 3192 3193 /* Section colonnes_flexibles */ 3194 /* ----------------------------------------------------- */ 3195 if ( $('section.colonnes_flexibles').length ) { 3196 $('section.colonnes_flexibles').each(function() { 3197 3198 var tween = new TimelineMax().add([ 3199 TweenMax.from($(this).find('.section__baseline'), 1, {y: '-10%'}), 3200 TweenMax.from($(this).find('.section__title'), 1, {y: '-15%', autoAlpha: 0.5}), 3201 TweenMax.from($(this).find('.section__subtitle'), 1, {y: '-10%'}), 3202 TweenMax.from($(this).find('.section__quote'), 1, {y: '20%', autoAlpha: 0.5}), 3203 TweenMax.from($(this).find('.section__link'), 1, {y: '15%', autoAlpha: 0.5}), 3204 TweenMax.from($(this).find('.img'), 1, {y: '-25%', autoAlpha: 0.5}), 3205 ]); 3206 3207 var Sc = new ScrollMagic.Scene({ 3208 triggerElement: this, 3209 triggerHook: 1, 3210 duration: '200%', 3211 }) 3212 .setTween(tween) 3213 .addTo(controller) 3214 ; 3215 }); 3216 } 3217 3218 } 3219 }; 3220 3221})(jQuery) 3222;(function ($) { 3223 3224 /* 3225 * 3226 * Popups 3227 * 3228 */ 3229 popup = { 3230 3231 container : '', 3232 3233 /* ----------------------------------------------------- */ 3234 /* Initialisation */ 3235 /* ----------------------------------------------------- */ 3236 init : function() { 3237 3238 popup.events(); 3239 3240 }, 3241 3242 /* ----------------------------------------------------- */ 3243 /* Events */ 3244 /* ----------------------------------------------------- */ 3245 events : function() { 3246 $(document) 3247 3248 /* Ouverture */ 3249 /* ----------------------------------------------------- */ 3250 .on('click', '.btn-open-popup', function(e) { 3251 3252 e.preventDefault(); 3253 3254 var popup_container = $(this).data('popup'); 3255 3256 /* Ouverture */ 3257 /* ----------------------------------------------------- */ 3258 popup.open(popup_container); 3259 3260 }) 3261 3262 /* Fermeture */ 3263 /* ----------------------------------------------------- */ 3264 .on('click', '.btn-close-popup', function(e) { 3265 var popup_container = $(this).data('popup'); 3266 popup.close(popup_container); 3267 }) 3268 3269 /* Fermeture sur ESC */ 3270 /* ----------------------------------------------------- */ 3271 .on('keyup', function(e) { 3272 if ( e.which == 27 && $('body').hasClass('popup-open')) { 3273 popup.close(); 3274 } 3275 }) 3276 3277 ; 3278 }, 3279 3280 /* ----------------------------------------------------- */ 3281 /* Ouverture */ 3282 /* ----------------------------------------------------- */ 3283 open : function(container) { 3284 $('body').addClass('popup-open'); 3285 $(container).addClass('open'); 3286 }, 3287 3288 /* ----------------------------------------------------- */ 3289 /* Fermeture */ 3290 /* ----------------------------------------------------- */ 3291 close : function(container = false) { 3292 $('body').removeClass('popup-open'); 3293 $('.popup').removeClass('open'); 3294 3295 if ( container ) { 3296 $(container).removeClass('open'); 3297 } 3298 }, 3299 3300 /* ----------------------------------------------------- */ 3301 /* Remplacement du contenu */ 3302 /* ----------------------------------------------------- */ 3303 replaceContent : function(container, content) { 3304 $(container + "__content").empty(); 3305 $(container + "__content").html(content); 3306 } 3307 3308 }; 3309 3310 jQuery(document).ready(function($) { 3311 if ( $('.popup').hasClass('openOnReady') ) { 3312 popup.open('.popup'); 3313 } 3314 }); 3315 3316})(jQuery) 3317;(function ($) { 3318 3319 /* 3320 * 3321 * Popup Profile 3322 * 3323 */ 3324 profile = { 3325 3326 currentStep : 1, 3327 container : '.fflutte__newsletter', 3328 3329 init : function() { 3330 3331 if ( !profile.checkCookie(profile.container)) { 3332 profile.open(); 3333 profile.addCookie(profile.container, "1", 365); 3334 } 3335 3336 profile.currentstep = $(profile.container + ' .step-counter').val(); 3337 3338 $(document) 3339 .on('click', profile.container + '_close', function(e) { 3340 profile.close(); 3341 }) 3342 .on('click', '.prev-step', function(e) { 3343 e.preventDefault(); 3344 profile.prev(e); 3345 }) 3346 .on('click', '.next-step', function(e) { 3347 e.preventDefault(); 3348 profile.next(e); 3349 }) 3350 .on('click', '.popup__profile_disagree', function(e) { 3351 e.preventDefault(); 3352 profile.close(); 3353 }) 3354 ; 3355 3356 profile.update(1); 3357 }, 3358 3359 /* 3360 * Ouverture de la pop 3361 */ 3362 open : function() { 3363 $(profile.container).css('display', 'block'); 3364 3365 setTimeout(function() { 3366 $(profile.container).removeClass('close'); 3367 }, 100); 3368 }, 3369 3370 /* 3371 * Fermeture de la pop 3372 */ 3373 close : function() { 3374 $(profile.container).addClass('close'); 3375 3376 setTimeout(function() { 3377 $(profile.container).css('display', 'none'); 3378 }, 1000); 3379 }, 3380 3381 /* 3382 * Etape precedente 3383 */ 3384 prev : function(e) { 3385 var nb; 3386 3387 $(profile.container + ' .step').each(function(i,el) { 3388 var step = $(el).data('step'); 3389 3390 if ( step == profile.currentStep ) { 3391 profile.hide($(el)); 3392 } else if ( step == profile.currentStep - 1 )Â { 3393 profile.show($(el)); 3394 nb = step; 3395 } 3396 }); 3397 3398 profile.update(nb); 3399 3400 }, 3401 3402 /* 3403 * Etape suivante 3404 */ 3405 next : function(e) { 3406 var nb; 3407 3408 $(profile.container + ' .step').each(function(i,el) { 3409 var step = $(el).data('step'); 3410 3411 if ( step == profile.currentStep ) { 3412 profile.hide($(el)); 3413 } else if ( step == profile.currentStep + 1 )Â { 3414 profile.show($(el)); 3415 nb = step; 3416 } 3417 }); 3418 3419 profile.update(nb); 3420 }, 3421 3422 /* 3423 * Cache la section 3424 */ 3425 hide : function( obj ) { 3426 obj.removeClass('revealed').addClass('hidden'); 3427 setTimeout(function() { obj.css('display', 'none'), 800 }); 3428 }, 3429 3430 /* 3431 * Montre la section 3432 */ 3433 show : function( obj ) { 3434 obj.css('display', 'block'); 3435 setTimeout(function() { obj.removeClass('hidden').addClass('revealed') , 100 }); 3436 }, 3437 3438 /* 3439 * Met a jour les steps 3440 */ 3441 update : function( nb ) { 3442 3443 profile.currentStep = nb; 3444 $(profile.container + ' .step-counter').val(nb); 3445 if ( nb == 1 ) { $('.prev-step').addClass('hidden'); } else { $('.prev-step').removeClass('hidden'); } 3446 if ( nb == $('.step').length ) { $('.next-step').addClass('hidden'); } else { $('.next-step').removeClass('hidden'); } 3447 3448 }, 3449 3450 /* 3451 * 3452 */ 3453 addCookie : function(cname, cvalue, cexpires) { 3454 3455 var d = new Date(); 3456 d.setTime(d.getTime() + (cexpires*24*60*60*1000)); 3457 var expires = "expires="+ d.toUTCString(); 3458 3459 document.cookie = cname + "=" + cvalue + "; expires=" + cexpires; 3460 3461 }, 3462 3463 /* 3464 * 3465 */ 3466 checkCookie : function(cname) { 3467 var name = cname + "="; 3468 var decodedCookie = decodeURIComponent(document.cookie); 3469 var ca = decodedCookie.split(';'); 3470 for(var i = 0; i <ca.length; i++) { 3471 var c = ca[i];
3472 while (c.charAt(0) == ' ') { 3473 c = c.substring(1); 3474 } 3475 if (c.indexOf(name) == 0) { 3476 return c.substring(name.length, c.length); 3477 } 3478 } 3479 return ""; 3480 }, 3481 3482 }; 3483 3484})(jQuery) 3485// JavaScript Document 3486;(function ($) { 3487 3488 /* 3489 * 3490 * Resultats 3491 * 3492 */ 3493 resultats = { 3494 3495 init : function() { 3496 this.events(); 3497 }, 3498 3499 events : function() { 3500 3501 $(document) 3502 3503 /* ----------------------------------------------------- */ 3504 /* Accordeon classements */ 3505 /* ----------------------------------------------------- */ 3506 .on('click', '.resultat__epreuves__item', function(e) { 3507 e.preventDefault(); 3508 3509 var classements = $(this).find('.resultat__classements') 3510 3511 $('.resultat__epreuves__item').not($(this)).removeClass('open'); 3512 $('.resultat__classements').not(classements).slideUp(400); 3513 3514 classements.slideToggle(200); 3515 $(this).toggleClass('open'); 3516 }) 3517 3518 /* Resultats : que les membres */ 3519 .on('click', '.only-members', function(e) { 3520 e.preventDefault(); 3521 3522 $(this).toggleClass('active'); 3523 3524 if ( $('.print').length ) { 3525 $('.print').toggle(); 3526 } 3527 3528 // SI ON ACTIVE 3529 if ( $(this).hasClass('active') ) { 3530 3531 // Boucle sur les epreuves 3532 $('.resultat__epreuves__item').each(function(i,e) { 3533 3534 var epreuve = $(e); 3535 var flag = false; 3536 3537 // Boucle sur les classements 3538 epreuve.find('.resultat__classements__classement').each(function(i,el) { 3539 if ( $(el).hasClass('licencie') ) { 3540 flag = true; 3541 $(el).removeClass('hidden'); 3542 } else { 3543 $(el).addClass('hidden'); 3544 } 3545 }); 3546 3547 if ( flag ) { 3548 epreuve.addClass('open').removeClass('hidden'); 3549 $(this).find('.resultat__classements').slideDown(400); 3550 } else { 3551 epreuve.removeClass('open').addClass('hidden'); 3552 $(this).find('.resultat__classements').slideUp(400); 3553 } 3554 3555 }) 3556 } 3557 else { 3558 // SI ON DESACTIVE { 3559 $('.resultat__epreuves__item').removeClass('hidden open'); 3560 $('.resultat__classements__classement').removeClass('hidden'); 3561 $('.resultat__classements').slideUp(400); 3562 } 3563 }) 3564 3565 /* Home : filtrer les resultats par categorie */ 3566 .on('change', '.select_result_category', function(e) { 3567 3568 var cat = $(this).val(); 3569 3570 $.ajax({
3571 'url' : base_url + 'resultat/change_categorie', 3572 'type' : 'GET', 3573 'data' : 'category=' + cat, 3574 'success' : function( response ) { 3575 3576 $('.resultats__list__ajax').empty().html(response); 3577 3578 }, 3579 'error' : function(request,error) 3580 { 3581 alert('une erreur est survenue'); 3582 } 3583 }); 3584 3585 }) 3586 ; 3587 3588 } 3589 3590 } 3591 3592})(jQuery) 3593 3594 3595;(function ($) { 3596 3597 /* 3598 * Carousels 3599 */ 3600 sliders = { 3601 3602 init : function() { 3603 this.mainSliders(); 3604 }, 3605 3606 mainSliders : function() { 3607 3608 /* Slider principal */ 3609 /* ----------------------------------------------------- */ 3610 $('.slider .slider__container').on('init', function(event, slick) { 3611 $('.slider .slider__container .slick-current').removeClass('slick-active').addClass('noanim'); 3612 3613 setTimeout(function() { 3614 $('.slider .slider__container .slick-current').removeClass('noanim').addClass('slick-active'); 3615 }, 600); 3616 }); 3617 3618 $('.slider .slider__container').not('.slick-initialized').slick({ 3619 infinite: true, 3620 speed: 1400, 3621 cssEase: 'ease-in-out', 3622 mobileFirst: true, 3623 slidesToShow: 1, 3624 slidesToScroll: 1, 3625 dots: true, 3626 arrows: false, 3627 autoplay: false, 3628 autoplaySpeed: 1400, 3629 responsive: [ 3630 { 3631 breakpoint: 767, 3632 settings: { 3633 slidesToShow: 2 3634 } 3635 }, 3636 { 3637 breakpoint: 1200, 3638 settings: { 3639 slidesToShow: 3 3640 } 3641 } 3642 ] 3643 }); 3644 3645 /* Slider news en home */ 3646 /* ----------------------------------------------------- */ 3647 $('.news__bigslider').on('init', function(event, slick) { 3648 $('.news__bigslider .slick-current').removeClass('slick-active').addClass('noanim'); 3649 3650 setTimeout(function() { 3651 $('.news__bigslider .slick-current').removeClass('noanim').addClass('slick-active'); 3652 }, 400); 3653 }); 3654 3655 $('.news__bigslider').not('.slick-initialized').slick({ 3656 infinite: true, 3657 speed: 1200, 3658 fade: true, 3659 cssEase: 'ease-in-out', 3660 mobileFirst: true, 3661 slidesToShow: 1, 3662 slidesToScroll: 1, 3663 centerMode: false, 3664 dots: true, 3665 appendDots: $('.news__bigslider__dots'), 3666 // customPaging:function(e,t){ return t + 1;}, 3667 arrows: false, 3668 autoplay: true, 3669 autoplaySpeed: 2000, 3670 spaceBetween: 5, 3671 prevArrow: '<a class="slick-arrow slick-prev"><i class="icn icn-long-arrow-left"></i></a>', 3672 nextArrow: '<a class="slick-arrow slick-next"><i class="icn icn-long-arrow-right"></i></i></a>', 3673 appendArrows: '.news__bigslider__arrows', 3674 centerPadding: 0, 3675 responsive: [ 3676 { 3677 breakpoint: 768, 3678 settings : { 3679 dots: true, 3680 arrows: true 3681 } 3682 }, 3683 { 3684 breakpoint: 1199, 3685 settings : { 3686 dots: true, 3687 arrows: true 3688 } 3689 } 3690 ] 3691 }); 3692 3693 /* Slider acteurs en home */ 3694 /* ----------------------------------------------------- */ 3695 $('.acteurs__slider').not('.slick-initialized').slick({ 3696 infinite: true, 3697 speed: 1400, 3698 fade: false, 3699 cssEase: 'cubic-bezier(0.12, 0.9, 0.79, 1)', 3700 mobileFirst: true, 3701 slidesToShow: 1, 3702 slidesToScroll: 1, 3703 dots: true, 3704 arrows: false, 3705 autoplay: true, 3706 autoplaySpeed: 2000, 3707 responsive: [ 3708 { 3709 breakpoint: 767, 3710 settings: { 3711 slidesToShow: 2 3712 } 3713 } 3714 ] 3715 }); 3716 3717 $('.acteurs__categorie__slider').not('.slick-initialized').each( function(i, e) { 3718 $(e).slick({ 3719 infinite: true, 3720 speed: 1400, 3721 fade: true, 3722 cssEase: 'cubic-bezier(0.12, 0.9, 0.79, 1)', 3723 mobileFirst: true, 3724 slidesToShow: 1, 3725 slidesToScroll: 1, 3726 dots: false, 3727 arrows: true, 3728 appendArrows: $(e).parents('.acteurs__categorie__inner').find('.acteurs__categorie__slider__arrows'), 3729 prevArrow: '<a class="slick-arrow slick-prev"><i class="icn icn-long-arrow-left"></i></a>', 3730 nextArrow: '<a class="slick-arrow slick-next"><i class="icn icn-long-arrow-right"></i></i></a>', 3731 autoplay: false, 3732 autoplaySpeed: 1200, 3733 }); 3734 }); 3735 3736 /* Slider des partenaires dans le footer */ 3737 /* ----------------------------------------------------- */ 3738 $('.site__footer__partenaires__slider').not('.slick-initialized').slick({ 3739 infinite: true, 3740 speed: 1400, 3741 fade: false, 3742 cssEase: 'cubic-bezier(0.12, 0.9, 0.79, 1)', 3743 mobileFirst: true, 3744 slidesToShow: 2, 3745 slidesToScroll: 1, 3746 centerMode: false, 3747 dots: false,
3748 arrows: false, 3749 autoplay: true, 3750 autoplaySpeed: 2600, 3751 prevArrow: '', 3752 nextArrow: '', 3753 responsive: [ 3754 { 3755 breakpoint: 575, 3756 settings: { 3757 slidesToShow: 3 3758 } 3759 }, 3760 { 3761 breakpoint: 767, 3762 settings: { 3763 slidesToShow: 6 3764 } 3765 }, 3766 { 3767 breakpoint: 1200, 3768 settings: { 3769 slidesToShow: 8 3770 } 3771 }, 3772 { 3773 breakpoint: 1380, 3774 settings: { 3775 slidesToShow: 8 3776 } 3777 } 3778 ] 3779 }); 3780 3781 /* SLIDER GALLERY EN HOME */ 3782 /* ----------------------------------------------------- */ 3783 $('.gallery__album__slider').not('.slick-initialized').slick({ 3784 infinite: true, 3785 speed: 1400, 3786 cssEase: 'cubic-bezier(0.12, 0.9, 0.79, 1)', 3787 mobileFirst: true, 3788 slidesToShow: 1, 3789 slidesToScroll: 1, 3790 centerMode: true, 3791 dots: true, 3792 arrows: false, 3793 autoplay: true, 3794 autoplaySpeed: 2600, 3795 responsive: [ 3796 { 3797 breakpoint: 991, 3798 settings: { 3799 slidesToShow: 2 3800 } 3801 } 3802 ] 3803 }); 3804 3805 } 3806 } 3807 3808 3809})(jQuery) 3810;(function ($) { 3811 3812 /* 3813 * 3814 * Mur social 3815 * 3816 */ 3817 socialwall = { 3818 3819 init : function() { 3820 3821 $(document) 3822 .on('click', '.social_wall .tabs .tab', function(e) { 3823 var plateforme = $(this).data('platform'); 3824 $('.social_wall .tabs .tab').removeClass('active'); 3825 $(this).addClass('active'); 3826 $('.socialwall-list').removeClass('active'); 3827 $('.socialwall-list.' + plateforme).addClass('active'); 3828 // console.log($('.socialwall-list.' + plateforme)); 3829 sliders.init(); 3830 }) 3831 ; 3832 } 3833 3834 }; 3835 3836})(jQuery) 3837;(function ($) { 3838 3839 /* 3840 * 3841 * Elements d'UI 3842 * 3843 * Gere les fleches, le scroll, le menu mobile... 3844 */ 3845 ui = { 3846 3847 lastScrollTop : 0, 3848 3849 // A partir de quand on declenche les evenements 3850 delta : 0, 3851 3852 init : function() { 3853 3854 if ( $('.site__header').length ) { 3855 // ui.delta = $('.site__header').offset().top; 3856 ui.delta = $('.site__header').innerHeight(); 3857 } 3858 3859 $('.must_stick').each(function(index, el) { 3860 $(el).attr('data-offset', $(el).offset().top); 3861 }); 3862 3863 $(document) 3864 3865 /* ----------------------------------------------------- */ 3866 /* CLICK SUR LES ANCRES */ 3867 /* ----------------------------------------------------- */ 3868 .on('click', 'a[href^="#"]', function(e) { 3869 if ( $($(this).attr('href')).length ) { 3870 $('html,body').animate({ 3871 'scrollTop': $($(this).attr('href')).offset().top - $('header').innerHeight() }, 3872 500 3873 ); 3874 } 3875 }) 3876 3877 /* ----------------------------------------------------- */ 3878 /* MENUS */ 3879 /* ----------------------------------------------------- */ 3880 3881 /* Ouverture */ 3882 /* ----------------------------------------------------- */ 3883 .on('click', '.site__header__menu__btn', function(e) { 3884 e.preventDefault(); 3885 3886 var btn = $(this); 3887 3888 if (btn.hasClass('open')) { 3889 $('body').removeClass('menu-open'); 3890 $('.site__header__menu').removeClass('visible open'); 3891 3892 setTimeout(function() { 3893 btn.removeClass('animate'); 3894 btn.removeClass('open'); 3895 }, 200); 3896 } else { 3897 btn.addClass('animate'); 3898 3899 setTimeout(function() { 3900 $('body').addClass('menu-open'); 3901 btn.addClass('open'); 3902 }, 200); 3903 } 3904 3905 }) 3906 3907 /* Fermeture */ 3908 /* ----------------------------------------------------- */ 3909 .on('click', '.menu-close', function(e) { 3910 var btn = $('.site__header__menu__btn'); 3911 3912 $('body').removeClass('menu-open'); 3913 3914 btn.removeClass('open'); 3915 3916 setTimeout(function() { 3917 btn.removeClass('animate'); 3918 $('.main-nav').toggleClass('open'); 3919 }, 300); 3920 }) 3921 3922 /* ----------------------------------------------------- */ 3923 /* SCROLL TO SECTION */ 3924 /* ----------------------------------------------------- */ 3925 .on('click', '.scroll-to-section', function(event) { 3926 var secondSection = $('section:nth-child(2)'); 3927 if(secondSection.length) { 3928 if ( $(window).innerWidth() >= 768) { 3929 $('html,body').animate({ 3930 'scrollTop': secondSection.offset().top }, 3931 500 3932 ); 3933 } 3934 else { 3935 $('html,body').animate({ 3936 'scrollTop': secondSection.offset().top - $('header').innerHeight() }, 3937 500 3938 ); 3939 } 3940 } 3941 }) 3942 3943 /* ----------------------------------------------------- */ 3944 /* SCROLL TO TOP */ 3945 /* ----------------------------------------------------- */ 3946 .on('click', '.scroll-to-top', function(event) { 3947 $('html,body').animate({ 3948 'scrollTop': 0}, 3949 500 3950 ); 3951 }) 3952 3953 /* ----------------------------------------------------- */ 3954 /* CLICK SUR LE LOGO DU FOOTER */ 3955 /* ----------------------------------------------------- */ 3956 .on('click', '.footer-logo > img', function(event) { 3957 $('html,body').animate({ 3958 'scrollTop': 0}, 3959 500 3960 ); 3961 }) 3962 3963 3964 /* ----------------------------------------------------- */ 3965 /* RECHERCHE */ 3966 /* ----------------------------------------------------- */ 3967 .on('click', '.open-search', function(event) { 3968 event.preventDefault(); 3969 $(this).toggleClass('active'); 3970 3971 var searchFormContainer = $('.' + $(this).data('container')); 3972 3973 ui.searchOpen( searchFormContainer ); 3974 3975 }) 3976 .on('click', '.close-search', function(event) { 3977 event.preventDefault(); 3978 3979 // var searchFormContainer = $(this).siblings('.search-form__container'); 3980 var searchFormContainer = $('.' + $(this).data('container')); 3981 ui.searchClose( searchFormContainer ); 3982 }) 3983 /* (ferme la recherche sur ESC) */ 3984 .on('keyup', function(e) { 3985 // console.log(e.which); 3986 if ( e.which == 27 && $('body').hasClass('search-open')) { 3987 $('body').removeClass('search-open'); 3988 $('.search-form__container').removeClass('open'); 3989 } 3990 }) 3991 3992 /* ----------------------------------------------------- */ 3993 /* MENU A PLUSIEURS NIVEAUX */ 3994 /* ----------------------------------------------------- */ 3995 .on('click', '.menu-item-has-children > a', function(e) { 3996 3997 e.preventDefault(); 3998 3999 $('html, body').scrollTop(0); 4000 4001 $('body').addClass('big-menu-open'); 4002 4003 if ( $(this).siblings('.sub-menu').length ) { 4004 var menu = $(this).siblings('.sub-menu'), 4005 depth = menu.data('depth'); 4006 4007 if ( depth == 0 ) { 4008 // $('body').toggleClass('menu-open'); 4009 $('.main-nav .nav > .menu-item').removeClass('active'); 4010 $(this).addClass('active'); 4011 } 4012 4013 $('.sub-menu[data-depth="'+depth+'"]').removeClass('open'); 4014 4015 $(this).siblings('.sub-menu').toggleClass('open'); 4016 } 4017 4018 }) 4019 4020 /* Retour en arriere dans le menu mobile */ 4021 /* ----------------------------------------------------- */ 4022 .on('click', '.menu-back', function(e) { 4023 4024 e.preventDefault(); 4025 4026 // $('.sub-menu').removeClass('open'); 4027 var depth = $(this).data('depth');
4028 $(this).parents('.sub-menu-level-' + depth).removeClass('open'); 4029 }) 4030 4031 /* Accordeon du footer en mobile */ 4032 /* ----------------------------------------------------- */ 4033 .on('click', '.site__footer__accordion .site__footer__title', function(event) { 4034 $(this).parents('.site__footer__accordion').toggleClass('open'); 4035 }) 4036 4037 .on('click', '.toggle-trigger', function(e) { 4038 $(this).toggleClass('toggled'); 4039 $(this).siblings('.toggle').slideToggle(200); 4040 }) 4041 4042 /* ACCOUNT : Login / toggle */ 4043 /* ----------------------------------------------------- */ 4044 .on('click', '.account__login__toggle .btn', function(event) { 4045 event.preventDefault(); 4046 var login = $(this).data('login'); 4047 4048 if ( !$(this).hasClass('active') ) { 4049 $('.account__login__toggle .btn').removeClass('active'); 4050 $('.account__login__internal__login, .account__login__internal__signup').hide(0); 4051 4052 $(this).addClass('active'); 4053 $('.' + login).show(0); 4054 } 4055 }) 4056 4057 /* SOUS MENUS */ 4058 /* ----------------------------------------------------- */ 4059 .on('click', '.open-ssmenu', function(e) { 4060 4061 e.preventDefault(); 4062 4063 if ( $(this).parent().siblings('div').length ) { 4064 $(this).toggleClass('active'); 4065 4066 $(this).parent().siblings('div').slideToggle('fast'); 4067 } 4068 4069 }) 4070 4071 /* Description acteurs */ 4072 .on('click', '.acteur__description__toggle', function(e) { 4073 e.preventDefault(); 4074 4075 $(this).toggleClass('active'); 4076 $(this).parents('.acteur').toggleClass('active'); 4077 }) 4078 4079 /* Select ligue */ 4080 .on('change', '#ligue_select', function(e) { 4081 window.open($(this).val()) 4082 }) 4083 ; 4084 4085 ui.scroll(); 4086 }, 4087 4088 scroll : function () { 4089 4090 /* HEADER REDUIT */ 4091 /* ------------- */ 4092 // Desactivation en mobile/tablet 4093 // if ( !device.isMobile() ) { 4094 4095 if ( device.isMobile() ) { ui.delta = $('header').height(); } 4096 4097 // // Header reduit 4098 var st = $(window).scrollTop(); 4099 4100 // // Si on n'a pas atteint la limite definie 4101 if( Math.abs(ui.lastScrollTop - st) <= ui.delta ) 4102 return; 4103 4104 if (st > ui.lastScrollTop){ 4105 // downscroll code 4106 $('.site__header').removeClass('scrolledUp').addClass('scrolledDown'); 4107 } else { 4108 if ( st < ui.delta ) { 4109 $('.site__header').removeClass('scrolledDown scrolledUp'); 4110 } 4111 else { 4112 // upscroll code 4113 $('.site__header').removeClass('scrolledDown').addClass('scrolledUp'); 4114 } 4115 } 4116 // } 4117 4118 ui.lastScrollTop = st; 4119 4120 /* SCROLL TO TOP */ 4121 /* ------------- */ 4122 if ($(window).scrollTop() > ($('header').height()) ) { 4123 $('.scrolltotop').addClass('visible'); 4124 $('.menu-btn').addClass('anchored'); 4125 } 4126 else { 4127 $('.scrolltotop').removeClass('visible'); 4128 $('.menu-btn').removeClass('anchored'); 4129 } 4130 4131 /* NUMBERS ROLL */ 4132 /* ------------ */ 4133 // if ( $(".number, .keyfigure__number").length ) { 4134 4135 // if (ui.isInViewport($(".number, .keyfigure__number")) && $(this).prop('Viewed') != 1) { 4136 // $(".number, .keyfigure__number").each(function (i, e) { 4137 // $(this).prop('Counter',0).animate({ 4138 // Counter: $(this).data('count') 4139 // }, { 4140 // duration: 2000, 4141 // easing: 'swing', 4142 // step: function (now) { 4143 // if ( now < $(this).data('count') ) { 4144 // $(this).text(Math.ceil(now)); 4145 // } 4146 // }, 4147 // complete: function() { 4148 // $(this).prop('Viewed', 1); 4149 // } 4150 // }); 4151 // }); 4152 // } 4153 // } 4154 4155 /* BOUTONS STICKY */ 4156 /* ----------------------------------------------------- */ 4157 if ( $('.must_stick').length ) { 4158 var offset, direction; 4159 4160 $('.must_stick').each(function(index, el) { 4161 offset = $(el).data('offset'); 4162 direction = $(el).data('direction'); 4163 4164 if ( direction == 'bottom' ) { 4165 if ( ui.lastScrollTop <= offset ) { 4166 $(el).addClass('sticky'); 4167 } 4168 else { 4169 $(el).removeClass('sticky'); 4170 } 4171 } else { 4172 if ( ui.lastScrollTop >= offset ) { 4173 $(el).addClass('sticky'); 4174 } 4175 else { 4176 $(el).removeClass('sticky'); 4177 } 4178 } 4179 4180 }); 4181 } 4182 4183 }, 4184 4185 resize : function() { 4186 4187 $('.must_stick').each(function(index, el) { 4188 $(el).data('offset', $(el).offset().top); 4189 }); 4190 4191 }, 4192 4193 isInViewport : function( elem ) { 4194 var docViewTop = $(window).scrollTop(); 4195 var docViewBottom = docViewTop + $(window).height(); 4196 4197 var elemTop = $(elem).offset().top; 4198 var elemBottom = elemTop + $(elem).height(); 4199 4200 return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); 4201 }, 4202 4203 searchOpen : function( el ) { 4204 $(el).addClass('open'); 4205 $('body').toggleClass('search-open'); 4206 setTimeout(function() { 4207 el.find('.search-field').val(''); 4208 el.find('.search-field').focus(); 4209 }, 200); 4210 }, 4211 4212 searchClose : function( el ) { 4213 $('body').removeClass('search-open'); 4214 $(el).removeClass('open'); 4215 } 4216 4217 }; 4218 4219 4220 /* ----------------------------------------------------- */ 4221 /* AU SCROLL */ 4222 /* ----------------------------------------------------- */ 4223 $(window).scroll(function() { 4224 // console.log('scroll'); 4225 ui.scroll(); 4226 }); 4227 4228 /* ----------------------------------------------------- */ 4229 /* AU REDIMENSIONNEMENT */ 4230 /* ----------------------------------------------------- */ 4231 $(window).resize(function() { 4232 // console.log('resize'); 4233 ui.resize(); 4234 }); 4235 4236})(jQuery)
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.