1jQuery(document).ready(function($) { 2 3 ////////// Custom Instagram Wall ////////// 4 5 $("#sbi_images").addClass("owl-carousel owl-theme owl-instagram"); 6 $("#sbi_images .sbi_item").addClass('my_sbi_item'); 7 8 ////////// Modal Newsletter + cookie 6 mois ////////// 9 10 // Si le nombre de page vues est supérieur à 3 et que le cookie est en place 11 if(localStorage.pageViews > 3 && getCookie('cookie_newsletter') == 1) { 12 localStorage.pageViews = 0; // on remet le nombre de pages vues à 0 13 } 14 // Ou si le cookie est déjà en place 15 else if(getCookie('cookie_newsletter') == 1) { 16 localStorage.pageViews = 0; 17 } 18 else { 19 localStorage.pageViews= (+localStorage.pageViews || 0) + 1; // sinon on incrémente le nombre de pages vues 20 } 21 // Si le cookie n'est pas en place et que le nombre de pages vues est supérieur ou égal à 3, on appelle la popup et on initialise le cookie à 1 22 if(getCookie('cookie_newsletter') != 1) { 23 setTimeout(function(){ 24 $('#newsletter-modal').modal('show'); 25 },60000);
26 setCookie('cookie_newsletter', '1', 180); 27 } else if(getCookie('cookie_newsletter') != 1 && localStorage.pageViews >= 3) { 28 setTimeout(function () { 29 $('#newsletter-modal').modal('show'); 30 }, 5000); 31 setCookie('cookie_newsletter', '1', 180); // valeur en jour(s) avant expiration du cookie 32 } 33 34 35 ////////// Modal Soutenir resto ////////// 36 37 $('.result-resto').on('click', 'a.soutenir', function(e){ 38 e.preventDefault(); 39 var $this = $(this); 40 var href = $(this).attr('href'); 41 var title = $(this).parents('.event').attr('data-title'); 42 ga('send', 'event', 'soutenir un resto', 'click', 'click_'+title); 43 $('#soutenir-modal a').attr('href', href); 44 $('#soutenir-modal').modal('show'); 45 setTimeout(function () { 46 myclick(); 47 // window.open(href, '_blank'); 48 }, 5000); 49 // setTimeout(function () { 50 // $('#soutenir-modal').modal('hide'); 51 // }, 10000); 52 // return false; 53 }); 54 55 function myclick() { 56 $('#soutenir-modal a')[0].click(); 57 } 58 59 60 /////////// Load more resto ///////////// 61 62 63 $('.loadmore').on('click', 'button', function(){ 64 65 var disabled = $(".result-resto .event.disable"); 66 67 disabled.each(function( index ) { 68 if(index < 30) { 69 $(this).slideDown("slow").removeClass("disable"); 70 console.log(index); 71 } 72 }); 73 74 if($(".result-resto .event.disable").size() == 0) { 75 $('.loadmore').hide(); 76 } 77 78 }); 79 80 function fakeInfiniteScroll() { 81 $(".result-resto .event").addClass("disable"); 82 var total = $(".result-resto .event").size(); 83 var x = 30; 84 var y = 30; 85 $(".result-resto .event").hide(); 86 $(".result-resto .event:lt(30)").show().removeClass("disable"); 87 } 88 89 fakeInfiniteScroll(); 90 91 $('form.search-resto').submit(function(e){ 92 e.preventDefault(); 93 }); 94 95 96 ////////// Open Street Map ////////// 97 98 // if ($("#openstreetmap").length) { 99 // var latitude = $('.openstreetmap_marker').attr('data-lat'); 100 // var longitude = $('.openstreetmap_marker').attr('data-lng'); 101 // var templateUrl = object_name.templateUrl; 102 // var coralIcon = L.icon({ 103 // iconUrl: templateUrl + '/dist/img/picto-map.png', 104 // iconSize: [82, 69], // size of the icon 105 // popupAnchor: [0, -25] 106 // }); 107 // var map = L.map('openstreetmap').setView([latitude, longitude], 16); 108 109 // L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 110 // attribution: '© Provence Tourisme' 111 // }).addTo(map); 112 113 // L.marker([latitude, longitude], {icon: coralIcon}).addTo(map); 114 // } 115 116 ////////// Date Picker ////////// 117 118 $('#from,#to').click(function(e){ 119 e.preventDefault(); 120 }); 121 if ($("#from").length) { 122 TinyDatePicker('#from', { 123 lang: { 124 days: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], 125 months: [ 126 'Janvier', 127 'Février', 128 'Mars', 129 'Avril', 130 'Mai', 131 'Juin', 132 'Juillet', 133 'Août', 134 'Septembre', 135 'Octobre', 136 'Novembrr', 137 'Décembre', 138 ], 139 today: 'Aujourd\'hui', 140 clear: 'Effacer', 141 close: 'Fermer', 142 }, 143 dayOffset: 1, 144 format(date) { 145 return date.toLocaleDateString(); 146 }, 147 mode: 'dp-below' 148 }); 149 } 150 if ($("#to").length) { 151 TinyDatePicker('#to', { 152 lang: { 153 days: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], 154 months: [ 155 'Janvier', 156 'Février', 157 'Mars', 158 'Avril', 159 'Mai', 160 'Juin', 161 'Juillet', 162 'Août', 163 'Septembre', 164 'Octobre', 165 'Novembrr', 166 'Décembre', 167 ], 168 today: 'Aujourd\'hui', 169 clear: 'Effacer', 170 close: 'Fermer', 171 }, 172 dayOffset: 1, 173 format(date) { 174 return date.toLocaleDateString(); 175 }, 176 mode: 'dp-below' 177 }); 178 } 179 180 ////////// Read more ////////// 181 182 $('a.readMore').click(function(){ 183 if ($(this).parent().find('#readMore').css('display') == 'none') { 184 $(this).text($(this).attr('data-open')); 185 } else { 186 $(this).text($(this).attr('data-close')); 187 } 188 }); 189 $('#events .all_btn a').on('click', function(event){ 190 var url = $(this).attr("data-href"); 191 var ville = $(this).attr("data-ville"); 192 var s = $(this).attr("data-s"); 193 var datefrom = $(this).attr("data-from"); 194 var dateto = $(this).attr("data-to"); 195 var type = $(this).attr("data-type"); 196 var page = $(this).attr("data-page"); 197 var lat = $(this).attr("data-lat"); 198 var long = $(this).attr("data-long"); 199 page++; 200 $(this).attr("data-page", page); 201 $('#events .loading').css('display', 'block'); 202 var filters = "action=programmefilters&s=" + s + "&lat=" + lat + "&long=" + long + "&ville=" + ville + "&from=" + datefrom + "&to=" + dateto + "&type=" + type + "&page=" + page; 203 $.ajax({ 204 url: url, 205 data: filters, // form data 206 type: "GET", 207 success:function(data){ 208 $('#events .result-event').append(data); // insert data 209 $('#events .loading').css('display', 'none'); 210 $('html,body').animate({ 211 scrollTop: $("#events").offset().bottom 212 }, 500, 'easeInOutExpo'); 213 } 214 }); 215 event.preventDefault(); 216 }); 217
218 ////////// Load more ////////// 219 220 // event 221 $(function() { 222 $(".result.events") 223 .slice(0, 2) 224 .show(); 225 $("#loadMore2").on("click", function(e) { 226 e.preventDefault(); 227 $(".result.events:hidden") 228 .slice(0, 2) 229 .slideDown(); 230 if ($(".result.events:hidden").length == 0) { 231 $("#loadMore2").fadeOut("slow"); 232 } 233 }); 234 }); 235 236 237 // recette 238 $(function() { 239 $(".result.recette") 240 .slice(0, 8) 241 .show(); 242 $("#loadMore").on("click", function(e) { 243 e.preventDefault(); 244 $(".result.recette:hidden") 245 .slice(0, 8) 246 .slideDown(); 247 if ($(".result.recette:hidden").length == 0) { 248 $("#loadMore").fadeOut("slow"); 249 } 250 }); 251 }); 252 253 // phototheque (attention ne fonctionne pas apres le code d'isotope) 254 $(function() { 255 $(".phototheque.item") 256 .slice(0, 8) 257 .show(); 258 $("#loadMore-phototheque").on("click", function(e) { 259 e.preventDefault(); 260 $(".phototheque.item:hidden") 261 .slice(0, 8) 262 .slideDown(); 263 if ($(".phototheque.item:hidden").length == 0) { 264 $("#loadMore-phototheque").fadeOut("slow"); 265 } 266 }); 267 }); 268 269 ////////// Detect OS Mac ////////// 270 271 if (navigator.userAgent.indexOf("Mac") > 0) $("body").addClass("mac-os"); 272 273 ////////// Hide menu on scroll ////////// 274 275 $(function() { 276 var header = $("#masthead"); 277 var prevScrollpos = window.pageYOffset; 278 window.onscroll = function() { 279 var currentScrollPos = window.pageYOffset; 280 if (prevScrollpos > currentScrollPos) { 281 header.removeClass("hide"); 282 } else { 283 header.addClass("hide"); 284 } 285 prevScrollpos = currentScrollPos; 286 }; 287 }); 288 289 ////////// Owl Carousel ////////// 290 291 $(".owl-chaud-devant").owlCarousel({ 292 margin: 20, 293 nav: true, 294 navText: [], 295 dots: true, 296 loop: true, 297 responsive: { 298 0: { 299 items: 1 300 }, 301 725: { 302 items: 2 303 }, 304 768: { 305 items: 3 306 } 307 } 308 }); 309 310 311 var syncedSecondary = true; 312 313 $(".owl-feature").owlCarousel({ 314 margin: 0, 315 nav: false, 316 dots: false, 317 items: 1, 318 autoplay:false, 319 rewind:false, 320 mouseDrag: true, 321 touchDrag: true, 322 pullDrag: true, 323 loop: true, 324 autoHeight : true, 325 }).on("changed.owl.carousel", syncPosition); 326 327 $(".owl-thumbnails").on("initialized.owl.carousel", function() { 328 $(".owl-thumbnails").find(".owl-item").eq(0).addClass("current"); 329 }) 330 .owlCarousel({ 331 margin: 30, 332 nav: true, 333 dots: false, 334 items: 3, 335 slideBy: 1, 336 navSpeed:1000, 337 autoplay:false, 338 rewind:true, 339 mouseDrag: true, 340 touchDrag: true, 341 pullDrag: true, 342 loop:false, 343 responsive:{ 344 0:{ 345 items: 1, 346 }, 347 575:{ 348 items: 2, 349 }, 350 767:{ 351 items: 2, 352 }, 353 991:{ 354 items: 3, 355 }, 356 } 357 }).on("changed.owl.carousel", syncPosition2); 358 359 function syncPosition(el) { 360 //if loop is set to false, then you have to uncomment the next line 361 //var current = el.item.index; 362 363 //to disable loop, comment this block 364 var count = el.item.count - 1; 365 var current = Math.round(el.item.index - el.item.count / 2 - 0.5); 366 367 if (current < 0) { 368 current = count; 369 } 370 if (current > count) { 371 current = 0; 372 } 373 //to this 374 $(".owl-thumbnails").find(".owl-item").removeClass("current").eq(current).addClass("current"); 375 var onscreen = $(".owl-thumbnails").find(".owl-item.active").length - 1; 376 var start = $(".owl-thumbnails").find(".owl-item.active").first().index(); 377 var end = $(".owl-thumbnails").find(".owl-item.active").last().index(); 378 if (current > end) { 379 $(".owl-thumbnails").data("owl.carousel").to(current, 100, true); 380 } 381 if (current < start) { 382 $(".owl-thumbnails").data("owl.carousel").to(current - onscreen, 100, true); 383 } 384 } 385 386 function syncPosition2(el) { 387 if (syncedSecondary) { 388 var number = el.item.index; 389 $(".owl-feature").data("owl.carousel").to(number, 100, true); 390 } 391 } 392 393 $(".owl-produts").owlCarousel({ 394 margin: 0, 395 nav: true, 396 dots: false, 397 items: 4, 398 slideBy: 1, 399 navSpeed:1000, 400 autoplay:false, 401 rewind:true, 402 mouseDrag: true, 403 touchDrag: true, 404 pullDrag: true, 405 loop:false, 406 responsive:{ 407 0:{ 408 items: 1, 409 }, 410 575:{ 411 items: 2, 412 }, 413 767:{ 414 items: 3, 415 }, 416 991:{ 417 items: 4, 418 }, 419 } 420 }); 421 422 $(".owl-thumbnails").on("click", ".owl-item", function(e) { 423 e.preventDefault(); 424 var number = $(this).index(); 425 $(".owl-feature").data("owl.carousel").to(number, 300, true); 426 }); 427 428 $(".owl-principe-projet").owlCarousel({ 429 margin: 30, 430 nav: true, 431 navText: [], 432 dots: true, 433 slideBy: 5, 434 responsive: { 435 0: { 436 items: 1, 437 slideBy: 1 438 }, 439 480: { 440 items: 2, 441 slideBy: 2 442 }, 443 768: { 444 items: 5 445 } 446 } 447 }); 448 449 $(".owl-galerie_officielle").owlCarousel({ 450 margin: 10, 451 nav: false, 452 dots: true, 453 loop: true, 454 responsive: { 455 0: { 456 items: 1 457 }, 458 480: { 459 items: 2 460 }, 461 600: { 462 items: 3 463 }, 464 960: { 465 items: 4 466 } 467 } 468 }); 469 470 $(".owl-partenaires").owlCarousel({ 471 margin: 10, 472 nav: true, 473 navText: [], 474 autoplay: true, 475 autoplayTimeout: 2000, 476 autoplayHoverPause: true, 477 loop: true, 478 dots: false, 479 responsive: { 480 0: { 481 items: 1 482 }, 483 480: { 484 items: 2 485 }, 486 960: { 487 items: 3 488 } 489 } 490 }); 491 492 $(".owl-instagram").owlCarousel({ 493 margin: 20, 494 nav: true, 495 navText: [], 496 dots: false, 497 responsive: { 498 0: { 499 items: 1 500 }, 501 480: { 502 items: 2 503 }, 504 765: { 505 items: 3 506 }, 507 1200: { 508 items: 4 509 } 510 } 511 }); 512 513 $(".owl-recette").owlCarousel({ 514 margin: 35, 515 nav: false, 516 navText: [], 517 dots: false, 518 responsive: { 519 0: { 520 items: 1 521 }, 522 765: { 523 items: 2 524 }, 525 960: { 526 items: 3 527 }, 528 1200: { 529 items: 4 530 } 531 532 } 533 }); 534 535 $(".owl-tuto").owlCarousel({ 536 margin: 35, 537 nav: false, 538 navText: [], 539 dots: false, 540 responsive: { 541 0: { 542 items: 1 543 }, 544 765: { 545 items: 2 546 }, 547 960: { 548 items: 3 549 }, 550 1200: { 551 items: 4 552 } 553 } 554 }); 555 556 $(".owl-food").owlCarousel({ 557 margin: 35, 558 nav: false, 559 navText: [], 560 dots: false, 561 responsive: { 562 0: { 563 items: 1 564 }, 565 765: { 566 items: 2 567 }, 568 965: { 569 items: 3 570 }, 571 1200: { 572 items: 4 573 } 574 } 575 }); 576 577 $(".owl-talent").owlCarousel({ 578 margin: 50, 579 nav: false, 580 navText: [], 581 dots: false, 582 responsive: { 583 0: { 584 items: 1 585 }, 586 960: { 587 items: 2, 588 margin: 20 589 }, 590 1200: { 591 items: 3 592 } 593 } 594 }); 595 596 $(".owl-videos").owlCarousel({ 597 margin: 15, 598 nav: false, 599 navText: [], 600 dots: false, 601 responsive: { 602 0: { 603 items: 1 604 }, 605 765: { 606 items: 2 607 }, 608 1200: { 609 items: 3 610 } 611 } 612 }); 613 614 $(".owl-events").owlCarousel({ 615 margin: 30, 616 nav: false, 617 navText: [], 618 nav:true, 619 dots: false, 620 responsive: { 621 0: { 622 items: 1 623 }, 624 960: { 625 items: 2 626 }, 627 1200: { 628 items: 3 629 } 630 } 631 }); 632 633 $(".owl-billets").owlCarousel({ 634 margin: 30, 635 nav: false, 636 navText: [], 637 nav:true, 638 dots: false, 639 responsive: { 640 0: { 641 items: 1 642 }, 643 960: { 644 items: 2 645 }, 646 1200: { 647 items: 3 648 } 649 } 650 }); 651 652 $(".owl-resto").owlCarousel({ 653 margin: 40, 654 center: true, 655 loop: true, 656 nav: false, 657 navText: [], 658 dots: true, 659 responsive: { 660 0: { 661 items: 1 662 }, 663 485: { 664 items: 2 665 }, 666 760: { 667 items: 3, 668 margin: 20, 669 center:false 670 }, 671 1200: { 672 items: 4 673 }, 674 1400: { 675 items: 5 676 } 677 } 678 }); 679 680 $(".owl-event").owlCarousel({ 681 items: 1, 682 margin: 0, 683 loop: true, 684 nav: false, 685 navText: [], 686 dots: true 687 }); 688 689 $(".owl-sejour").owlCarousel({ 690 center: true, 691 loop: true, 692 margin: 30, 693 nav: true, 694 navText: [], 695 dots: true, 696 responsive: { 697 360: { 698 items: 1, 699 margin: 10, 700 center: false 701 }, 702 765: { 703 items: 2 704 }, 705 965: { 706 items: 3 707 }, 708 1200: { 709 items: 4 710 } 711 } 712 }); 713 714 ////////// Fancybox ////////// 715 716 $("[data-fancybox='gallery']").fancybox({ 717 smallBtn: true, 718 toolbar: true, 719 buttons: [ 720 // "zoom", 721 // "share", 722 "slideShow", 723 // "fullScreen", 724 "download", 725 "thumbs", 726 "close" 727 ], 728 //infobar: true, 729 apreventCaptionOverlap: true 730 }); 731 732 ////////// Modal ////////// 733 734 $(".modale").on("click", function() { 735 $(".modale-content").toggleClass("open"); 736 }); 737 738 ////////// Add placeholder form page presse for espace pro ////////// 739 740 $(".form_espace_pro .login-username input").attr("placeholder", "Username"); 741 $(".form_espace_pro .login-password input").attr("placeholder", "Password"); 742
743 ////////// Isotopes ////////// 744 745 // // Isotope produits 746 747 748 // $(".isotope-content").isotope({ 749 // itemSelector: ".bloc_content_hover", 750 // percentPosition: true, 751 // masonry: { 752 // columnWidth: ".bloc_content_hover" 753 // } 754 // }); 755 756 // $(".isotope-filter").on("click", "li", function() { 757 // var filterValue = $(this).attr("data-filter"); 758 // iso.arrange({ filter: filterValue }); 759 // $(".isotope-filter a").removeClass("current"); 760 // $(this).addClass("current"); 761 // }); 762 763 // // affichage de la saison mise en avant 764 // var saison = $(".isotope-filter").attr("data-saison"); 765 // iso.arrange({ filter: saison }); 766 767 768 // // Isotope territoires 769 770 771 // $(".isotope-content2").isotope({ 772 // itemSelector: ".bloc_content_hover", 773 // percentPosition: true, 774 // masonry: { 775 // columnWidth: ".grid-sizer" 776 // } 777 // }); 778 779 // $(".isotope-filter2").on("click", "li", function() { 780 // var filterValue = $(this).attr("data-filter"); 781 // iso2.arrange({ filter: filterValue }); 782 // $(".isotope-filter2 li").removeClass("current"); 783 // $(this).addClass("current"); 784 // }); 785 786 // // affichage de la saison mise en avant 787 // var territoire = $(".isotope-filter2").attr("data-territoire"); 788 // iso2.arrange({ filter: territoire }); 789 790 // Isotope produits 791 792 if ($(".isotope-content").length) { 793 var iso = new Isotope(".isotope-content", { 794 itemSelector: ".bloc_content_hover", 795 percentPosition: true, 796 797 masonry: { 798 columnWidth: ".bloc_content_hover" 799 } 800 }); 801 802 $(".isotope-filter").on("click", "li", function() { 803 var filterValue = $(this).attr("data-filter"); 804 805 iso.arrange({ filter: filterValue }); 806 807 $(".isotope-filter a").removeClass("current"); 808 $(this).addClass("current"); 809 }); 810 811 // affichage de la saison mise en avant 812 var saison = $(".isotope-filter").attr("data-saison"); 813 iso.arrange({ filter: saison }); 814 } 815 816 // Isotope territoires 817 818 if ($(".isotope-content2").length) { 819 var iso2 = new Isotope(".isotope-content2", { 820 itemSelector: ".bloc_content_hover", 821 percentPosition: true, 822 823 masonry: { 824 columnWidth: ".grid-sizer" 825 } 826 }); 827 828 $(".isotope-filter2").on("click", "li", function() { 829 var filterValue = $(this).attr("data-filter"); 830 831 iso2.arrange({ filter: filterValue }); 832 833 $(".isotope-filter2 li").removeClass("current"); 834 $(this).addClass("current"); 835 }); 836 // affichage de la saison mise en avant 837 var territoire = $(".isotope-filter2").attr("data-territoire"); 838 iso2.arrange({ filter: territoire }); 839 } 840 841 ////////// Smooth scroll on link ////////// 842 843 $("a.scroll").on("click", function(evt) { 844 evt.preventDefault(); 845 var target = $(this).attr("href"); 846 $("html, body") 847 .stop() 848 .animate({ scrollTop: $(target).offset().top }, 1000); 849 }); 850 851 ////////// Close modal Iframe ////////// 852 853 $(document).on('closing', '.remodal', function (e) { 854 var src = $(this).find("iframe").attr("src"); 855 $(this).find("iframe").attr("src",""); 856 $(this).find("iframe").attr("src",src); 857 }); 858 859 ////////// Filter Isotope + loadmore ///////// 860 861 // init Isotope 862 var $container = $('#boutique .grid').isotope({ 863 itemSelector: '.element-item', 864 layoutMode: 'fitRows', 865 getSortData: { 866 category: '[data-category]', 867 } 868 }); 869 870 // filter functions 871 // var filterFns = { 872 // // show if number is greater than 50 873 // numberGreaterThan50: function() { 874 // var number = $(this).find('.number').text(); 875 // return parseInt(number, 10) > 50; 876 // }, 877 // // show if name ends with -ium 878 // ium: function() { 879 // var name = $(this).find('.name').text(); 880 // return name.match(/ium$/); 881 // } 882 // }; 883 884 // bind filter button click 885 $('#filters').on('click', 'button', function() { 886 var filterValue = $(this).attr('data-filter'); 887 $container.isotope({ 888 filter: filterValue 889 }); 890 }); 891 892 // change is-checked class on buttons 893 $('.button-group').each(function(i, buttonGroup) { 894 var $buttonGroup = $(buttonGroup); 895 $buttonGroup.on('click', 'button', function() { 896 $buttonGroup.find('.is-checked').removeClass('is-checked'); 897 $(this).addClass('is-checked'); 898 }); 899 }); 900 901 //**************************** 902 // Isotope Load more button 903 //**************************** 904 var initShow = 40; //number of items loaded on init & onclick load more button 905 var counter = initShow; //counter for load more button 906 var iso = $container.data('isotope'); // get Isotope instance 907 908 loadMore(initShow); //execute function onload 909 910 function loadMore(toShow) { 911 // $container.find(".hidden").removeClass("hidden"); 912 913 // var hiddenElems = iso.filteredItems.slice(toShow, iso.filteredItems.length).map(function(item) { 914 // return item.element; 915 // }); 916 // $(hiddenElems).addClass('hidden'); 917 // $container.isotope('layout'); 918 919 // //when no more to load, hide show more button 920 // if (hiddenElems.length == 0) { 921 // jQuery(".load-more").hide(); 922 // } else { 923 // jQuery(".load-more").show(); 924 // }; 925 926 } 927 928 //append load more button 929 if($('#boutique .element-item').length > initShow){ 930 $container.after('<div class="load-more"><button id="load-more">Voir plus</button></div>'); 931 } 932 933 //when load more button clicked 934 $("#load-more").click(function() { 935 if ($('#filters').data('clicked')) { 936 //when filter button clicked, set initial value for counter 937 counter = initShow; 938 $('#filters').data('clicked', false); 939 } else { 940 counter = counter; 941 }; 942 943 counter = counter + initShow; 944
945 loadMore(counter); 946 }); 947 948 //when filter button clicked 949 $("#filters").click(function() { 950 $(this).data('clicked', true); 951 952 loadMore(initShow); 953 }); 954 955 ////////// Slider circle ////////// 956 957 // class Slider { 958 // constructor(props) { 959 // this.rootElement = props.element; 960 // this.slides = Array.from( 961 // this.rootElement.querySelectorAll(".slider-list__item") 962 // ); 963 // this.slidesLength = this.slides.length; 964 // this.current = 0; 965 // this.isAnimating = false; 966 // this.direction = 1; // -1 967 // this.baseAnimeSettings = { 968 // rotation: 45, 969 // duration: 750, 970 // easing: "easeInOutCirc" 971 // }; 972 // this.baseAnimeSettingsBack = { 973 // rotation: 45, 974 // duration: 1850 975 // }; 976 // this.baseAnimeSettingsFront = { 977 // rotation: 45, 978 // duration: 2250 979 // }; 980 // this.baseAnimeSettingsTitle = { 981 // rotation: 45, 982 // duration: 1750 983 // }; 984 985 // this.navBar = this.rootElement.querySelector(".slider__nav-bar"); 986 // this.thumbs = Array.from( 987 // this.rootElement.querySelectorAll(".nav-control") 988 // ); 989 // this.prevButton = this.rootElement.querySelector(".slider__arrow_prev"); 990 // this.nextButton = this.rootElement.querySelector(".slider__arrow_next"); 991 992 // this.slides[this.current].classList.add("slider-list__item_active"); 993 // this.thumbs[this.current].classList.add("nav-control_active"); 994 995 // this._bindEvents(); 996 // } 997 998 // goTo(index, dir) { 999 // if (this.isAnimating) return; 1000 // var self = this; 1001 // let prevSlide = this.slides[this.current]; 1002 // let nextSlide = this.slides[index]; 1003 1004 // self.isAnimating = true; 1005 // self.current = index; 1006 // nextSlide.classList.add("slider-list__item_active"); 1007 1008 // anime( 1009 // Object.assign({}, self.baseAnimeSettings, { 1010 // targets: nextSlide, 1011 // rotate: [90 * dir + "deg", 0], 1012 // translateX: [90 * dir + "%", 0], 1013 // opacity:1 1014 // }) 1015 // ); 1016 1017 // anime( 1018 // Object.assign({}, self.baseAnimeSettingsBack, { 1019 // targets: nextSlide.querySelectorAll(".back__element"), 1020 // rotate: [90 * dir + "deg", 0], 1021 // translateX: [90 * dir + "%", 0] 1022 // }) 1023 // ); 1024 1025 // anime( 1026 // Object.assign({}, self.baseAnimeSettingsTitle, { 1027 // targets: nextSlide.querySelectorAll(".title__element"), 1028 // rotate: [90 * dir + "deg", 0], 1029 // translateX: [90 * dir + "%", 0] 1030 // }) 1031 // ); 1032 1033 // anime( 1034 // Object.assign({}, self.baseAnimeSettings, { 1035 // targets: prevSlide, 1036 // rotate: [0, -90 * dir + "deg"], 1037 // translateX: [0, -100 * dir + "%"], 1038 // opacity:0, 1039 // complete: function(anim) { 1040 // self.isAnimating = false; 1041 // prevSlide.classList.remove("slider-list__item_active"); 1042 // self.thumbs.forEach((item, index) => { 1043 // var action = index === self.current ? "add" : "remove"; 1044 // item.classList[action]("nav-control_active"); 1045 // }); 1046 // } 1047 // }) 1048 // ); 1049 1050 // anime( 1051 // Object.assign({}, self.baseAnimeSettingsBack, { 1052 // }) 1053 // ); 1054 1055 // anime( 1056 // Object.assign({}, self.baseAnimeSettingsTitle, { 1057 // }) 1058 // ); 1059 // } 1060 1061 // goStep(dir) { 1062 // let index = this.current + dir; 1063 // let len = this.slidesLength; 1064 // let currentIndex = (index + len) % len; 1065 // this.goTo(currentIndex, dir); 1066 // } 1067 1068 // goNext() { 1069 // this.goStep(1); 1070 // } 1071 1072 // goPrev() { 1073 // this.goStep(-1); 1074 // } 1075 1076 // _navClickHandler(e) { 1077 // var self = this; 1078 // if (self.isAnimating) return; 1079 // let target = e.target.closest(".nav-control"); 1080 // if (!target) return; 1081 // let index = self.thumbs.indexOf(target); 1082 // if (index === self.current) return; 1083 // let direction = index > self.current ? 1 : -1; 1084 // self.goTo(index, direction); 1085 // } 1086 1087 // _bindEvents() { 1088 // var self = this; 1089 // ["goNext", "goPrev", "_navClickHandler"].forEach(method => { 1090 // self[method] = self[method].bind(self); 1091 // }); 1092 // self.nextButton.addEventListener("click", self.goNext); 1093 // self.prevButton.addEventListener("click", self.goPrev); 1094 // self.navBar.addEventListener("click", self._navClickHandler); 1095 // } 1096 // } 1097 1098 // let slider = new Slider({ 1099 // element: document.querySelector(".slider") 1100 // }); 1101
1102 ////////// Flip effect ////////// 1103 1104 // document.querySelector(".card-flip").classList.toggle("flip"); 1105 $( ".card-flip" ).each(function() { 1106 $( this ).toggle("flip"); 1107 }); 1108 1109 1110 ////////// Touch on mobile hover isotope ////////// 1111 1112 // function toggleImage(e) { 1113 // if (e.type == "touchstart") { 1114 // link.removeEventListener("mouseenter", toggleImage); 1115 // link.removeEventListener("mouseleave", toggleImage); 1116 // } 1117 // link.classList.toggle("hover"); 1118 // } 1119 1120 // var link = document.querySelector(".bloc_content_hover > div"); 1121 1122 // ["mouseenter", "mouseleave", "touchstart"].forEach(function(event) { 1123 // link.addEventListener(event, toggleImage, false); 1124 // }); 1125 1126 $(".share-alt").on("click", function(e) { 1127 $(".branch").removeClass("no-animation"); 1128 $(".branch").toggleClass("open"); 1129 }); 1130 1131 $(".social").on("click", function(e) { 1132 $(".container").removeClass("no-animation"); 1133 $(".container").toggleClass("open"); 1134 }); 1135 1136 $(".share").on("click", function(e) { 1137 $(".float-circle").removeClass("no-animation"); 1138 $(".float-circle").toggleClass("open"); 1139 }); 1140 1141 1142}); 1143 1144////////// Cookies function ////////// 1145 1146function setCookie(cname, cvalue, exdays) { 1147 var d = new Date(); 1148 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 1149 var expires = "expires="+ d.toUTCString(); 1150 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 1151} 1152 1153function getCookie(cname) { 1154 var name = cname + "="; 1155 var decodedCookie = decodeURIComponent(document.cookie); 1156 var ca = decodedCookie.split(';'); 1157 for(var i = 0; i <ca.length; i++) { 1158 var c = ca[i]; 1159 while (c.charAt(0) == ' ') { 1160 c = c.substring(1); 1161 } 1162 if (c.indexOf(name) == 0) { 1163 return c.substring(name.length, c.length); 1164 } 1165 } 1166 return ""; 1167}
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.