1 /** 2/ * SMOOOTH SCROLL 3 */ 4 5let smoothscroll; 6const ease = 0.1; 7const body = document.body; 8 9{ 10 11 function offset(el) { 12 var rect = el.getBoundingClientRect(), 13 scrollTop = window.pageYOffset || document.documentElement.scrollTop; 14 return rect.top + scrollTop; 15 } 16 17 function smoothScrollFunction() { 18 19 20 if ( $(window).innerWidth() > 1024 ) { 21 // ----------------------------------------------------------------------------------------- 22 23 const sticky = document.querySelector('.sticky'), 24 parent = document.querySelector('.sticky-parent'); 25 26 // helper functions 27 const MathUtils = { 28 // map number x from range [a, b] to [c, d] 29 map: (x, a, b, c, d) => (x - a) * (d - c) / (b - a) + c, 30 // linear interpolation 31 lerp: (a, b, n) => (1 - n) * a + n * b, 32 }; 33 // calculate the viewport size 34 let winsize; 35 const calcWinsize = () => winsize = { width: window.innerWidth, height: window.innerHeight }; 36 calcWinsize(); 37 // and recalculate on resize 38 window.addEventListener('resize', calcWinsize); 39 40 // scroll position 41 let docScroll; 42 // for scroll speed calculation 43 let lastScroll; 44 let scrollingSpeed = 0; 45 // scroll position update function 46 const getPageYScroll = () => docScroll = window.pageYOffset || document.documentElement.scrollTop; 47 window.addEventListener('scroll', getPageYScroll); 48 49 // Item 50 class Item { 51 constructor(el) { 52 // the .item element 53 this.DOM = { el: el }; 54 // the inner image 55 this.DOM.child = this.DOM.el.querySelector('[data-px]'); 56 // this.DOM.imageWrapper = this.DOM.image.parentNode; 57 // this.DOM.title = this.DOM.el.querySelector('.content__item-title'); 58 this.renderedStyles = { 59 // here we define which property will change as we scroll the page and the item is inside the viewport 60 // in this case we will be: 61 // - translating the inner image 62 // we interpolate between the previous and current value to achieve a smooth effect 63 translationY: { 64 // interpolated value 65 previous: 0, 66 // current value 67 current: 0, 68 // amount to interpolate 69 ease: ease, 70 // current value setter 71 setValue: () => { 72 // the maximum value to translate the image is set in a CSS variable (--overflow) 73 // const toValue = parseInt(getComputedStyle(this.DOM.image).getPropertyValue('--overflow'), 10); 74 // const fromValue = -1 * toValue; 75 // return Math.max(Math.min(MathUtils.map(this.props.top - docScroll, winsize.height, -1 * this.props.height, fromValue, toValue), toValue), fromValue); 76 77 const fromValue = parseInt(this.DOM.child.getAttribute('data-px-top'), 10); 78 const toValue = parseInt(this.DOM.child.getAttribute('data-px-bottom'), 10); 79 80 81 if (toValue < fromValue) { 82 return Math.max(Math.min(MathUtils.map(this.props.top - docScroll, winsize.height, -1 * this.props.height, fromValue, toValue), fromValue), toValue); 83 } else { 84 return Math.max(Math.min(MathUtils.map(this.props.top - docScroll, winsize.height, -1 * this.props.height, fromValue, toValue), toValue), fromValue); 85 } 86 87 } 88 }, 89 }; 90 // gets the item's height and top (relative to the document) 91 // this.getSize(); 92 // set the initial values 93 this.update(); 94 // use the IntersectionObserver API to check when the element is inside the viewport 95 // only then the element styles will be updated 96 this.observer = new IntersectionObserver((entries) => {
97 entries.forEach(entry => this.isVisible = entry.intersectionRatio > 0); 98 }); 99 this.observer.observe(this.DOM.el); 100 // init/bind events 101 this.initEvents(); 102 } 103 update() { 104 // gets the item's height and top (relative to the document) 105 this.getSize(); 106 // sets the initial value (no interpolation) 107 for (const key in this.renderedStyles) { 108 this.renderedStyles[key].current = this.renderedStyles[key].previous = this.renderedStyles[key].setValue(); 109 } 110 // apply changes/styles 111 this.layout(); 112 } 113 getSize() { 114 const rect = this.DOM.el.getBoundingClientRect(); 115 this.props = { 116 // item's height 117 height: rect.height, 118 // offset top relative to the document 119 top: docScroll + rect.top 120 } 121 } 122 initEvents() { 123 window.addEventListener('resize', () => this.resize()); 124 } 125 resize() { 126 // gets the item's height and top (relative to the document) 127 // this.getSize(); 128 // on resize reset sizes and update styles 129 this.update(); 130 } 131 render() { 132 // update the current and interpolated values 133 for (const key in this.renderedStyles) { 134 this.renderedStyles[key].current = this.renderedStyles[key].setValue(); 135 this.renderedStyles[key].previous = MathUtils.lerp(this.renderedStyles[key].previous, this.renderedStyles[key].current, this.renderedStyles[key].ease); 136 } 137 138 // and apply changes 139 this.layout(); 140 } 141 layout() { 142 // translates the image 143 this.DOM.child.style.transform = `translate3d(0,${this.renderedStyles.translationY.previous}px,0)`; 144 145 } 146 } 147 148 // SmoothScroll 149 class SmoothScroll { 150 constructor() { 151 // the <main> element 152 this.DOM = { main: document.querySelector('.scroll-wrapper') }; 153 // the scrollable element 154 // we translate this element when scrolling (y-axis) 155 this.DOM.scrollable = this.DOM.main.querySelector('div[data-scroll]'); 156 // the items on the page 157 this.items = []; 158 // this.DOM.content = this.DOM.main.querySelector('.content'); 159 [...this.DOM.main.querySelectorAll('.px')].forEach(item => this.items.push(new Item(item))); 160 // here we define which property will change as we scroll the page 161 // in this case we will be translating on the y-axis 162 // we interpolate between the previous and current value to achieve the smooth scrolling effect 163 this.renderedStyles = { 164 translationY: { 165 // interpolated value 166 previous: 0, 167 // current value 168 current: 0, 169 // amount to interpolate 170 ease: ease, 171 // current value setter 172 // in this case the value of the translation will be the same like the document scroll 173 setValue: () => docScroll 174 } 175 }; 176 // set the body's height 177 this.setSize(); 178 // set the initial values 179 this.update(); 180 // the <main> element's style needs to be modified 181 this.style(); 182 // init/bind events 183 this.initEvents(); 184 // start the render loop 185 requestAnimationFrame(() => this.render()); 186 } 187 update() { 188 // sets the initial value (no interpolation) - translate the scroll value 189 for (const key in this.renderedStyles) { 190 this.renderedStyles[key].current = this.renderedStyles[key].previous = this.renderedStyles[key].setValue(); 191 } 192 // translate the scrollable element 193 this.layout(); 194 195 } 196 layout() { 197 this.DOM.scrollable.style.transform = `translate3d(0,${-1*this.renderedStyles.translationY.previous}px,0)`; 198 } 199 setSize() { 200 // set the heigh of the body in order to keep the scrollbar on the page 201 body.style.height = `${this.DOM.scrollable.scrollHeight}px`; 202 } 203 style() { 204 // the <main> needs to "stick" to the screen and not scroll 205 // for that we set it to position fixed and overflow hidden 206 this.DOM.main.style.position = 'fixed'; 207 this.DOM.main.style.width = this.DOM.main.style.height = '100%'; 208 this.DOM.main.style.top = this.DOM.main.style.left = 0; 209 this.DOM.main.style.overflow = 'hidden'; 210 } 211 initEvents() { 212 // on resize reset the body's height 213 window.addEventListener('resize', () => this.setSize()); 214 215 } 216 render() { 217 218 // Get scrolling speed 219 // scrollingSpeed = Math.abs(docScroll - lastScroll); 220 221 // HEADER 222 if (docScroll > 10) { 223 body.classList.add('nav-scroll'); 224 } else { 225 body.classList.remove('nav-scroll'); 226 } 227 if (docScroll > 10) { 228 body.classList.add('hide-scroll'); 229 } else { 230 body.classList.remove('hide-scroll'); 231 } 232 233 if (docScroll > winsize.height ) { 234 body.classList.add('nav-blend'); 235 } else { 236 body.classList.remove('nav-blend'); 237 } 238 239 240 241 242 243 244 $('.career-title-repere').each(function(){ 245 var scrollTop = $(window).scrollTop(), 246 elementOffset = $(this).offset().top, 247 distance = (elementOffset - scrollTop); 248 // console.log('tezt ' + distance); 249 if ( distance > 0 ) { 250 $('.a-icone-career').css('opacity', '0'); 251 $('.a-icone-career .icone').css('top', '60%'); 252 } else { 253 $('.a-icone-career').css('opacity', '1'); 254 $('.a-icone-career .icone').css('top', '50%'); 255 } 256 }); 257 258 // STICKY 259 260 if (document.body.contains(sticky)) { 261 let parentOffset = offset(parent), 262 parentHeight = parent.offsetHeight, 263 stickyHeight = sticky.offsetHeight; 264 if(docScroll <= parentOffset) { 265 sticky.style.position = ''; 266 sticky.style.bottom = ''; 267 sticky.style.top = ''; 268 $('.a-icone-career').addClass('fixe'); 269 } 270 else if(docScroll > parentOffset) { 271 sticky.style.position = 'absolute'; 272 $('.a-icone-career').removeClass('fixe'); 273 if(docScroll > (parentHeight + parentOffset - stickyHeight)) { 274 sticky.style.top = 'auto'; 275 sticky.style.bottom = 0; 276 } 277 else { 278 sticky.style.top = (docScroll - parentOffset)+'px'; 279 sticky.style.bottom = 'auto'; 280 } 281 } 282 else { 283 $('.a-icone-career').removeClass('fixe'); 284 } 285 } 286 287 // Update lastScroll 288 289 lastScroll = docScroll; 290 291 // update the current and interpolated values 292 for (const key in this.renderedStyles) { 293 this.renderedStyles[key].current = this.renderedStyles[key].setValue(); 294 this.renderedStyles[key].previous = MathUtils.lerp(this.renderedStyles[key].previous, this.renderedStyles[key].current, this.renderedStyles[key].ease); 295 } 296 // and translate the scrollable element 297 this.layout(); 298 299 // for every item 300 for (const item of this.items) { 301 // if the item is inside the viewport call it's render function 302 // this will update item's styles, based on the document scroll value and the item's position on the viewport 303 // if (item.isVisible) { 304 // if (item.insideViewport) { 305 // item.render(); 306 // } else { 307 // item.insideViewport = true;
308 // item.update(); 309 // } 310 // } else { 311 // item.insideViewport = false; 312 // } 313 if ( item.isVisible ) { 314 item.render(); 315 } 316 } 317 318 // REPLACE AOS 319 const SELECTOR_AOS = '[data-aos]'; 320 const ANIMATE_CLASS_NAME_AOS = 'aos-animate'; 321 322 const animateAos = element => ( 323 element.classList.add(ANIMATE_CLASS_NAME_AOS) 324 ); 325 326 const isAnimatedAos = element => ( 327 element.classList.contains(ANIMATE_CLASS_NAME_AOS) 328 ); 329 330 const intersectionObserverAos = new IntersectionObserver((entries, observer) => { 331 entries.forEach((entry) => { 332 if (entry.intersectionRatio > 0) { 333 animateAos(entry.target); 334 } 335 observer.unobserve(entry.target); 336 // !!! 337 setTimeout(function() { 338 smoothscroll.setSize(); 339 }, 1001); 340 }); 341 }); 342 const elementsAos = [].filter.call( 343 document.querySelectorAll(SELECTOR_AOS), 344 element => !isAnimatedAos(element, ANIMATE_CLASS_NAME_AOS), 345 ); 346 elementsAos.forEach((element) => intersectionObserverAos.observe(element)); 347 348 349 350 351 352 353 // STICKY 354 355 if (document.body.contains(sticky)) { 356 let parentOffset = offset(parent), 357 parentHeight = parent.offsetHeight, 358 stickyHeight = sticky.offsetHeight; 359 if(docScroll <= parentOffset) { 360 sticky.style.position = ''; 361 sticky.style.bottom = ''; 362 sticky.style.top = '' 363 } 364 else if(docScroll > parentOffset) { 365 sticky.style.position = 'absolute'; 366 if(docScroll > (parentHeight + parentOffset - stickyHeight)) { 367 sticky.style.top = 'auto'; 368 sticky.style.bottom = 0; 369 } 370 else { 371 sticky.style.top = (docScroll - parentOffset)+'px'; 372 sticky.style.bottom = 'auto'; 373 } 374 } 375 } 376 377 // loop.. 378 requestAnimationFrame(() => this.render()); 379 } 380 } 381 382 /***********************************/ 383 /********** Preload stuff **********/ 384 385 // Preload images 386 const preloadImages = () => { 387 return new Promise((resolve, reject) => { 388 imagesLoaded(document.querySelectorAll('img'), { background: true }, resolve); 389 }); 390 }; 391 392 // And then.. 393 preloadImages().then(() => { 394 // Get the scroll position and update the lastScroll variable 395 getPageYScroll(); 396 lastScroll = docScroll; 397 // Initialize the Smooth Scrolling 398 smoothscroll = new SmoothScroll(); 399 // INIT AOS 400 401 }); 402 } 403 404 } 405 406 // --------------------------------------------------------------------------------------------- 407 408} 409 410if ( $(window).innerWidth() > 1024 ) { 411 smoothScrollFunction(); 412} 413 414function no_smooth_scroll_mobile() { 415 const SELECTOR_AOS = '[data-aos], .sa, .saV2, .js-increment'; 416 const ANIMATE_CLASS_NAME_AOS = 'aos-animate'; 417 418 const animateAos = element => ( 419 element.classList.add(ANIMATE_CLASS_NAME_AOS) 420 ); 421 422 const isAnimatedAos = element => ( 423 element.classList.contains(ANIMATE_CLASS_NAME_AOS) 424 ); 425 426 const intersectionObserverAos = new IntersectionObserver((entries, observer) => {
427 entries.forEach((entry) => { 428 if (entry.intersectionRatio > 0) { 429 animateAos(entry.target); 430 } 431 if (entry.target.classList.contains('js-increment')) { 432 $(entry.target).numberIncrementer({}); 433 } 434 observer.unobserve(entry.target); 435 }); 436 }); 437 const elementsAos = [].filter.call( 438 document.querySelectorAll(SELECTOR_AOS), 439 element => !isAnimatedAos(element, ANIMATE_CLASS_NAME_AOS), 440 ); 441 elementsAos.forEach((element) => intersectionObserverAos.observe(element)); 442 443 // ----------------------------------------------------------------------------- 444 // --- CHECK SCROLL POSITION 445 // ----------------------------------------------------------------------------- 446 447 var lastScrollTop = 0; 448 449 function checkScrollPosition() { 450 451 var st = $(this).scrollTop(); // Last Scroll Value 452 453 // TOP OR NOT 454 if (st < 1) { 455 $('body').addClass('scrollTop'); 456 } else { 457 $('body').removeClass('scrollTop'); 458 } 459 460 // UP OR DOWN 461 if (st < lastScrollTop) { 462 $('body').addClass('scrollUp').removeClass('scrollDown'); 463 } else { 464 $('body').removeClass('scrollUp').addClass('scrollDown'); 465 } 466 467 lastScrollTop = st; // New Scroll Value 468 469 } checkScrollPosition(); 470 471 $(window).scroll(function() { 472 checkScrollPosition(); 473 }); 474 475} 476 477// ----------------------------------------------------------------------------- 478// ----------------------------------------------------------------------------- 479// --- REMPLACE AOS 480// ----------------------------------------------------------------------------- 481// ----------------------------------------------------------------------------- 482 483function aos() { 484 const SELECTOR_AOS = '[data-aos], .sa, .saV2, .js-increment'; 485 const ANIMATE_CLASS_NAME_AOS = 'aos-animate'; 486 const animateAos = element => ( 487 element.classList.add(ANIMATE_CLASS_NAME_AOS) 488 ); 489 const isAnimatedAos = element => ( 490 element.classList.contains(ANIMATE_CLASS_NAME_AOS) 491 ); 492 const intersectionObserverAos = new IntersectionObserver((entries, observer) => { 493 entries.forEach((entry) => { 494 if (entry.intersectionRatio > 0) { 495 let entryHeight = entry.target.offsetHeight; 496 animateAos(entry.target); 497 if(entry.target.classList.contains('js-increment')) { 498 $(entry.target).numberIncrementer({}); 499 } 500 observer.unobserve(entry.target); 501 } 502 }); 503 }); 504 const elementsAos = [].filter.call( 505 document.querySelectorAll(SELECTOR_AOS), 506 element => !isAnimatedAos(element, ANIMATE_CLASS_NAME_AOS), 507 ); 508 elementsAos.forEach((element) => intersectionObserverAos.observe(element)); 509} 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 function triggerFunctions() { 544 545 546 $('h1').widowFix(); 547 $('.widowFix').widowFix(); 548 549 550 // ----------------------------------------------------------------------------- 551 // --- HAUTEUR HEADER A 100% DE L ECRAN 552 // ----------------------------------------------------------------------------- 553 554 $('.generic-header').each(function(){ 555 $(this).css('height', $(window).innerHeight()); 556 }); 557 558 // ----------------------------------------------------------------------------- 559 // --- SPLIT TEXTES LINES 560 // ----------------------------------------------------------------------------- 561 562 // if ( $('main').hasClass('main-singleteam') ) { 563 // $chapeaux = $('.quote-box'); 564 // var textSplitLines = new SplitText($chapeaux, { type: "lines", linesClass: "line" }); 565 // } 566 567 // if ( $('main').hasClass('st') ) { 568 // $titres = $('.split-title'); 569 // // alert('ok') 570 // var textSplitLines = new SplitText($titres, { type: "lines", linesClass: "line" }); 571 // } 572 573 // if ( $('main').hasClass('sc') || $('main').hasClass('st') ) { 574 // $lines = $('.line'); 575 // var textSplitLines = new SplitText($lines, { type: "lines", linesClass: "subline" }); 576 // } 577 578 579 $('.menu-toggle').click(function(e) { 580 e.preventDefault(); 581 $('body').toggleClass('menu-open'); 582 }); 583 584 585 586 $('.checkHeight .item').each(function(){ 587 588 var hauteur1 = $('.checkHeight .item-1 .cp').innerHeight(); 589 var hauteur2 = $('.checkHeight .item-2 .cp').innerHeight(); 590 var hauteur3 = $('.checkHeight .item-3 .cp').innerHeight(); 591 var nouvelleHauteur = hauteur1; 592 if ( hauteur2 > hauteur1 ) { 593 nouvelleHauteur = hauteur2; 594 } 595 if ( hauteur3 > hauteur2 ) { 596 nouvelleHauteur = hauteur3; 597 } 598 599 600 $(this).find('.cp').css('height', nouvelleHauteur); 601 }); 602 603 604 605 606 607// if ( ) { 608
609// var swiperHN = new Swiper('.swiper-homenews', { 610 611// slidesPerView: 2, 612// centeredSlides: false, 613// spaceBetween: 50, 614// pagination: { 615// el: '.swiper-pg', 616// type: 'fraction', 617// }, 618// navigation: { 619// nextEl: '.sbn', 620// prevEl: '.sbp', 621// }, 622// breakpoints: { 623 624// 767: { 625// slidesPerView: 1, 626// spaceBetween: 15, 627// // init: true, 628// }, 629// 1024: { 630// slidesPerView: 2, 631// spaceBetween: 50, 632// // init: true, 633// }, 634// } 635// }); 636 637// var swiperHNP = new Swiper('.swiper-homenews-progressbar', { 638 639// slidesPerView: 2, 640// centeredSlides: false, 641// spaceBetween: 50, 642// pagination: { 643// el: '.swiper-progressbar', 644// type: 'progressbar', 645// }, 646// breakpoints: { 647 648// 767: { 649// slidesPerView: 1, 650// spaceBetween: 40, 651// // init: true, 652// }, 653// 1024: { 654// slidesPerView: 2, 655// spaceBetween: 50, 656// // init: true, 657// }, 658// } 659// }); 660 661// } 662 663if ( $('main').hasClass('main-about') || $('main').hasClass('main-management') || $('main').hasClass('main-properties') ) { 664 665 var swiperHN = new Swiper('.swiper-homenews', { 666 667 slidesPerView: 2, 668 centeredSlides: false, 669 spaceBetween: 50, 670 grabCursor: true, 671 pagination: { 672 el: '.swiper-pg', 673 type: 'fraction', 674 }, 675 navigation: { 676 nextEl: '.sbn', 677 prevEl: '.sbp', 678 }, 679 breakpoints: { 680 681 767: { 682 slidesPerView: 1, 683 spaceBetween: 15, 684 // init: true, 685 }, 686 1024: { 687 slidesPerView: 'auto', 688 spaceBetween: 50, 689 // init: true, 690 }, 691 } 692 }); 693 694 var swiperHNP = new Swiper('.swiper-homenews-progressbar', { 695 696 slidesPerView: 2, 697 centeredSlides: false, 698 spaceBetween: 50, 699 pagination: { 700 el: '.swiper-progressbar', 701 type: 'progressbar', 702 }, 703 breakpoints: { 704 705 767: { 706 slidesPerView: 1, 707 spaceBetween: 40, 708 // init: true, 709 }, 710 1024: { 711 slidesPerView: 'auto', 712 spaceBetween: 50, 713 // init: true, 714 }, 715 } 716 }); 717 718} 719 720 721if ( $('main').hasClass('main-about') || $('main').hasClass('main-properties') || $('main').hasClass('main-management') ) { 722 swiperHN.controller.control = swiperHNP; 723 swiperHNP.controller.control = swiperHN; 724} 725 726 727 728 729 730 731 732 733 var swiperHN = new Swiper('.swiper-rm', { 734 735 slidesPerView: 2, 736 centeredSlides: false, 737 spaceBetween: 50, 738 grabCursor: true, 739 // pagination: { 740 // el: '.swiper-pg', 741 // type: 'fraction', 742 // }, 743 // navigation: { 744 // nextEl: '.sbn', 745 // prevEl: '.sbp', 746 // }, 747 breakpoints: { 748 749 767: { 750 slidesPerView: 1, 751 spaceBetween: 15, 752 // init: true, 753 }, 754 1024: { 755 slidesPerView: 'auto', 756 spaceBetween: 50, 757 // init: true, 758 }, 759 } 760 }); 761 762 763 764 765 766 767 768 769 var swiperHNE = new Swiper('.swiper-se', { 770 771 slidesPerView: 'auto', 772 centeredSlides: false, 773 spaceBetween: 50, 774 grabCursor: true, 775 pagination: { 776 el: '.swiper-pg', 777 type: 'fraction', 778 }, 779 navigation: { 780 nextEl: '.sbn', 781 prevEl: '.sbp', 782 }, 783 breakpoints: { 784 785 767: { 786 spaceBetween: 15, 787 // init: true, 788 }, 789 1024: { 790 spaceBetween: 50, 791 // init: true, 792 }, 793 } 794 }); 795 796 var swiperHNPE = new Swiper('.swiper-se-progressbar', { 797 798 slidesPerView: 'auto', 799 centeredSlides: false, 800 spaceBetween: 50, 801 pagination: { 802 el: '.swiper-progressbar', 803 type: 'progressbar', 804 }, 805 breakpoints: { 806 807 767: { 808 spaceBetween: 40, 809 // init: true, 810 }, 811 1024: { 812 spaceBetween: 50, 813 // init: true, 814 }, 815 } 816 }); 817 818 819if ( $('body').hasClass('single-estates') ) { 820 swiperHNE.controller.control = swiperHNPE; 821 swiperHNPE.controller.control = swiperHNE; 822} 823 824 825 826 827// if ( $(window).innerWidth() < 1024 ) { 828// var swiper = new Swiper('.swiper-singlenews', { 829// // slidesPerView: 1, 830// // spaceBetween: 10, 831// // init: false, 832// pagination: { 833// el: '.swiper-pg', 834// type: 'fraction', 835// }, 836// navigation: { 837// nextEl: '.sbn', 838// prevEl: '.sbp', 839// }, 840// breakpoints: { 841 842// 767: { 843// slidesPerView: 1, 844// spaceBetween: 40, 845// // init: true, 846// }, 847// 1024: { 848// slidesPerView: 2, 849// spaceBetween: 50, 850// // init: true, 851// }, 852// } 853// }); 854// } 855 856 857 858 859$('.shave').dotdotdot(); 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877$(function() { 878 879 var filters = $('#filter'); 880 881 // CHAMPS NUMERAIRES 882 883 var rangeSliders = document.getElementsByClassName('range-slider'); 884 885 for ( var i = 0; i < rangeSliders.length; i++ ) { 886 var minEl = rangeSliders[i].nextElementSibling, 887 maxEl = rangeSliders[i].nextElementSibling.nextElementSibling, 888 minInt = parseInt(minEl.value,10), 889 maxInt = parseInt(maxEl.value,10), 890 maxCurr = parseInt(maxEl.dataset.max,10), 891 step = parseInt(rangeSliders[i].dataset.step,10); 892 noUiSlider.create(rangeSliders[i], { 893 start: [minInt, maxInt], 894 step: step, 895 connect: true, 896 range: { 897 'min': 0, 898 'max': maxCurr 899 }, 900 format: wNumb({ 901 decimals: 0, 902 }) 903 }); 904 905 rangeSliders[i].noUiSlider.on('update', function (values, handle) { 906 var value = values[handle], 907 minEl = this.target.nextElementSibling, 908 maxEl = this.target.nextElementSibling.nextElementSibling; 909 910 911 // console.log(minEl + '//' + maxEl) 912 913 if (handle) { 914 maxEl.value = value; 915 } else { 916 minEl.value = value; 917 } 918 ajax_count_results(); 919 }); 920 // minEl.addEventListener('change', function () { 921 // this.target.noUiSlider.set([this.value, null]); 922 // }); 923 924 // maxEl.addEventListener('change', function () { 925 // this.target.noUiSlider.set([null, this.value]); 926 // }); 927 928 } 929 930 931 932 933
934// console.log(priceMaxBase) 935 936 937 938 var filtersReset = $('.filters-reset'); 939 940 filtersReset.click(function() { 941 942 var oldUrl = location.href.split('?')[0]; 943 var oldUrlClean = oldUrl.toString().replace( /\/page\/\d+\//g, "/" ); 944 945 var newUrl = new URL(oldUrlClean); 946 var searchParams = new URLSearchParams(); 947 948 var status = $('.input-status').val(); 949 950 searchParams.set('estate_status', status); 951 952 newUrl.search = searchParams.toString(); 953 954 history.replaceState(null, null, newUrl.toString()); 955 956 $("input").prop("checked", false); 957 958 //RESET RANGE 959 for ( var i = 0; i < rangeSliders.length; i++ ) { 960 var maxEl = rangeSliders[i].nextElementSibling.nextElementSibling, 961 maxCurr = parseInt(maxEl.dataset.max,10); 962 963 rangeSliders[i].noUiSlider.set([0, maxCurr]); 964 } 965 966 967 $('body').removeClass('show-reset-filter'); 968 $('body').removeClass('show-reset-filter-2'); 969 970 ajax_count_results(); 971 972 $.get( newUrl.toString(), function( response ) { 973 974 var newContainer = $( response ); 975 976 977 $('.archives-item').each(function(){ 978 $(this).css('opacity','0'); 979 }); 980 981 982 setTimeout(function() { 983 $('html, body').animate( { scrollTop: 0 }, 250 ); 984 }, 500) 985 setTimeout(function() { 986 $('#ajax-container').html( newContainer.find('#ajax-container').html() ); 987 }, 750) 988 989 setTimeout(function() { 990 smoothScrollFunction(); 991 }, 770) 992 993 // $('#ajax-container').html( newContainer.find('#ajax-container').html() ); 994 995 } ); 996 997 998 999 }); 1000 1001 filters.submit(function(){ 1002 1003 var oldUrl = location.href.split('?')[0]; 1004 var oldUrlClean = oldUrl.toString().replace( /\/page\/\d+\//g, "/" ); 1005 console.log(oldUrlClean); 1006 1007 var newParams= ''; 1008 var types = ''; 1009 1010 var arrayQuery = filters.serializeArray(); 1011 1012 1013 1014 1015 1016 // $('.archives-item').each(function(){ 1017 // setTimeout(function() { 1018 // // $(this).css('opacity','1'); 1019 // }, 750) 1020 // }); 1021 1022 1023 1024 1025 roomsMinBase = $('#rooms-range-slider').parent().find('.range-min').val(); 1026 roomsMaxBase = $('#rooms-range-slider').parent().find('.range-max').data("max"); 1027 priceMinBase = $('#price-range-slider').parent().find('.range-min').val(); 1028 priceMaxBase = $('#price-range-slider').parent().find('.range-max').data("max"); 1029 surfaceMinBase = $('#surface-range-slider').parent().find('.range-min').val(); 1030 surfaceMaxBase = $('#surface-range-slider').parent().find('.range-max').data("max"); 1031 1032 if ( roomsMin > '0.5' || priceMin > '0.5' || surfaceMin > '0.5' || roomsMax < roomsMaxBase || priceMax < priceMaxBase || surfaceMax < surfaceMaxBase ) { 1033 console.log('filtre est actif'); 1034 $('body').addClass('show-reset-filter'); 1035 } else { 1036 $('body').removeClass('show-reset-filter'); 1037 } 1038 1039 $('#filter label input').each(function(){ 1040 if ( $(this)[0].checked === true ) { 1041 // console.log('OK type') 1042 console.log('filtre est actif'); 1043 $('body').addClass('show-reset-filter-2'); 1044 // break(); 1045 return false; 1046 } else { 1047 $('body').removeClass('show-reset-filter-2'); 1048 } 1049 }); 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 var newUrl = new URL(oldUrlClean); 1060 var searchParams = new URLSearchParams(); 1061 1062 $.each(arrayQuery, function(i, field) { 1063 1064 if(searchParams.has(field.name)){ 1065 searchParams.set(field.name, searchParams.get(field.name)+','+field.value); 1066 } 1067 else { 1068 if (field.name == 'price_max') { 1069 searchParams.set('price_range', searchParams.get('price_range')+','+field.value); 1070 } 1071 else if (field.name == 'indoor_surface_max') { 1072 searchParams.set('indoor_surface_range', searchParams.get('indoor_surface_range')+','+field.value); 1073 } 1074 else if (field.name == 'nb_rooms_max') { 1075 searchParams.set('nb_rooms_range', searchParams.get('nb_rooms_range')+','+field.value); 1076 } 1077 else { 1078 if(field.name !== 'action') 1079 searchParams.set(field.name, field.value); 1080 } 1081 } 1082 }); 1083 1084 newUrl.search = searchParams.toString(); 1085 1086 history.replaceState(null, null, newUrl.toString()); 1087 $.get( newUrl.toString(), function( response ) { 1088 1089 var newContainer = $( response ); 1090 1091 1092 $('.archives-item').each(function(){ 1093 $(this).css('opacity','0'); 1094 }); 1095 1096 1097 setTimeout(function() { 1098 $('html, body').animate( { scrollTop: 0 }, 250 ); 1099 }, 500) 1100 1101 // alert('ok') 1102 1103 setTimeout(function() { 1104 $('#ajax-container').html( newContainer.find('#ajax-container').html() ); 1105 }, 750) 1106 1107 setTimeout(function() { 1108 smoothScrollFunction(); 1109 }, 760) 1110 1111 1112 } ); 1113 //CANCEL SUBMIT BEHAVIOUR 1114 return false;
1115 }); 1116 1117 filters.find('input').on('change', ajax_count_results); 1118 1119 function ajax_count_results() { 1120 var data = {}; 1121 var arrayQuery = filters.serializeArray(); 1122 $.each(arrayQuery, function(i, field) { 1123 1124 if(data[field.name]){ 1125 data[field.name] = data[field.name]+','+field.value 1126 } 1127 else { 1128 if (field.name == 'price_max') { 1129 data['price_range'] = data['price_range']+','+field.value 1130 } 1131 else if (field.name == 'indoor_surface_max') { 1132 data['indoor_surface_range'] = data['indoor_surface_range']+','+field.value 1133 } 1134 else if (field.name == 'nb_rooms_max') { 1135 data['nb_rooms_range'] = data['nb_rooms_range']+','+field.value 1136 } 1137 else { 1138 data[field.name] = field.value 1139 } 1140 } 1141 }); 1142 console.log(data); 1143 1144 // recopie valeur des ranges 1145 1146 roomsMin = $('#rooms-range-slider').parent().find('.range-min').val(); 1147 roomsMax = $('#rooms-range-slider').parent().find('.range-max').val(); 1148 priceMin = $('#price-range-slider').parent().find('.range-min').val(); 1149 priceMax = $('#price-range-slider').parent().find('.range-max').val(); 1150 surfaceMin = $('#surface-range-slider').parent().find('.range-min').val(); 1151 surfaceMax = $('#surface-range-slider').parent().find('.range-max').val(); 1152 $('.rrs').find('.min').find('span').html(roomsMin); 1153 $('.rrs').find('.max').find('span').html(roomsMax); 1154 $('.prs').find('.min').find('span').html(priceMin); 1155 $('.prs').find('.max').find('span').html(priceMax); 1156 $('.srs').find('.min').find('span').html(surfaceMin); 1157 $('.srs').find('.max').find('span').html(surfaceMax); 1158 1159 1160// console.log(priceMaxBase) 1161 1162 1163 1164 1165 1166 // $('#filter #localisation label input').each(function(){ 1167 // if ( $(this)[0].checked ) { 1168 // // console.log('OK loca') 1169 // console.log('filtre est actif'); 1170 // $('body').addClass('show-reset-filter'); 1171 // } else { 1172 // $('body').removeClass('show-reset-filter'); 1173 // } 1174 // }); 1175 1176 $.post(siteScript.ajax_url, data, function(response) { 1177 // console.log(response); 1178 $('.filters-results').html(response); 1179 }); 1180 } 1181 1182}); 1183 1184// $('#articles').on('click', '#load-older-posts a', function(e) { 1185 1186// // prevent new page load 1187 1188// e.preventDefault(); 1189 1190// // store next page number 1191 1192// var next_page = $(this).attr('href'); 1193 1194// // remove older posts button from DOM 1195 1196// $(this).remove(); 1197 1198// // ajax older posts below existing posts 1199 1200 1201// $('.shave').dotdotdot(); 1202 1203// $('#articles').append( 1204// $('<div />').load(next_page + ' #articles') 1205// ); 1206// }); 1207 1208 1209 1210 // ----------------------------------------------------------------------------- 1211 // --- ANIMATED CLASS TOGGLE 1212 // ----------------------------------------------------------------------------- 1213 1214 var mouseEnter = ((document.ontouchstart !== null) ? 'mouseenter' : 'touchstart'); 1215 $('body').on("webkitAnimationEnd oanimationend msAnimationEnd animationend", '.anim-hover', function(){ 1216 $(this).removeClass("animated"); 1217 }) 1218 .on(mouseEnter, '.anim-hover', function() { 1219 // alert('ok') 1220 $(this).addClass("animated"); 1221 }); 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236// window.onmousemove = suitsouris; 1237// function suitsouris(evenement) 1238// { 1239// if(navigator.appName=="Microsoft Internet Explorer") 1240// { 1241// var x = event.x+document.body.scrollLeft; 1242// var y = event.y+document.body.scrollTop; 1243// } 1244// else 1245// { 1246// var x = evenement.pageX; 1247// var y = evenement.pageY; 1248// } 1249// $("#mouse-cursor").css('left',(x+1)+'px');
1250// $("#mouse-cursor").css('top', (y+1)+'px'); 1251// } 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261// $(".swiper-slide").mouseover(function() { 1262// $('body').addClass('ss-hovered'); 1263// }); 1264 1265// $(".swiper-slide").mouseout(function() { 1266// $('body').removeClass('ss-hovered'); 1267// }); 1268 1269 1270// $("a, .sbp, .sbn").mouseover(function() { 1271// $('body').addClass('a-hovered'); 1272// }); 1273 1274// $("a, .sbp, .sbn").mouseout(function() { 1275// $('body').removeClass('a-hovered'); 1276// }); 1277 1278 1279 1280 // ----------------------------------------------------------------------------- 1281 // --- FORMULAIRES NEWSLETTER 1282 // ----------------------------------------------------------------------------- 1283 1284 // --- Hover sur le bouton 1285 1286 $(".mc-field-group .button").mouseover(function() { 1287 $(this).parent().addClass('hovered'); 1288 }); 1289 1290 $(".mc-field-group .button").mouseout(function() { 1291 $(this).parent().removeClass('hovered'); 1292 }); 1293 1294 // --- Affiche texte du RGPD au focus 1295 1296 $('.mc-field-group .email').focus(function(){ 1297 console.log() 1298 $(this).parent().parent().parent().parent().parent().parent().parent().find('.rgpd-txt').addClass('showme'); 1299 }); 1300 1301 1302 1303 // --- RGPD Boxes sous les formulaires - S'affiche au scroll / click 1304 1305 if ( $(window).innerWidth() > 1024 ) { 1306 $(".openRGPD").mouseover(function() { 1307 $(this).addClass('hovered'); 1308 }); 1309 $(".openRGPD").mouseout(function() { 1310 $(this).removeClass('hovered'); 1311 }); 1312 $(".txtRGPD").mouseout(function() { 1313 $(this).parent().find('.openRGPD').removeClass('hovered'); 1314 }); 1315 $(".txtRGPD p").mouseout(function() { 1316 $(this).parent().parent().find('.openRGPD').removeClass('hovered'); 1317 }); 1318 } 1319 1320 if ( $(window).innerWidth() < 1025 ) { 1321 $(".openRGPD").click(function(e) { 1322 e.preventDefault(); 1323 $('body').addClass('rgpd-open'); 1324 }); 1325 $(".mobile-rgpd-bg").click(function(e) { 1326 e.preventDefault(); 1327 $('body').removeClass('rgpd-open'); 1328 }); 1329 $(".mobile-rgpd-txt .close").click(function(e) { 1330 e.preventDefault(); 1331 $('body').removeClass('rgpd-open'); 1332 }); 1333 } 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346} triggerFunctions(); 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357function onResizeFunctions() { 1358 1359 1360 1361 1362 1363if ( $('body').hasClass('page-template-template-properties') ) { 1364 1365} else { 1366 1367 $('.swiper-wrapper.about').each(function(){ 1368 var h = $(this).innerHeight(); 1369 // console.log(h) 1370 1371 $(this).find('.item').css('height', h-50 + 'px'); 1372 1373 }); 1374 1375 1376} 1377 1378 1379 1380 1381 1382 1383 1384 if ( $(window).innerWidth() > 1024 ) { 1385 $('.full-height').each(function(){ 1386 $(this).css('height', $(window).innerHeight() ); 1387 }); 1388 } 1389 1390 if ( $(window).innerWidth() > 767 ) { 1391 $('.full-height').each(function(){ 1392 1393 var larg = Math.round( $('.home-ambition .bg').innerWidth() ); 1394 1395 var decGrid = Math.round( $('.home-ambition .bg').offset().left ); 1396 var newLarg = decGrid + larg; 1397 $(this).find('.pre-bg').css("left", newLarg + 'px'); 1398 }); 1399 } 1400 1401 1402 1403 1404 $('.pgwfl').each(function(){ 1405 1406 if ( $(window).innerWidth() > 767 ) { 1407 1408 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1409 1410 $(this).find('.fleche').css("left", decGrid + 'px'); 1411 } 1412 1413 1414 }); 1415 1416 1417 1418 $('.home-numbers').each(function(){ 1419 1420 1421 if ( $(window).innerWidth() > 767 ) { 1422 1423 var repGrid = Math.round( $('.colEt').innerWidth() ); 1424 1425 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1426 var decGauche = Math.round( $(this).find('.grid').offset().left ); 1427 var larg = Math.round( $(this).find('.grid').innerWidth() ); 1428 var newLarg = decGrid; 1429 $(this).find('.pre-bg').css("left", newLarg + 'px'); 1430 // $(this).find('.content').css("left", decGauche + 'px'); 1431 } 1432 1433 1434 if ( $(window).innerWidth() > 1024 ) { 1435 1436 var repGrid = Math.round( $('.colEt').innerWidth() ); 1437 1438 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1439 var decGauche = Math.round( $(this).find('.grid').offset().left ); 1440 var larg = Math.round( $(this).find('.grid').innerWidth() ); 1441 var newLarg = decGrid+repGrid; 1442 $(this).find('.pre-bg').css("left", newLarg + 'px'); 1443 // $(this).find('.content').css("left", decGauche + 'px'); 1444 } 1445 1446 1447 }); 1448 1449 $('.sub-page-header ').each(function(){ 1450 1451 if ( $(window).innerWidth() > 767 ) { 1452 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1453 var thisW = $(this).find('.right.image-big .pre-bg').innerWidth(); 1454 // var newLarg = ( $(window).innerWidth() - decGrid);
1455 // $(this).find('.content').css("right", decGrid + 'px'); 1456 // alert('ok') 1457 var nL = decGrid + thisW; 1458 $(this).find('.right.image-big .pre-bg').css("width", nL + 'px'); 1459 } 1460 1461 // if ( $(window).innerWidth() > 1023 && $(window).innerWidth() < 1366 ) { 1462 // var decGrid = Math.round( $(this).find('.grid').offset().left ); 1463 // var newDec = decGrid+36+36; 1464 // var newLarg = ( $(window).innerWidth() - decGrid); 1465 // var newLarg2 = newLarg - 36 - 36; 1466 // $(this).find('.content').css("right", newDec + 'px'); 1467 // $(this).find('.content').css("width", newLarg2 + 'px'); 1468 // } 1469 1470 // if ( $(window).innerWidth() > 1365 ) { 1471 // var decGrid = Math.round( $(this).find('.grid').offset().left ); 1472 // var newDec = decGrid+51+51+51+51+51; 1473 // var newLarg = ( $(window).innerWidth() - decGrid); 1474 // var newLarg2 = newLarg - 51 - 51 - 51 - 51 - 51; 1475 // $(this).find('.content').css("right", newDec + 'px'); 1476 // $(this).find('.content').css("width", newLarg2 + 'px'); 1477 // } 1478 1479 1480 }); 1481 1482 $('.about-team').each(function(){ 1483 1484 if ( $(window).innerWidth() > 767 && $(window).innerWidth() < 1025 ) { 1485 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1486 var newLarg = ( $(window).innerWidth() - decGrid);
1487 $(this).find('.content').css("right", decGrid + 'px'); 1488 $(this).find('.content').css("width", newLarg + 'px'); 1489 } 1490 1491 if ( $(window).innerWidth() > 1024 && $(window).innerWidth() < 1366 ) { 1492 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1493 var newDec = decGrid+36+36; 1494 var newLarg = ( $(window).innerWidth() - decGrid); 1495 var newLarg2 = newLarg - 36 - 36; 1496 $(this).find('.content').css("right", newDec + 'px'); 1497 $(this).find('.content').css("width", newLarg2 + 'px'); 1498 } 1499 1500 if ( $(window).innerWidth() > 1365 ) { 1501 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1502 var newDec = decGrid+51+51+51+51+51; 1503 var newLarg = ( $(window).innerWidth() - decGrid); 1504 var newLarg2 = newLarg - 51 - 51 - 51 - 51 - 51; 1505 $(this).find('.content').css("right", newDec + 'px'); 1506 $(this).find('.content').css("width", newLarg2 + 'px'); 1507 } 1508 1509 1510 }); 1511 1512 $('.about-bureaux').each(function(){ 1513 if ( $(window).innerWidth() > 1024 ) { 1514 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1515 var decGauche = Math.round( $(this).find('.image-rep').offset().left ); 1516 var larg = Math.round( $(this).find('.image-rep').innerWidth() ); 1517 var newLarg = decGrid+larg+40; 1518 $(this).find('.pre-bg').css("width", newLarg+25 + 'px'); 1519 $(this).find('.pre-bg').css("left", decGauche + 'px'); 1520 } 1521 }); 1522 1523 $('.management-services').each(function(){ 1524 if ( $(window).innerWidth() > 1024 ) { 1525 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1526 var decGauche = Math.round( $(this).find('.image-rep').offset().left ); 1527 var larg = Math.round( $(this).find('.image-rep').innerWidth() ); 1528 var newLarg = decGrid+larg+50; 1529 $(this).find('.pre-bg').css("width", newLarg + 'px'); 1530 $(this).find('.pre-bg').css("left", decGauche + 'px'); 1531 } 1532 }); 1533 1534 1535 $('.main-properties').each(function(){ 1536 1537 1538 if ( $(window).innerWidth() > 1024 ) { 1539 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1540 // var decGauche = Math.round( $(this).find('.image-rep').offset().left ); 1541 // var larg = Math.round( $(this).find('.image-rep').innerWidth() ); 1542 var decGaucheD = Math.round( $(this).find('.image-rep-d').offset().left ); 1543 var largD = Math.round( $(this).find('.image-rep-d').innerWidth() ); 1544 // var newLarg = decGrid+larg+50; 1545 var newLargD = decGrid+largD+50; 1546 // $(this).find('.pre-bg').css("width", newLarg + 'px'); 1547 // $(this).find('.pre-bg').css("left", decGauche + 'px'); 1548 1549 1550 $(this).find('.image-dec').css("width", newLargD + 'px'); 1551 $(this).find('.image-dec').css("left", decGaucheD + 'px'); 1552 1553 } 1554 }); 1555 1556 1557 1558 $('.main-contact .second').each(function(){ 1559 if ( $(window).innerWidth() > 1024 ) { 1560 var decGrid = Math.round( $(this).find('.grid').offset().left ); 1561 var decGauche = Math.round( $(this).find('.image-rep').offset().left ); 1562 var larg = Math.round( $(this).find('.image-rep').innerWidth() ); 1563 var newLarg = decGrid+larg; 1564 $(this).find('.pre-bg').css("width", newLarg + 'px'); 1565 // $(this).find('.pre-bg').css("left", decGauche + 'px'); 1566 } 1567 }); 1568 1569 // $('.main-contact').each(function(){ 1570 // if ( $(window).innerWidth() > 767 ) { 1571 1572 // var hauteurTotale = $(this).innerHeight(); 1573 1574 // var decGauche = $(this).find('.image-rep').offset().left; 1575 // var larg = $(this).find('.image-rep').innerWidth(); 1576 // var newLarg = decGauche+larg; 1577 // $(this).find('.image-box').css("width", newLarg + 'px'); 1578 // $(this).find('.image-box').css("height", hauteurTotale + 'px'); 1579 // $(this).find('.map-box').css("left", newLarg + 'px'); 1580 1581 // } 1582 // }); 1583 1584 1585} onResizeFunctions(); 1586 1587 1588 1589 function checkHeight() { 1590 1591 1592 1593 oldHauteurRM = 0; 1594 $('.check-height-rm').each(function(){ 1595 hauteurRM = $(this).innerHeight(); 1596 if ( hauteurRM > oldHauteurRM) { 1597 oldHauteurRM = hauteurRM; 1598 console.log(oldHauteurRM) 1599 } 1600 }); 1601 $('.check-height-rm').css('height',oldHauteurRM+'px'); 1602 1603 1604 oldHauteur = 0; 1605 $('.check-height-1').each(function(){ 1606 hauteur = $(this).innerHeight(); 1607 if ( hauteur > oldHauteur) { 1608 oldHauteur = hauteur; 1609 } 1610 }); 1611 $('.check-height-1').css('height',oldHauteur+'px'); 1612 1613 } checkHeight(); 1614 1615 1616 1617 1618$(window).resize(function(){ 1619 // console.log('resze') 1620 onResizeFunctions(); 1621}); 1622 1623 1624 1625 1626 1627// $('#video .cover').click(function(e){ 1628// e.preventDefault(); 1629// $(this).fadeOut(); 1630 1631// var videoURL = $(this).parent().children('iframe').prop('src'); 1632// videoURL += "&autoplay=1"; 1633// $(this).parent().children('iframe').prop('src',videoURL); 1634// return false;
1635 1636 1637// }); 1638 1639 1640 1641 1642 1643// ------------------------------ 1644 1645 1646 1647// --- DEBOUNCE FUNCTION 1648 1649function debounce(a, b, c) { 1650 var d; 1651 return function() { 1652 var e = this, 1653 f = arguments; 1654 clearTimeout(d), d = setTimeout(function() { d = null, c || a.apply(e, f) }, b), c && !d && a.apply(e, f) 1655 } 1656} 1657 1658// --- THROTTLE FUNCTION 1659 1660function throttle(callback, delay) { 1661 var last; 1662 var timer; 1663 return function () { 1664 var context = this; 1665 var now = +new Date(); 1666 var args = arguments; 1667 if (last && now < last + delay) { 1668 clearTimeout(timer); 1669 timer = setTimeout(function () { 1670 last = now; 1671 callback.apply(context, args); 1672 }, delay); 1673 } else { 1674 last = now; 1675 callback.apply(context, args); 1676 } 1677 }; 1678} 1679 1680 1681 1682 1683 1684 1685 1686// const handleMousePos = (e) => { 1687// const CURSOR = document.querySelector('#mouse-cursor'); 1688// const HOVER = document.querySelectorAll('a'); 1689// const { pageX: posX, pageY: posY } = e; 1690 1691// const runMouseOver = () => { 1692// CURSOR.style.transform = 'scale(4)'; 1693// }; 1694// HOVER.forEach(hover => hover.addEventListener('mouseenter', runMouseOver)); 1695 1696// const runMouseLeave = () => { 1697// CURSOR.style.transform = ''; 1698// }; 1699// HOVER.forEach(hover => hover.addEventListener('mouseleave', runMouseLeave)); 1700 1701// return ( 1702// CURSOR.style.left = `${posX - 10}px`, 1703// CURSOR.style.top = `${posY - 10}px` 1704// ); 1705// }; 1706// document.addEventListener('mousemove', handleMousePos); 1707 1708//
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.