1/* PRINCIPES DU FONTIONS SITE 2 - toutes les instructions habituelles doiventa ller dans site_init(); 3 - les instructions liées à smoothstate doivent s'initialiser dans site_onPageLoad() 4 - pour le chgt de page en AJAX, caler des update / restart dans le site_onAjaxLoad 5 */ 6 7/*// DEMARRAGE ///////////////////////////////*/ 8$.jgo.prm = { 9 defaultActiveClass : 'active', 10 replaceSVGtoPNG : true, 11 aspireSVG : true, 12 handleIframeWmode : true, 13 watchScroll : true, 14 scrollPoint : $('header').height() 15}; 16 17$(document).ready(function(){ 18 $.jgo.init(); 19 site_init(); 20 //POUR ACTIVER LE DPE EN POPUP DECOMMENTER LA LIGNE 21 // $('#dpe').jalisDpe(); 22 23}); 24 25$(window).on( "load", site_onPageLoad); 26 27 28/*// INITIALISATION /////////////////////////////// 29 -> tous les codes qui s'executent au demarrage 30 */ 31 32 33 34function site_init(){ 35 36 //img lazy 37 $.site.imgLazy = new $.jgo.lazyloaderAll(); 38 $(window).scrollEnd(function(){ 39 $.site.imgLazy.load(); 40 }, 10); 41 42 $('body').addClass('ready'); 43 // cas ios7 44 if (is_iOs()) { $('html').addClass('badios');} 45 46 47 48 /*///// CODE JQUERY HORS JGO*////// 49 50 /* AJOUTE UNE CLASSE is-scrolled au header quand le menu est scrollé (mobile) */ 51 $('nav.nav > ul').on('scroll', function(e){ 52 if ($('nav.nav > ul').scrollTop() > 0){ 53 $('header').addClass('is-scrolled'); 54 }else{ 55 $('header').removeClass('is-scrolled'); 56 } 57 }); 58 59 60 61 /* AJOUTE OU ENLEVE une classe au body selon si le menu doit apparaitre ou non */ 62 $('input[name="ouvre-menu"]').off('change'); 63 $('input[name="ouvre-menu"]').on('change', function(e){ 64 var inp = $(this); 65 if(inp.prop('checked') == true){ 66 $('body').addClass('menu-active'); 67 }else{ 68 $('body').removeClass('menu-active'); 69 } 70 }); 71 72 // scrolle la fenetre toujours en bas de page quand on altère le checkbox du pdp (bug sous EDGE : le site remonte en haut dès qu'on clique) 73 $('input[name="ouvre-footer"]').off('change'); 74 $('input[name="ouvre-footer"]').on('change', function(e){ 75 $('html, body').scrollTop($(document).height()); 76 }); 77 78 //retrait de l'intro une fois le scroll fait 79 if ($('body').hasClass('accueil')) { 80 $(window).scroll(function () { 81 if ($(window).scrollTop() >= $(window).height() && $.jgo.elementExiste('.intro')) { 82 $('.intro').remove(); 83 $('body, html').scrollTop(0); 84 $.jgo.prm.scrollPoint = $('nav.nav').offset().top; 85 } 86 }); 87 } 88 89 90 91 if ($.jgo.elementExiste('#delete_sort')) { 92 $([document.documentElement, document.body]).animate( { 93 scrollTop: $("#delete_sort").offset().top - 200}, 500); 94 } 95 96 97 98 // rajoute un flex end quand il n'y a qu'un enfant dans la pagination 99 /*$('.bts--flex.pagination').each(function(){ 100 var bloc = $(this); 101 if(bloc.children('*').length == 1 && bloc.children('.pagination').length == 1){ 102 bloc.children('*').addClass('margin-auto-left'); 103 } 104 });*/ 105 106 107 108 109 /*///// CODE SLICK /////*/ 110 $('.diaporama, .diaporama--accueil, .diaporama--laius, .diaporama--intro, .diaporama--fond').slick({ 111 dots: false, 112 lazyLoad: 'ondemand', // a décommenter pour gagner en perf 113 infinite: false, 114 arrows: false, 115 speed: 700, 116 fade: true, 117 cssEase: 'linear', 118 autoplay: true, 119 autoplaySpeed: 5000 120 }); 121 122 if ($.jgo.elementExiste('.diaporama--fiche')) { 123 124 $(".diaporama--fiche").slick({ 125 /*pauseOnHover:true,*/ 126 lazyLoad: 'ondemand', 127 dots: false, 128 infinite: true, 129 arrows: false, 130 speed: 700, 131 fade: true, 132 cssEase: 'linear', 133 autoplay: true, // a commenter pour avoir une transition horizontal 134 autoplaySpeed: 5000, 135 136 responsive: [ //ici on customise le responsive du diaporama--fiche en vesion mobile tactile ;) 137 { 138 breakpoint: 640, 139 settings: { 140 centerMode: true, 141 centerPadding: '60px', 142 arrows: false, 143 fade: false, 144 autoplay:false, 145 slidesToShow: 1, 146 speed: 300, 147 adaptiveHeight: true 148 } 149 } 150 ] 151 152 153 }); 154 155 } 156 157 if ($.jgo.elementExiste('.slideshow')) { 158 159 $(".slideshow").slick({ 160 lazyLoad: 'anticipated', // ondemand progressive anticipated 161 infinite: false, 162 arrows: true, 163 autoplay:true, 164 autoplaySpeed: 6000, 165 pauseOnHover:true, 166 167 responsive: [ 168 { 169 breakpoint: 600, 170 settings: { 171 adaptiveHeight: true 172 } 173 } 174 ] 175 176 177 }); 178 179 } 180 181 /*///// CODE PLUGINS ///// 182 -> plugins = nouveaux blocs de jgo rendus independants 183 tu peux les appeller au besoin dans n'importe quelle situtation 184 */ 185 186 /*fourrage en background-image d'un img 187 ------------ 188 *: n'execute pas le code si on met la classe no-js a un img--back*/ 189 190 if(! Modernizr.objectfit){ 191 $.site.imgback = $('*[class*="img--back"], .slick-slide > div ').jalisImgBack(); 192 }else{ 193 //il faut imperativement traiter le img--back avant le .slide 194 $.site.imgback = $('*[class*="img--back"]:not(.no-js)').jalisImgBack(); 195 196 } 197 198 199 // VSY -> ajoute ( et peut enlever ) une classe quand un element arrive à l'écran 200 201 202 var controller = new ScrollMagic.Controller(); 203 $( ".vsy" ).each(function() { 204 var jalisInView = new ScrollMagic.Scene({ 205 triggerElement: this, 206 triggerHook: 1.1, 207 duration:'100%', 208 }) 209 .setClassToggle(this, "view-on") 210 .addTo(controller) 211 .reverse(false); // true pour toggle la class 212 }); 213 214 215 216 // clic & scroll (ancien goclic) 217 $.site.scrollto = $('.go').jalisScrollTo(); 218 219 220 // zoom quand survol 221 $.site.zoom = $('.zoom').jalisZoom({zoomCssClass: 'fiche-img-cover' }); 222 223 224 //sticky
225 $.site.sticky = $('.sticky').jalisSticky({ 226 topModulator: function () { 227 return $('body.scrolled header').outerHeight(true) + 100; 228 } 229 }); 230 231 232 // liens miniatures / img 233 $('.grille-images .miniatures *[class*="img"]').mouseover(function (e) { 234 $('.fiche-img img, .fiche-img > .zoom > img').attr('src', $(e.target).attr('href')); 235 $('.fiche-img .zoom').attr('href', $(e.target).attr('href')); 236 $('.zoom > img').attr('style', 'opacity:1'); 237 238 try { 239 $.site.zoom.update() 240 } catch (e) {} 241 }); 242 243 244 $('body *[class^="miniatures"] *[class*="img--back"]').mouseover(function (e) { 245 var slideIndex = $(e.target).index(); 246 /*console.log(slideIndex );*/ 247 $('.diaporame--fiche').slick('slickGoTo', slideIndex, true); 248 }); 249 250 $( ".click" ).click(function(){ 251 $('.cnt').toggleClass('ouvre'); 252 $('.shut').toggleClass('show'); 253 }); 254 255 $( ".plan--premier" ).click(function(){ 256 $('.cnt').removeClass('ouvre'); 257 $('.shut').removeClass('show'); 258 }); 259 260 261 site_retrocomp(); 262 263 deleteNoScriptTag(); 264 265 266 267 268 269} 270 271 272 273/*// LOAD /////////////////////////////// 274 -> tous les codes qui s'executent lors du load du DOM 275 */ 276 277function site_onPageLoad(){ 278 $('body').addClass('loaded'); 279 // SI TU ES UN GUEDIN : 280 //smoothStateInit(); 281} 282 283 284 285/*// AJAX /////////////////////////////// 286 -> ici les instructions à placer quand un site est rafraichi par l'ajax 287 */ 288function site_onAjaxLoad(){ 289 tryRefresh($.site.imgback.update, 'img back update'); 290} 291 292 293 294 295 296 297 298 299/*// RETROCOMPATIBILITE //////////////////////////////*/ 300function site_retrocomp(){ 301 //RETROCOMPATIBILITE POUR LES VH 302 if (!Modernizr.cssvhunit || is_iOs()) { 303 //récupération des variables scss de la conf 304 var fit_perfect_gap = 48; 305 var header_height = $('header').height(); 306 var header_height_scroll = $('body.scrolled header').height(); 307 var header_height_mobile = $('header').height(); 308 309 var resp = [ 310 {'nom':'', 'taille':0}, 311 {'nom':'-xs', 'taille':480}, 312 {'nom':'-s', 'taille':640}, 313 {'nom':'-m', 'taille':800}, 314 {'nom':'-l', 'taille':1024}, 315 {'nom':'-xl', 'taille':1280} 316 ]; 317 318 function vhRetroComp(){ 319 for (var i in resp){ 320 if($(window).width() > resp[i].taille){ 321 $(".fit-y"+resp[i].nom+", .height-100vh"+resp[i].nom).attr('style', $(".fit-y"+resp[i].nom).attr('style')+'; height:'+($(window).height())+'px !important;'); 322 $(".fit-y-perfect"+resp[i].nom).attr('style', $(".fit-y-perfect"+resp[i].nom).attr('style')+'; height:'+ ($(window).height() - fit_perfect_gap)+'px !important;'); 323 $(".fit-y-perfect-header"+resp[i].nom).attr('style', $(".fit-y-perfect-header"+resp[i].nom).attr('style')+'; height:'+ ($(window).height() - (fit_perfect_gap + header_height))+'px !important;'); 324 $(".fit-y-min"+resp[i].nom).attr('style', $(".fit-y-min"+resp[i].nom).attr('style')+'; min-height:'+ ($(window).height())+'px !important;'); 325 $(".fit-y-min-perfect"+resp[i].nom).attr('style', $(".fit-y-min-perfect"+resp[i].no).attr('style')+'; min-height:'+ ($(window).height() - fit_perfect_gap)+'px !important;'); 326 $(".fit-y-min-perfect-header"+resp[i].nom).attr('style', $(".fit-y-min-perfect-header"+resp[i].nom).attr('style')+'; min-height:'+ ($(window).height() - (fit_perfect_gap + header_height))+'px !important;'); 327 $(".fit-y-min-perfect-header-mobile"+resp[i].nom).attr('style', $(".fit-y-min-perfect-header-mobile"+resp[i].nom).attr('style')+'; min-height:'+ ($(window).height() - (header_height_mobile))+'px !important;'); 328 $(".fit-y-min-perfect-header-scroll"+resp[i].nom).attr('style', $(".fit-y-min-perfect-header-scroll"+resp[i].nom).attr('style')+'; min-height:'+ ($(window).height() - (header_height_scroll))+'px !important;'); 329 } 330 331 } 332 } 333 334 vhRetroComp(); 335 $(window).resize(function(){ 336 vhRetroComp(); 337 }); 338 339 } 340 341} 342 343 344 345 346 347 348 349 350/*===== FONCTIONS EXTERNES CAPTAIN 6.0 =====*/ 351 352//execute dans un try les methodes update puis restart (utile pour l'ajax) 353function tryRefresh(fn, msg){ 354 try{ 355 fn(); 356 }catch(e){ 357 console.log('REFRESH ERR. : '+msg+' - '+e); 358 } 359} 360 361// determine si ios7 362function is_iOs() { 363 return navigator.userAgent.match('Version/7.0'); 364} 365 366 367 368/*===== PLUGINS JALIS CAPTAIN 6.0 =====*/ 369(function ($) { 370 /** JALIS SCROLLTO 1.0 CAPTAIN 371 * Scroll vers un point determine quand on clic sur un autre 372 * ex : <div class="go" data-go="#contact">contact</div> 373 * rajouter data-go-origin="top|middle|bottom" pour lui dire ou placer le piont visé dans la page (middle par defaut) 374 * rajouter $(jQueryObject).jalisScrollTo(); dans le ready pour activer 375 * @param {String} scrollzone element ou s'applique le scroll ['html, body'] 376 * @param {String} anim_duration durée de l'animation 377 */ 378 $.fn.jalisScrollTo = function(options){ 379 380 function setListener(){ 381 elems.each(function(){ 382 var obj = $(this); 383 unset_listener(obj); 384 385 obj.on("click", function (e) { 386 var desc = $(obj.attr('data-go')); 387 var origin = obj.attr('data-go-origin');
388 var shift = obj.attr('data-go-shift'); 389 desc = $(obj.attr('data-go')); 390 e.preventDefault(); 391 var h; 392 if (obj.attr('data-go') == "top") { 393 h = 0; 394 } else { 395 396 var pos = desc.offset().top - $(prm.scrollzone).offset().top; 397 398 if (prm.scrollzone != 'html, body') { 399 pos += $(prm.scrollzone).scrollTop(); 400 } 401 402 if (desc.outerHeight() > ($(window).height() * 0.8)) { 403 h = pos - ($(window).height() / 2); 404 } else { 405 h = pos - (($(window).height() - desc.innerHeight()) / 2); 406 } 407 if (origin != undefined) { 408 if (origin == "top") { 409 h = pos; 410 } else if (origin == "bottom") { 411 h = pos - (desc.offset().top - desc.innerHeight()); 412 } 413 } 414 415 if (shift != undefined) { 416 h -= parseFloat(shift); 417 } 418 } 419 $(prm.scrollzone).animate({ 420 scrollTop: h 421 }, { 422 queue: false, 423 duration: prm.anim_duration 424 }); 425 }); 426 }); 427 } 428 429 function unset_listener(item){ 430 item.off('click'); 431 } 432 433 434 435 436 var defaults = { 437 scrollzone: 'html, body', 438 anim_duration: 750 439 } 440 441 var elems = this; 442 var selector = this.selector; 443 var prm = $.extend(defaults, options); 444 this.prm = prm; 445 446 447 this.init = function(){ 448 setListener(); 449 } 450 451 this.update = function(){ 452 //check le nb d'elements 453 if (elems.length != $(selector).length) { 454 elems = $(selector); 455 setListener(); 456 } 457 } 458 459 this.kill = function(){ 460 unset_listener(elems); 461 } 462 463 this.init(); 464 465 return this; 466 } 467 468 469 470 /* 471 JALISZOOM 1.0 CAPTAIN 472 */ 473 $.fn.jalisZoom = function (options) { 474 475 var elems = this.each(function () { 476 477 var defaults = { 478 imgSelector: 'img', 479 zoomCssClass: 'fiche-image-cover', 480 autoupdate: true 481 } 482 483 var prm = $.extend(defaults, options); 484 485 var container = $(this); 486 var img = $(this).find(prm.imgSelector); 487 var frontCover; 488 489 init(); 490 491 function init() { 492 frontCover = "<span class='" + prm.zoomCssClass + "' style='background-image:url(" + img.attr('src') + ");'></span>"; 493 container.append(frontCover); 494 setMouseEnter(); 495 } 496 497 498 function onMouseMove(e) { 499 var offset = container.offset(); 500 var sizes = { 501 width: container.width(), 502 height: container.height() 503 } 504 var mousePos = { 505 top: e.pageY - offset.top, 506 left: e.pageX - offset.left 507 } 508 509 var ratios = { 510 top: (mousePos.top / sizes.height) * 100, 511 left: (mousePos.left / sizes.width) * 100 512 } 513 514 container.find('.' + prm.zoomCssClass).css('background-position', ratios.left + '% ' + ratios.top + '%'); 515 } 516 517 function onMouseEnter(e) { 518 unsetMouseEnter(); 519 if (prm.autoupdate) { 520 update(); 521 } 522 setMouseLeave(); 523 setMouseMove(); 524 } 525 526 function onMouseLeave(e) { 527 unsetMouseLeave(); 528 unsetMouseMove(); 529 setMouseEnter(); 530 } 531 532 533 function setMouseEnter() { 534 container.on('mouseenter', onMouseEnter); 535 } 536 537 function unsetMouseEnter() { 538 container.off('mouseenter', onMouseEnter); 539 } 540 541 542 function setMouseLeave() { 543 container.on('mouseleave', onMouseLeave); 544 } 545 546 function unsetMouseLeave() { 547 container.off('mouseleave', onMouseLeave); 548 } 549 550 551 function setMouseMove() { 552 container.on('mousemove', onMouseMove); 553 } 554 555 function unsetMouseMove() { 556 container.off('mousemove', onMouseMove); 557 } 558 559
560 function update() { 561 var cover = container.find('.' + prm.zoomCssClass); 562 var img = container.find(prm.imgSelector); 563 if (!cover.css('background-image').match(img.attr('src'))) { 564 cover.css('background-image', "url(" + img.attr('src')); 565 } 566 } 567 568 569 570 571 572 573 574 this.update = update; 575 576 this.stop = function () { 577 unsetMouseEnter(); 578 unsetMouseLeave(); 579 unsetMouseMove(); 580 $('.' + prm.zoomCssClass).remove(); 581 } 582 583 this.reset = function () { 584 this.stop(); 585 init(); 586 } 587 588 return this; 589 590 }); 591 592 this.update = function () { 593 for (var i = 0; i < elems.length; i++) { 594 $(elems[i])[0].update(); 595 } 596 } 597 598 return this; 599 600 601 } 602 603 604 605 606 607 /* 608 JALISSTICKY 1.0 CAPTAIN 609 */ 610 $.fn.jalisSticky = function (options) { 611 var stickies = []; 612 this.each(function () { 613 var defaults = { 614 cssClass: 'sticked', 615 topModulator: function () { 616 return 0; 617 }, 618 onStick: function () { 619 void(0); 620 }, 621 onUnStick: function () { 622 void(0); 623 }, 624 eventType: 'scroll', 625 debug: false 626 } 627 628 var prm = $.extend(defaults, options); 629 630 var obj = $(this); 631 var win = $(window); 632 var initialTop = obj.css('top'); 633 var initialTopValue = (initialTop == "auto" || initialTop == "inherit" || initialTop == undefined) ? 0 : parseInt(initialTop); 634 var windowHeiht, scrolltop, offsetTop, objHeight, debord; 635 636 init(); 637 638 function init() { 639 scrolltop = $(win).scrollTop(); 640 offsetTop = obj.offset().top; 641 updateValues(); 642 offsetTop -= debord.size; 643 win.on(prm.eventType, update); 644 if (prm.debug) console.log('jalis sticky init'); 645 update(); 646 } 647 648 function updateValues() { 649 winHeight = win.height(); 650 scrolltop = win.scrollTop(); 651 objHeight = obj.outerHeight(true); 652 debord = getDebord(); 653 } 654 655 function getDebord() { 656 var ret = { 657 is: false, 658 size: 0 659 }; 660 if (objHeight + offsetTop > winHeight) { 661 ret.is = true; 662 ret.size = winHeight - (objHeight + offsetTop); 663 if( ret.size < 0 ) ret.size = 0; 664 } 665 return ret; 666 } 667 668 669 function update() { 670 updateValues(); 671 var local_offsetTop = offsetTop - prm.topModulator(); 672 if (scrolltop > local_offsetTop && objHeight < obj.parent().innerHeight()) { 673 674 var top = (scrolltop - local_offsetTop) + initialTopValue; 675 676 if (top + objHeight > obj.parent().innerHeight()) { 677 top = obj.parent().innerHeight() - objHeight; 678 } 679 680 if ($(obj.find('.' + prm.cssClass)).length > 0) { 681 $(obj.find('.' + prm.cssClass)).each(function () { 682 $(this).attr('jalissticky-data', top); 683 }); 684 } 685 686 if (obj.attr('jalissticky-data') != undefined) { 687 top = top - parseInt(obj.attr('jalissticky-data')); 688 } 689 690 obj.css('top', top).addClass(prm.cssClass); 691 692 if (prm.debug) { 693 console.log('Element :'); 694 console.log(obj); 695 console.log('***'); 696 console.log('offsetTop : ' + offsetTop); 697 console.log('scrolltop : ' + scrolltop); 698 console.log('localoffsetTop : ' + local_offsetTop); 699 console.log('initialTop : ' + initialTop
699); 700 console.log('initialTopValue : ' + initialTopValue); 701 console.log('top : ' + top); 702 console.log('----------------'); 703 } 704 } else { 705 obj.css('top', initialTop).removeClass(prm.cssClass); 706 if ($(obj.find('.' + prm.cssClass)).length > 0) { 707 $(obj.find('.' + prm.cssClass)).each(function () { 708 $(this).removeAttr('jalissticky-data'); 709 }); 710 } 711 if (prm.debug) { 712 console.log('Unsticked Element :'); 713 console.log(obj); 714 console.log('----------------'); 715 } 716 } 717 } 718 719 this.update = update; 720 721 722 this.kill = function () { 723 win.off(prm.eventType, update); 724 } 725 726 stickies.push(this); 727 728 }); 729 730 this.stickies = stickies; 731 732 this.update = function(){ 733 for (var i in stickies){ 734 stickies[i].update(); 735 } 736 } 737 738 return this; 739 740 } 741 742 743 744 745 /*JALIS IMG BACK 1.0 CAPTAIN 746 pushes <img>'s src to background-image 747 */ 748 $.fn.jalisImgBack = function (options) { 749 750 var defaults = { 751 bgSize: 'cover', 752 bgPos: 'center center', 753 bgRpt: 'no-repeat' 754 } 755 756 var prm = $.extend(defaults, options); 757 var elems = this; 758 var selector = this.selector; 759 760 set(); 761 762 /* look for a direct child img tag inside the selector, 763 * put the src attribute as inline background-image, 764 * removes the img tag 765 */ 766 function set() { 767 //parcours les images 768 elems.each(function () { 769 var img = $(this).find('img'); 770 img = img[0]; 771 772 if ( img === undefined) { 773 return; 774 } 775 //si le src de l'image est défini 776 var src = img.getAttribute('src'); 777 //si le data-src est rempli pour le chargement différé des images lazyload 778 if (typeof src === 'undefined' || src == null) { 779 var src = img.getAttribute('data-src'); 780 } 781 782 //si le data-src-slide est rempli pour le chargement différé des sliders 783 var dataSrcSlide = img.getAttribute('data-src-slide'); 784 785 if (typeof src !== 'undefined' && src != null) { 786 src = src.replace(new RegExp(' ', "gi"), '%20'); 787 $(this).css({ 788 'background-image': 'url("' + src + '")', 789 'background-size': prm.bgSize, 790 //'background-size': 'cover cover', 791 'background-position': prm.bgPos, 792 'background-repeat': prm.bgRpt 793 }); 794 img.remove(); 795 796 } 797 798 if ( typeof dataSrcSlide !== 'undefined' && dataSrcSlide != null) { 799 dataSrcSlide = dataSrcSlide.replace(new RegExp(' ', "gi"), '%20'); 800 $(this).css({ 801 'background-image': 'url("' + dataSrcSlide + '")', 802 'background-size': prm.bgSize, 803 //'background-size': 'cover cover', 804 'background-position': prm.bgPos, 805 'background-repeat': prm.bgRpt 806 }); 807 img.remove(); 808 } 809 }); 810 } 811 /*function set() { 812 elems.each(function () { 813 var img = $(this).children('img'); 814 var src = img.attr('src'); 815 if (src != undefined) { 816 src = src.replace(new RegExp(' ', "gi"), '%20'); 817 img.remove(); 818 $(this).css({ 819 'background-image': 'url("' + src + '")', 820 'background-size': prm.bgSize, 821 'background-position': prm.bgPos, 822 'background-repeat': prm.bgRpt 823 }); 824 } 825 }); 826 }*/ 827 828 /* reverses the process by retrieving the img url, 829 * adding it to a new child img tag with the parsed src, 830 * removes inline style 831 */ 832 function unset() { 833 elems.each(function () { 834 var obj = $(this); 835 var src = obj.css('background-image').slice(4, -1); // removes url() 836 837 //parse url in case of quotes inside the url 838 if (src.substring(0, 1) == '"' || src.substring(0, 1) == "'") { 839 src = src.substring(1); 840 } 841 842 if (src.slice(-1) == '"' || src.slice(-1) == "'") { 843 src = src.slice(0, -1); 844 } 845 846 if (src != undefined) { 847 var img = "<img src='" + src + "' />"; 848 obj.append(img); 849 obj.css({ 850 'background-image': 'none', 851 'background-size': 'inherit', 852 'background-position': 'inherit', 853 'background-repeat': 'inherit' 854 }); 855 } 856 }); 857 } 858 859 // updates the list of container, in case you would like to use AJAX ;) 860 this.update = function () { 861 if (elems.length != $(selector).length) { 862 elems = $(selector); 863 } 864 set(); 865 return elems; 866 } 867 868 this.reset = function () { 869 unset(); 870 return elems; 871 } 872 873 this.restart = function () { 874 unset(); 875 this.update(); 876 set(); 877 } 878 879 return this; 880 881 } 882 883 /** 884 * methode qui permet un declenchement après un timeout sur la fin d'un scroll 885 * @param callback l'action a declenché 886 * @param timeout le de pause de scroll qu'il faut pour que l'action se déclenche 887 */ 888 $.fn.scrollEnd = function(callback, timeout) { 889 $(this).scroll(function(){ 890 var $this = $(this); 891 if ($this.data('scrollTimeout')) { 892 clearTimeout($this.data('scrollTimeout')); 893 } 894 $this.data('scrollTimeout', setTimeout(callback,timeout)); 895 }); 896 }; 897 898})(jQuery); 899 900 901 902 903 904 905/*===== SMOOTHSTATE =====*/ 906function smoothStateInit(){ 907 $(function(){ 908 var body = $('html, body'); 909 var options = { 910 prefetch: true, 911 cacheLength: 3, 912 scroll:false, 913 blacklist: '*[href*="contact"], *[rel="fiche"], .gallery, *[href*="fiche_imprimer"], *[href*="estimation"]', 914 onBefore : function(){ 915 916 }, 917 onStart: { 918 duration: 300, // Duration of our animation 919 render: function ($container) { 920 // Add your CSS animation reversing class 921 $container.addClass('is-exiting'); 922 body.removeClass('menu-active'); 923 } 924 }, 925 onReady: { 926 duration: 0, 927 render: function ($container, $newContent) { 928 $(window).scrollTop(0); 929 $('body').addClass('smoothstate-enabled'); 930 // Remove your CSS animation reversing class 931 $container.removeClass('is-exiting'); 932 933 // Inject the new content 934 $container.html($newContent); 935 936 //appel 937 site_onAjaxLoad(); 938 939 } 940 } 941 }; 942 943 $.site.smoothStateInstance = $('.plan--premier').smoothState(options).data('smoothState'); 944 }); 945} 946 947 948 949 950 951 952/*===== DELETE <noscript> =====*/ 953function deleteNoScriptTag() { 954 var noscript = document.getElementsByTagName('noscript'); 955 var om =noscript.length - 1; 956 for( om; om >=0; om-- ) { 957 noscript[om].parentNode.removeChild(noscript[om]); 958 } 959}
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.