1jQuery(document).ready(function($){ 2 3 // FITTEXT pour le gestion de la taille de Typo 4 $(window).load(function(){ 5 $('.focus-grid .push-large').fitText(742/13/10, {minFontSize:8}); 6 7 $('.push-message').fitText(228/13/10, {minFontSize:4}); 8 }); 9 10 // =========================================== 11 12 // UNIFORM pour la stylysation des éléments de formulaires 13 14 $('select, input[type=radio]').uniform(); 15 16 17 // =========================================== 18 19 20 21 // Gestion de la taille de la fenêtre 22 23 var $document = $(document), 24 $window = $(window); 25 26 (function(){ 27 var windowWidth = $window.width(), 28 windowHeight = $window.height(); 29 30 $window.resize(function() { 31 // Sauvegarde des dimentions 32 var width = $window.width(), 33 height = $window.height(); 34 35 // Comaraison des valeurs 36 if (width == windowWidth && 37 height == windowHeight) return; 38 39 // Sauvegarde des valeurs 40 windowWidth = width; 41 windowHeight = height; 42 43 // Trigger de l'évenement 44 $(window).trigger('uniqueresize', [windowWidth, windowHeight]); 45 $(window).trigger('singleResize', [windowWidth, windowHeight]); 46 }); 47 48 })(); 49 50 $window.on('uniqueresize', resizeWindow); 51 52 $window.on('singleResize', sliderResize); 53 54 // =========================================== 55 // 56 // 57 // Positionnement du menu en cas de Scroll 58 59 $(function(){ 60 // Check the initial Poistion of the Sticky Header 61 var stickyHeaderTop = $('#header').offset().top; 62 63 $(window).scroll(function(){ 64 if( $(window).scrollTop() > stickyHeaderTop && !$('body').hasClass('mobile-tpl')) { 65 $('#header').css({position: 'fixed', top: '0px', width: '100%'}); 66 $('#topbar').css({'margin-bottom': '142px'}); 67 } else { 68 $('#header').css({position: 'static', top: '0px'}); 69 $('#topbar').css({'margin-bottom': '0px'}); 70 } 71 }); 72 }); 73 74 // =========================================== 75 76 77 // Slider Scrulpture Nature 78 79 var $hero = $('#hero'); 80 var $slider = $hero.find('.slides'); 81 var $slides = $slider.find('.slide'); 82 var timeout; 83 84 var config = { 85 imgWidth : 910, 86 imgHeight : 480, 87 }; 88 89 var slideOffset = 0; 90 var slidesVisible = 1; 91 92 $hero.each(function(){ 93 $slides.each(function(i, slide) { 94 $(slide).css('margin-left', (i*100) + '%'); 95 }); 96 97 $slides.click(function(event){ 98 if ($(this).is('.slide-notvisible')) { 99 showSlide($.inArray(this, $slides)); 100 window.clearTimeout(timeout); 101 } 102 }); 103 104 105 function slideAuto(){ 106 var firstNotVisible = $('.slide-notvisible').first(); 107 showSlide($.inArray(firstNotVisible[0], $slides)); 108 } 109 110 timeout = setTimeout(slideAuto, 5000); 111 112 113 114 115 function showSlide(index) { 116 slideOffset = index - slidesVisible + 1; 117 var animations = 0; 118 $slides.each(function(i, slide) { 119 animations++; 120 $(slide) 121 .stop(true) 122 .animate({ 123 'margin-left' : ((i - slideOffset) * 100) + '%' 124 }, 600, complete) 125 .toggleClass('slide-notvisible', i - slideOffset >= slidesVisible); 126 }); 127 function complete(){ 128 animations--; 129 if (animations > 0) return 130 $slides.each(function(i, slide) { 131 var $slide = $(slide); 132 if (i < slideOffset) $slide.appendTo($slider).css('margin-left', (($slides.length - slideOffset) * 100)+'%'); 133 }); 134 slideOffset = 0; 135 $slides = $slider.find('.slide'); 136 137 timeout = setTimeout(slideAuto, 5000); 138 } 139 } 140
141 function update() { 142 var heroWidth = $hero.width(); 143 var usableWidth = heroWidth - 320; 144 var slideWidth; 145 146 var sizes = []; 147 148 var num, min = 1, max = $slides.length - 1; 149 for (num = min; num <= max; num++) { 150 slideWidth = Math.round(heroWidth / (num + 0.20)); 151 sizes.push({num:num, width:slideWidth}); 152 } 153 154 var settings = getNearestOf(config.imgWidth, sizes, 'width'); 155 settings.width = Math.min(settings.width, config.imgWidth); 156 157 $slider.width(settings.width); 158 $hero.height(settings.width*config.imgHeight/config.imgWidth); 159 160 slidesVisible = settings.num; 161 162 $slides.each(function(i, slide){ 163 $(slide).toggleClass('slide-notvisible', i - slideOffset >= settings.num); 164 }); 165 166 } 167 168 function getNearestOf(target, values, key) { 169 var i = 0; 170 var n = values.length; 171 var result, resultDist, value, valueDist; 172 for (; i < n; i++) { 173 value = key ? values[i][key] : values[i]; 174 valueDist = Math.abs(target - value); 175 if (resultDist === undefined || resultDist > valueDist) { 176 resultDist = valueDist; 177 result = values[i]; 178 } 179 } 180 return result; 181 } 182 183 $(window).resize(update).resize(); 184 185 }); 186 187 188 189 // =========================================== 190 191 // Actions au resize de la fenêtre 192 193 var $body = $('body'), 194 $mobileMenu = $('.mobile_menu'), 195 $fade = $('.fade'), 196 $mobileMenuBtn = $('.mobile_menu_btn'), 197 $laguages = $('.languages'), 198 $followUs = $('.followus'); 199 $menubis = $('.menu-bis'); 200 $search = $('.search_container'); 201 202 203 function resizeWindow(event, windowWidth, windowHeight){ 204 205 if(windowWidth < 1046 && !$body.hasClass('mobile-tpl')){ 206 $body.addClass('mobile-tpl'); 207 $mobileMenu.append($('#header ul.menu').clone()); 208 $mobileMenu.append($menubis.clone()); 209 $mobileMenu.append($laguages.clone()); 210 $mobileMenu.append($followUs.clone()); 211 $mobileMenu.append($search.clone()); 212 }else if(windowWidth > 1046 && $body.hasClass('mobile-tpl')){ 213 $body.removeClass('mobile-tpl'); 214 $body.removeClass('is-opened'); 215 $mobileMenu.empty(); 216 } 217 218 } 219 var windowWidth = $window.width(); 220 resizeWindow('', windowWidth); 221 222 223 /* -------------------------------------------------- 224 OPEN MOBILE MENU 225 -------------------------------------------------- */ 226 227 $mobileMenuBtn.on('click', function(){ 228 $body.toggleClass('is-opened'); 229 }); 230 231 $fade.on('click', function(){ 232 $body.toggleClass('is-opened'); 233 }); 234 235 /* -------------------------------------------------- 236 RESPONSIVE IFRAMES 237 -------------------------------------------------- */ 238 239 /** 240 * Wraps all iframes to make them responsive. 241 */ 242 function initResponsiveIframes($root) { 243 if (!$root) $root = $('body'); 244 var $iframe, $wrap, width, height, $parent; 245 $root.find('iframe:visible:not(.responsive,.no-resize)').each(function(i, iframe) { 246 $iframe = $(iframe).addClass('responsive'); 247 $wrap = $('<div class="iframe-wrap">'); 248 249 // match the iframe ratio 250 width = parseInt($iframe.attr('width')); 251 height = parseInt($iframe.attr('height')); 252 $wrap.css('padding-top', (height / width * 100) + '%'); 253 254 // wrap it up ! 255 $iframe.wrap($wrap); 256 }); 257 } 258 // default init 259 initResponsiveIframes(); 260 261 // make it global 262 window.initResponsiveIframes = initResponsiveIframes; 263 264 265 // =========================================== 266 267 // ------ Gestion des liste d'articles 268 // 269 // Responsive 270 271 $('.article-list').each(function(i,list) { 272 var $articlesPushs = $(list).find('.push-small'); 273 $articlesPushs.filter(':nth-child(4n+1)').addClass('firstOf4'); 274 $articlesPushs.filter(':nth-child(3n+1)').addClass('firstOf3'); 275 $articlesPushs.filter(':nth-child(2n+1)').addClass('firstOf2'); 276 }); 277 278 // Hover 279 280 $('.push').hover(function(){ 281 $(this).addClass('hover-push'); 282 }, function(){ 283 $(this).removeClass('hover-push'); 284 }); 285 286 $('.push-small').hover(function(){ 287 $(this).find('.push-image').append('<span class="push-fade"></span>'); 288 }, function(){ 289 $(this).find('.push-fade').remove(); 290 }); 291 292 $('.archive-push').hover(function(){ 293 $(this).find('.push-image').append('<span class="push-fade"></span>'); 294 }, function(){ 295 $(this).find('.push-fade').remove(); 296 }); 297 298 299 // =========================================== 300 301 $('.list .photo').hover(function(){ 302 $(this).find('.infos').show(); 303 }, function(){ 304 $(this).find('.infos').hide(); 305 }); 306 307 /* -------------------------------------------------- 308 HOVER CONTRIBUTORS 309 -------------------------------------------------- */ 310 311 $('.contributor, .contributor-article').hover(function(){ 312 $(this).find('.contriburor_image-hover').show(); 313 }, function(){ 314 $(this).find('.contriburor_image-hover').hide(); 315 }); 316 317 /* -------------------------------------------------- 318 COMMANTAIRES 319 -------------------------------------------------- */ 320 321 322 323 $('#commentform h3, #comment-inner h3').on('click', function(e){ 324 $('#commentform').toggleClass('opened'); 325 $('#comment-inner').toggleClass('opened'); 326 }); 327 328 /* -------------------------------------------------- 329 SLIDER SINGLE 330 -------------------------------------------------- */ 331 332 $('.single-slider-container').each(function(){ 333 334 var containerWidth = $(this).width(), 335 counterSlide = 1, 336 $singleSlider = $(this).find('.single-slider'), 337 $slides = $singleSlider.find('li'); 338 339 var nbSlides = $slides.length, 340 animation = false;
341 342 $singleSlider.find('li').first().addClass('current'); 343 344 $slides.width(containerWidth); 345 var slideWidth = $slides.width(); 346 347 $singleSlider.width((nbSlides * slideWidth)); 348 349 var timeOut; 350 function goSlide(direction, time){ 351 352 if(animation == false){ 353 animation = true; 354 355 window.clearTimeout(timeOut); 356 var time = time || 500; 357 var direction = direction || 'left'; 358 var currentSlide = $singleSlider.find('.current'), 359 nextSlide = currentSlide.next(); 360 361 var slideWidth = $slides.width(); 362 if(direction == 'right'){ 363 counterSlide--; 364 365 if(counterSlide < 1){ 366 counterSlide = nbSlides; 367 } 368 369 370 $singleSlider.find('.current .image-caption').animate({'opacity' : 0}, 200, function(){ 371 $singleSlider.find('li').last().prependTo($singleSlider); 372 $singleSlider.animate({'margin-left' : -slideWidth}, 0, function(){ 373 $singleSlider.animate({'margin-left' : '+='+slideWidth}, time, function(){ 374 currentSlide.prev().find('.image-caption').animate({'opacity' : 0}, 0); 375 currentSlide.prev().find('.image-caption').animate({'opacity' : 1},200); 376 timeOut = window.setTimeout(goSlide, 5000); 377 animation = false; 378 }); 379 }); 380 381 currentSlide.removeClass('current'); 382 currentSlide.prev().addClass('current'); 383 384 }); 385 }else if(direction == 'left'){ 386 counterSlide++; 387 388 if(counterSlide > nbSlides){ 389 counterSlide = 1; 390 } 391 392 $singleSlider.find('.current .image-caption').animate({'opacity' : 0}, 200, function(){ 393 nextSlide.find('.image-caption').animate({'opacity' : 0}, 0); 394 $singleSlider.animate({'margin-left' : '-='+slideWidth}, time, function(){ 395 nextSlide.find('.image-caption').animate({'opacity' : 1}, 200); 396 timeOut = window.setTimeout(goSlide, 5000); 397 $singleSlider.animate({'margin-left' : '0px'}, 0); 398 $singleSlider.append(currentSlide); 399 animation = false; 400 }); 401 }); 402 currentSlide.removeClass('current'); 403 nextSlide.addClass('current'); 404 }else{ 405 $singleSlider.animate({'margin-left' : '0px'}, time); 406 timeOut = window.setTimeout(goSlide, 5000); 407 counterSlide = 1; 408 } 409 $('.slider-counter span').html(counterSlide); 410 411 } 412 } 413 414 $('.slider-prev').on('click', function(e){ 415 e.preventDefault(); 416 window.clearTimeout(timeOut); 417 goSlide('right', 500); 418 }); 419 $('.slider-next').on('click', function(e){ 420 e.preventDefault(); 421 window.clearTimeout(timeOut); 422 goSlide('left', 500); 423 }); 424 425 timeOut = window.setTimeout(goSlide, 5000); 426 427 $('.playpause-controller').on('click', function(){ 428 if($(this).hasClass('pause')){ 429 $(this).removeClass('pause'); 430 $(this).addClass('play'); 431 window.clearTimeout(timeOut); 432 }else if($(this).hasClass('play')){ 433 $(this).removeClass('play'); 434 $(this).addClass('pause'); 435 timeOut = window.setTimeout(goSlide, 5000); 436 } 437 }); 438 439 }); 440 441 function sliderResize(event, windowWidth, windowHeight){ 442 443 var $sliderContainer = $('.single-slider-container'), 444 sliderContainerWidth = $sliderContainer.width(), 445 $singleSlider = $sliderContainer.find('.single-slider'), 446 $slide = $sliderContainer.find('li'); 447 448 var currentSlide = $sliderContainer.find('.slider-counter span').html(); 449 450 $slide.width(sliderContainerWidth); 451 $singleSlider.stop().animate({'margin-left' : '-' + (sliderContainerWidth * (currentSlide - 1))}, 100); 452 453 454 } 455 456 /* -------------------------------------------------- 457 458 CONTRIBUTORS FILTER 459 460 -------------------------------------------------- */ 461 462 function SortByName(a, b){ 463 var aName = a.name.toLowerCase(); 464 var bName = b.name.toLowerCase(); 465 return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); 466 } 467 468 function SortByDate(a, b){ 469 var aTimeStamp = new Date(a.date); 470 var bTimeStamp = new Date(b.date); 471 var aName = aTimeStamp.getTime(); 472 var bName = bTimeStamp.getTime(); 473 return ((aName > bName) ? -1 : ((aName < bName) ? 1 : 0)); 474 } 475 476 var filterPlay = false;
477 478 var $contributors = $('.contributor'), 479 $contributorsLayout = $('.contributor-list'); 480 481 var $photos = $('#photos .photo'), 482 $photosLayout = $('#photos .list'); 483 484 function doSort(elem, page){ 485 var filterValue = elem.val(); 486 487 if(!filterPlay){ 488 filterPlay = true; 489 490 if(page == 'contributor'){ 491 var ContrubutorsArray = []; 492 $contributors.each(function(){ 493 var contrubutorObject = { 494 name : $(this).data('name'), 495 date : $(this).data('date'), 496 item : $(this) 497 }; 498 ContrubutorsArray.push(contrubutorObject); 499 }); 500 501 if (filterValue == 1) { 502 ContrubutorsArray.sort(SortByName); 503 } else { 504 ContrubutorsArray.sort(SortByDate); 505 } 506 507 $contributors.remove(); 508 509 for(var i= 0; i < ContrubutorsArray.length; i++){ 510 $contributorsLayout.append(ContrubutorsArray[i].item); 511 } 512 513 $('.contributor').hover(function(){ 514 $(this).find('.contriburor_image-hover').show(); 515 }, function(){ 516 $(this).find('.contriburor_image-hover').hide(); 517 }); 518 } 519 if(page == 'photo'){ 520 521 var PhotosArray = []; 522 $photos.each(function(){ 523 var photoObject = { 524 name : $(this).find('.title').text(), 525 date : $(this).find('.small-pic-date').text(), 526 item : $(this) 527 }; 528 PhotosArray.push(photoObject); 529 }); 530 531 if (filterValue == 1) { 532 PhotosArray.sort(SortByDate); 533 } else { 534 PhotosArray.sort(SortByName); 535 } 536 537 $photos.remove(); 538 539 for(var i= 0; i < PhotosArray.length; i++){ 540 $photosLayout.append(PhotosArray[i].item); 541 } 542 543 $('.photo').hover(function(){ 544 $(this).find('.infos').show(); 545 }, function(){ 546 $(this).find('.infos').hide(); 547 }); 548 } 549 550 filterPlay = false; 551 } 552 } 553 554 $('input[name=contributor_filter]').on('change', function(){ 555 doSort($(this), 'contributor'); 556 }); 557 558 $('input[name=photo_filter]').on('change', function(){ 559 doSort($(this), 'photo'); 560 }); 561 562 doSort($('#filter-alphabetique'), 'contributor'); 563 564 565 /* -------------------------------------------------- 566 567 SLIDER DES PHOTO ET VIDEO. 568 569 -------------------------------------------------- */ 570 571 var $photoLargeContent = $('.photo-large'), 572 $imageLargeContainer = $('.image_large_container'), 573 $videoLargeContainer = $('.video_large_container'), 574 $imageCaption = $('.image-caption'), 575 $imageTitle = $('.image-title'), 576 $imagePostType = $('.page-infos a'), 577 $imagePostDate = $('.page-infos .date'), 578 $listImage = $('.list'), 579 $photolink = $('.image-article-link'); 580 581 $('#photos .list').on('click', 'a.photo', function(e){ 582 e.preventDefault(); 583 584 $('a.photo').removeClass('current-picture'); 585 $(this).addClass('current-picture'); 586 587 $photoLargeContent.animate({'opacity' : 0}, 500); 588 589 var idPicture = $(this).data('photoid'), 590 idPost = $(this).data('postid'), 591 imageTitle = $(this).find('.title').text(); 592 593 $.ajax({ 594 url : '/wp-admin/admin-ajax.php', 595 type : 'POST', 596 data: { 597 'action' : 'load_larger_picture', 598 'idPict':idPicture, 599 'idPost': idPost, 600 'imageTitle' : imageTitle 601 } 602 }).done(function( data ) { 603 var myObj = jQuery.parseJSON(data); 604 605 $imageLargeContainer.html(myObj.picture); 606 $imageCaption.html(myObj.pictureTitle); 607 $imageTitle.html(myObj.postTitle); 608 $imagePostType.html(myObj.postType); 609 $imagePostDate.html(myObj.postDate); 610 $photolink.attr('href', myObj.postlink); 611 612 $('body').scrollTo(0); 613 614 $photoLargeContent.slideDown(200, function(){ 615 $photoLargeContent.animate({'opacity' : 1}, 300); 616 }); 617 618 }); 619 }); 620 621 function photoSliderGo(direction, elem){ 622 var currentPicture = $listImage.find('.current-picture'); 623 var targetPicture; 624 625 if(direction == 'next'){ 626 targetPicture = currentPicture.next('.photo'); 627 }else if(direction == 'prev'){ 628 targetPicture = currentPicture.prev('.photo'); 629 } 630 631 if(targetPicture.length){ 632 $photoLargeContent.animate({'opacity' : 0}, 500); 633 634 if(!targetPicture.hasClass('video')){ 635 var idPicture = targetPicture.data('photoid'), 636 idPost = targetPicture.data('postid'), 637 imageTitle = targetPicture.find('.title').text(); 638 639 $.ajax({ 640 url : '/wp-admin/admin-ajax.php', 641 type : 'POST', 642 data: { 643 'action' : 'load_larger_picture', 644 'idPict':idPicture, 645 'idPost': idPost, 646 'imageTitle' : imageTitle 647 } 648 }).done(function( data ) { 649 var myObj = jQuery.parseJSON(data); 650 651 $imageLargeContainer.html(myObj.picture); 652 $imageCaption.html(myObj.pictureTitle); 653 $imageTitle.html(myObj.postTitle); 654 $imagePostType.html(myObj.postType); 655 $imagePostDate.html(myObj.postDate); 656 $photolink.attr('href', myObj.postlink); 657 658 $photoLargeContent.slideDown(200, function(){ 659 $photoLargeContent.animate({'opacity' : 1}, 300); 660 }); 661 662 currentPicture.removeClass('current-picture'); 663 targetPicture.addClass('current-picture'); 664 }); 665 }else if(targetPicture.hasClass('video')){ 666 var videoUrl = targetPicture.data('videourl'), 667 idPost = targetPicture.data('postid'), 668 imageTitle = targetPicture.find('.title').text(); 669 670 $.ajax({ 671 url : '/wp-admin/admin-ajax.php', 672 type : 'POST', 673 data: { 674 'action' : 'load_larger_video', 675 'videoUrl':videoUrl, 676 'idPost': idPost, 677 'imageTitle' : imageTitle 678 } 679 }).done(function( data ) { 680 var myObj = jQuery.parseJSON(data); 681 682 $videoLargeContainer.html(myObj.videoIframe); 683 $imageCaption.html(myObj.pictureTitle); 684 $imageTitle.html(myObj.postTitle); 685 $imagePostType.html(myObj.postType); 686 $imagePostDate.html(myObj.postDate); 687 $photolink.attr('href', myObj.postlink); 688 689 $photoLargeContent.slideDown(200, function(){ 690 $photoLargeContent.animate({'opacity' : 1}, 300); 691 }); 692 693 currentPicture.removeClass('current-picture'); 694 targetPicture.addClass('current-picture'); 695 696 }); 697 } 698 } 699 } 700 701 $('.controlers-photo .slider-prev').on('click', function(e){ 702 e.preventDefault(); 703 photoSliderGo('prev', $(this)); 704 }); 705 706 $('.controlers-photo .slider-next').on('click', function(e){ 707 e.preventDefault(); 708 photoSliderGo('next', $(this)); 709 }); 710 711 /* -------------------------------------------------- 712 ARCHIVE FILTER 713 -------------------------------------------------- */ 714 715 var $selector = $('.archive-select'), 716 $selectorType = $('.archive-select-type'), 717 $archiveList = $('.archive-list'), 718 $archivePushs = $archiveList.find('.archive-push'); 719 720 $selector.change(function(){ 721 var rub = $selector.val(), 722 type = $selectorType.val(); 723 filterArchive(rub, type); 724 }); 725 $selectorType.change(function(){ 726 var rub = $selector.val(), 727 type = $selectorType.val(); 728 filterArchive(rub, type); 729 }); 730 731 function filterArchive(rub, type){ 732 if(rub == 'all' && type == 'all'){ 733 $archiveList.find('.archive-push').show(); 734 }else{ 735 $archiveList.find('.archive-push').hide(); 736 if(rub != 'all' && type == 'all'){ 737 $archiveList.find('.'+rub).show(); 738 }else if(rub == 'all' && type != 'all'){ 739 $archiveList.find('.'+type).show(); 740 }else{ 741 $archivePushs.each(function(){ 742 if($(this).hasClass(rub) && $(this).hasClass(type)){ 743 $(this).show(); 744 } 745 }); 746 } 747 } 748 } 749 750 751 /* -------------------------------------------------- 752 753 V2 754 755 -------------------------------------------------- */ 756 757 /* -------------------------------------------------- 758 759 HOME SLIDER 760 761-------------------------------------------------- */ 762 763 var $homeSlider = $('.slider-container'), 764 $homeSlides = $homeSlider.find('.slide'), 765 $homeSliderControlsContainer = $homeSlider.find('.slide-control'), 766 $homeSliderControls = $homeSliderControlsContainer.find('li'); 767 768 $homeSlides.first().addClass('current-slide'); 769 $homeSliderControls.first().addClass('current'); 770 771 var SlideIndex = $homeSlides.first().index(); 772 var sliderLength = $homeSlides.length; 773//var currentIndex = $homeSlider.find('.current-slide').index(); 774 775 function goSlide(index){ 776 777 var NexSlide = $homeSlider.find('.slide').eq(index), 778 NextControl = $homeSliderControls.eq(index); 779 780 NexSlide.css({'z-index': '4'}); 781 $homeSlider.find('.current-slide').fadeOut(600, function(){ 782 $(this).removeClass('current-slide').show(); 783 $homeSliderControlsContainer.find('.current').removeClass('current'); 784 NextControl.addClass('current'); 785 NexSlide.addClass('current-slide'); 786 NexSlide.css({'z-index': '3'}); 787 }); 788 789 if((index + 1) > (sliderLength-1)){ 790 SlideIndex = 0; 791 }else { 792 SlideIndex = index+1; 793 } 794 795 796 timeoutHome = window.setTimeout(function() {goSlide(SlideIndex);}, 5000); 797 798 } 799 800 var timeoutHome = window.setTimeout(function() {goSlide(SlideIndex + 1);}, 5000); 801 802 $('.slide-infos a').hover(function(){ 803 window.clearTimeout(timeoutHome); 804 }, function(){ 805 timeoutHome = window.setTimeout(function() {goSlide(SlideIndex);}, 5000); 806 }); 807 808 809 $homeSliderControls.on('click', function(e){ 810 e.preventDefault(); 811 if(!$(this).hasClass('current')){ 812 var clickedIndex = $(this).index(); 813 window.clearTimeout(timeoutHome); 814 goSlide(clickedIndex); 815 } 816 }); 817 818 $homeSlides.hover(function(){ 819 window.clearTimeout(timeoutHome); 820 }, function(){ 821 timeoutHome = window.setTimeout(function() {goSlide(SlideIndex);}, 5000); 822 }); 823 824 825 826 827 828 /* -------------------------------------------------- 829 GESTION DE CURRENT DU MENU 830 -------------------------------------------------- */ 831 832 if (typeof currentMenuCategory != 'undefined') { 833 $('.menu').find('.'+currentMenuCategory).addClass('current-menu-item'); 834 } 835 836 /*$('.comment-respond').parents('#commentform').addClass('opened'); 837 838 if($('#commentform').hasClass('opened')){ 839 $('#comment-inner').addClass('opened'); 840 }*/ 841 842 843 /* -------------------------------------------------- 844 GESTION PAGE CONTRIBUTEURS 845 -------------------------------------------------- */ 846 847 /* var $contributorList = $('.contributor-list'), 848 $contributors = $contributorList.find('.contributor'), 849 $contributorDesc = $('.contributors-desc'); 850 851 var contributorUrl, contributorId; 852 853 function createPush(link, title, type, image, date, excerpt, container){ 854 var push = '<a class="push push-small" href="'+link+'">'; 855 push += '<span class="push-wrap">'; 856 push += image; 857 push += '<span class="push-info">'; 858 push += '<span class="push-type">'+type+'</span>'; 859 push += '<span class="push-date">'+date+'</span>'; 860 push += '</span>'; 861 push += '<h2><em>'+title+'</em></h2>'; 862 push += '<p>'+excerpt+'</p>'; 863 push += '<span class="push_link">Suite</span>'; 864 push += '</span>'; 865 push += '</a>'; 866 867 container.append(push); 868 } 869 870 $contributorList.on('click', '.contributor', function(e){ 871 e.preventDefault(); 872 873 $contributors.removeClass('active'); 874 $(this).addClass('active'); 875 876 contributorUrl = $(this).attr('href'); 877 contributorId = $(this).data('postid'); 878 console.log(contributorId); 879 880 $.ajax({
881 url : 'http://localhost.sn.com/wp-admin/admin-ajax.php', 882 type : 'POST', 883 data: { 884 'action' : 'load_contributor_content', 885 'postId':contributorId 886 } 887 }).done(function( data ) { 888 data = $.parseJSON(data); 889 console.log(data); 890 $contributorDesc.html(data.content); 891 892 var related = data.related 893 relatedLength = related.length; 894 console.log(relatedLength); 895 if(relatedLength){ 896 for(i=0; i < relatedLength; i++){ 897 898 var relatedLink = related[i].permalink, 899 relatedTitle = related[i].title, 900 relatedType = related[i].type, 901 relatedDate = related[i].date, 902 relatedImage = related[i].image, 903 relatedExcerpt = related[i].excerpt; 904 905 createPush(relatedLink, relatedTitle, relatedType, relatedImage, relatedDate, relatedExcerpt, $contributorDesc); 906 907 } 908 } 909 910 }); 911 });*/ 912 913 /* -------------------------------------------------- 914 915 PAGINATION 916 917 -------------------------------------------------- */ 918 919 /*var $main = $('main.wrap'); 920 var $list = $main.find('.article-list'); 921 var $pagi = $main.find('.pagination'); 922 923 if (!$list.length || !$pagi.length) return; 924 925 var $win = $(window); 926 var $load = null; 927 var $loading = $('<div class="page-loading">'); 928 929 function initListeners() { 930 $main.find('.pagination .next a').click(clickHandler); 931 } 932 933 function clickHandler(event) { 934 event.preventDefault(); 935 if (!$load) loadPage($(this).attr('href')); 936 } 937 938 function loadPage(url) { 939 $load = $('<div>').load(url + ' #main', loadPage_completeHandler); 940 $pagi.replaceWith($loading); 941 } 942 943 function loadPage_completeHandler() { 944 var $newItems = $load.find('.article-list .project-wrap'); 945 var $newPagi = $load.find('.pagination'); 946 947 // supprime le bouton précédent 948 $newPagi.find('.prev').remove(); 949 950 $list.append($newItems); 951 952 $newItems.filter(':nth-child(2n+1)').addClass('firstOf2'); 953 $newItems.filter(':nth-child(3n+1)').addClass('firstOf3'); 954 $newItems.filter(':nth-child(4n+1)').addClass('firstOf4'); 955 956 $loading.replaceWith($newPagi); 957 958 initListeners(); 959 960 $load = null; 961 $pagi = $newPagi; 962 963 scrollHandler(); 964 } 965 966 function scrollHandler(event) { 967 $pagi 968 && $win.scrollTop() + $win.height() >= $pagi.offset().top - 50 969 && $pagi.find('.next a').click(); 970 } 971 972 initListeners(); 973 $win.on('load scroll', scrollHandler);*/ 974 975 976});
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.