1// THROTTLE FUNCTION 2function throttle(delay, callback) { 3 var previousCall = new Date().getTime(); 4 return function() { 5 var time = new Date().getTime(); 6 if ((time - previousCall) >= delay) { 7 previousCall = time; 8 callback.apply(null, arguments); 9 } 10 }; 11} 12// DEBOUNCE FUNCTION via @http://davidwalsh.name/javascript-debounce-function 13function debounce(a, b, c) { 14 var d; 15 return function() { 16 var e = this, 17 f = arguments; 18 clearTimeout(d), d = setTimeout(function() { d = null, c || a.apply(e, f) }, b), c && !d && a.apply(e, f) 19 } 20} 21 22 23$(function() { 24 25 var introImg = $('.section-intro-cover img'); 26 var wrapper = $('.wrapper'); 27 if (introImg.length > 0) { 28 introImg.imagesLoaded(function() { 29 wrapper.addClass('loaded'); 30 }); 31 } else { 32 wrapper.addClass('loaded'); 33 } 34 35 $('.home-intro').each(function(){ 36 $(this).css('height', $(window).innerHeight()); 37 }); 38 39 // --------------------------------------------------------------- // 40 // --------------------------------------------------------------- // 41 // --- ANIM HOVER ------------------------------------------------ // 42 // --------------------------------------------------------------- // 43 // --------------------------------------------------------------- // 44 45 var mouseEnter = ((document.ontouchstart !== null) ? 'mouseenter' : 'touchstart'); 46 $('body').on("webkitAnimationEnd oanimationend msAnimationEnd animationend", '.anim-hover', function() { 47 $(this).removeClass("animated"); 48 }) 49 .on(mouseEnter, '.anim-hover', function() { 50 $(this).addClass("animated"); 51 }); 52 53 // --------------------------------------------------------------- // 54 // --------------------------------------------------------------- // 55 // --- SCROLL WHEN TARGET ANCHOR --------------------------------- // 56 // --------------------------------------------------------------- // 57 // --------------------------------------------------------------- // 58 59 $("a[href*='#']").on('click', function(e) { 60 e.preventDefault(); 61 var hash = $(this).attr('href'); 62 hash = hash.substring(hash.indexOf('#')); 63 if (hash == '#') { 64 return; 65 } 66 if (hash == "#newsletter") { 67 newsletter.addClass('opened'); 68 return false; 69 } 70 if ($(hash).length > 0) { 71 var hashTop = $(hash).offset().top; 72 TweenMax.to($(window), 1, { 73 scrollTo: { y: hashTop, autoKill: false }, 74 ease: Power4.easeOut, 75 onComplete: function() { 76 77 } 78 }); 79 } 80 }); 81 82 // --------------------------------------------------------------- // 83 // --------------------------------------------------------------- // 84 // --- ADD CLASS WHEN PAGE IS READY ------------------------------ // 85 // --------------------------------------------------------------- // 86 // --------------------------------------------------------------- // 87 88 setTimeout(function() { 89 $('body').addClass('pageReady'); 90 }, 500) 91 92 // --------------------------------------------------------------- // 93 // --------------------------------------------------------------- // 94 // --- RELLAX / PARALLAX ----------------------------------------- // 95 // --------------------------------------------------------------- // 96 // --------------------------------------------------------------- // 97 98 if ( $(window).innerWidth() > 1025 ) { 99 var rellax = new Rellax('.rellax', { 100 speed: -2, 101 center: true, 102 wrapper: null, 103 round: true, 104 vertical: true, 105 horizontal: false 106 }); 107 } 108 109 110 AOS.init({ 111 once: true, 112 delay: 150, 113 offset: 0, 114 duration: 1000, 115 easing: 'ease-out-sine' 116 }); 117 118 // --------------------------------------------------------------- // 119 // --------------------------------------------------------------- // 120 // --- MENU TOGGLE ----------------------------------------------- // 121 // --------------------------------------------------------------- // 122 // --------------------------------------------------------------- // 123 124 var siteHeader = $('.site-header'); 125 126 $('.menu-toggle').on('click', function() { 127 siteHeader.toggleClass('open'); 128 }); 129 130 // --------------------------------------------------------------- // 131 // --------------------------------------------------------------- // 132 // --- SCROLL UP / SCROLL DOWN ----------------------------------- // 133 // --------------------------------------------------------------- // 134 // --------------------------------------------------------------- // 135 136 var header = $('.site-header'), 137 didScroll, 138 lastScrollTop = 0, 139 delta = 5, 140 navbarHeight = header.outerHeight(); 141 // navbarHeight = 10; 142 143 hasScrolled(); 144 145 $(window).scroll(function(event) { 146 didScroll = true; 147 }); 148 149 setInterval(function() { 150 if (didScroll) { 151 hasScrolled(); 152 didScroll = false;
153 } 154 }, 250); 155 156 function hasScrolled() { 157 var st = $(this).scrollTop(); 158 159 // Make sure they scroll more than delta 160 if (Math.abs(lastScrollTop - st) <= delta) 161 return; 162 163 // If they scrolled down and are past the navbar, add class .nav-up. 164 // This is necessary so you never see what is "behind" the navbar. 165 if (st > navbarHeight) { 166 header.addClass('nav-scroll'); 167 } else { 168 header.removeClass('nav-scroll'); 169 } 170 if (st > lastScrollTop && st > navbarHeight) { 171 // Scroll Down 172 header.removeClass('nav-down').addClass('nav-up'); 173 } else { 174 // Scroll Up 175 if (st + $(window).height() < $(document).height()) { 176 header.removeClass('nav-up').addClass('nav-down'); 177 } 178 } 179 180 lastScrollTop = st; 181 182 } 183 184 185 186 // --------------------------------------------------------------- // 187 // --------------------------------------------------------------- // 188 // --- SKROLLR --------------------------------------------------- // 189 // --------------------------------------------------------------- // 190 // --------------------------------------------------------------- // 191 192 skrollrCheck = debounce(function() { 193 var winWidth = window.innerWidth, 194 minWidth = 1024; 195 196 if (winWidth > minWidth) { 197 // Init Skrollr 198 skrollr.init({ 199 forceHeight: false, //disable setting height on body 200 mobileDeceleration: 0.05, 201 smoothScrolling: false, 202 smoothScrollingDuration: 0 203 }); 204 skrollr.get().refresh(); 205 $(window).scrollTop(0); 206 } else { 207 // Destroy skrollr for screens less than 600px 208 if (skrollr.get() !== undefined) { 209 skrollr.get().destroy(); 210 } 211 } 212 }, 250); 213 214 //Initialize skrollr, but only if it exists 215 if (typeof skrollr !== typeof undefined) { 216 // INITIALIZE 217 window.onload = skrollrCheck(); 218 window.addEventListener('resize', skrollrCheck); 219 } else { 220 console.log('skrollr is missing.'); 221 } 222 223 // --------------------------------------------------------------- // 224 // --------------------------------------------------------------- // 225 // --- MOVE BACKGROUND LANDING ----------------------------------- // 226 // --------------------------------------------------------------- // 227 // --------------------------------------------------------------- // 228 229 function moveBackground(e) { 230 var ww = window.innerWidth, 231 ltr = -(e.pageX - ww/2) / 5, 232 imgLtr = (e.pageX - ww/2) / 40, 233 imgRtl = -(e.pageX - ww/2) / 40, 234 txtLtr = (e.pageX - ww/2) / 15, 235 txtRtl = -(e.pageX - ww/2) / 15, 236 237 main = $('.main-home'), 238 239 imgL = main.find('.section-branch.artiste img'), 240 imgR = main.find('.section-branch.atelier img'), 241 242 txtL = main.find('.section-branch.artiste hgroup'), 243 txtR = main.find('.section-branch.atelier hgroup'); 244 245 TweenMax.to(main, 2, { 246 x: ltr, 247 ease: Power4.easeOut 248 }); 249 TweenMax.to(imgL, 2, { 250 x: imgRtl, 251 ease: Power4.easeOut 252 }); 253 TweenMax.to(imgR, 2, { 254 x: imgRtl, 255 ease: Power4.easeOut 256 }); 257 258 TweenMax.to(txtL, 2, { 259 x: txtLtr, 260 ease: Power4.easeOut 261 }); 262 TweenMax.to(txtR, 2, { 263 x: txtLtr, 264 ease: Power4.easeOut 265 }); 266 } 267 $(document).on('mousemove', function(event) { 268 var winWidth = window.innerWidth; 269 if (winWidth > 1024) { 270 271 window.requestAnimationFrame(function() { 272 273 moveBackground(event); 274 275 }); 276 277 } 278 }); 279 280 // --------------------------------------------------------------- // 281 // --------------------------------------------------------------- // 282 // --- SWIPERS --------------------------------------------------- // 283 // --------------------------------------------------------------- // 284 // --------------------------------------------------------------- // 285 286 var projetSlider = new Swiper('.projet-slider', { 287 speed: 600,
288 preloadImages: false, 289 loop: true, 290 lazy: { 291 loadPrevNext: true, 292 loadPrevNextAmount: 3 293 }, 294 watchSlidesVisibility: true, 295 freeMode: true, 296 spaceBetween: 16, 297 slidesPerView: 'auto', 298 grabCursor: true, 299 navigation: { 300 nextEl: '.projet-slider-next', 301 prevEl: '.projet-slider-prev', 302 }, 303 }); 304 305 var swiperProject = new Swiper('.projet-slider-2', { 306 slidesPerView: 'auto', 307 speed: 600, 308 loop: true, 309 spaceBetween: 120, 310 navigation: { 311 nextEl: '.projet-slider-next', 312 prevEl: '.projet-slider-prev', 313 }, 314 breakpoints: { 315 768: { 316 spaceBetween: 20, 317 }, 318 1025: { 319 spaceBetween: 20 320 } 321 } 322 }); 323 324 var swiperCpLeft = new Swiper('.swiper-cp-left', { 325 // slidesPerView: 'auto', 326 speed: 600, 327 loop: true, 328 breakpoints: { 329 768: { 330 spaceBetween: 20, 331 }, 332 1025: { 333 spaceBetween: 20 334 } 335 } 336 }); 337 338 var swiperCpRight = new Swiper('.swiper-cp-right', { 339 // slidesPerView: 'auto', 340 speed: 600, 341 loop: true, 342 // spaceBetween: 120, 343 navigation: { 344 nextEl: '.swiper-button-next-cp', 345 prevEl: '.swiper-button-prev-cp', 346 }, 347 breakpoints: { 348 768: { 349 spaceBetween: 20, 350 }, 351 1025: { 352 spaceBetween: 20 353 } 354 } 355 }); 356 357 358 if ( $('body').hasClass('single-post') ) { 359 swiperCpRight.controller.control = swiperCpLeft; 360 swiperCpLeft.controller.control = swiperCpRight; 361 } 362 363 364 swiperProject.on( 'init', function() { 365 $('.projet-slider-2').closest( '.swiper' ).addClass( 'loaded' ); 366 } ); 367 368 swiperProject.on( 'touchStart', function() { 369 $('.projet-slider-2').addClass( 'swiper-mousedown' ); 370 } ); 371 372 swiperProject.on( 'touchEnd', function() { 373 $('.projet-slider-2').removeClass( 'swiper-mousedown' ); 374 } ); 375 376 var crossProjectsSlider = new Swiper('.cross-projects-slider', { 377 speed: 600, 378 spaceBetween: 16, 379 loop: true, 380 grabCursor: true, 381 navigation: { 382 nextEl: '.cross-projects-slider-next', 383 prevEl: '.cross-projects-slider-prev', 384 }, 385 breakpointsInverse: true, 386 breakpoints: { 387 768: { 388 spaceBetween: 20, 389 slidesPerView: 2, 390 }, 391 1025: { 392 spaceBetween: 100, 393 slidesPerView: 2 394 } 395 } 396 }); 397 398 crossProjectsSlider.on( 'init', function() { 399 $('.cross-projects-slider').closest( '.swiper' ).addClass( 'loaded' ); 400 } ); 401 402 crossProjectsSlider.on( 'touchStart', function() { 403 $('.cross-projects-slider').addClass( 'swiper-mousedown' ); 404 } ); 405 406 crossProjectsSlider.on( 'touchEnd', function() { 407 $('.cross-projects-slider').removeClass( 'swiper-mousedown' ); 408 } ); 409 410 var othersSliderImg = $('.others-slider-img .img-slide'); 411 412 var othersSliderTxt = new Swiper('.others-slider-txt', { 413 speed: 600, 414 effect: 'fade', 415 loop:true, 416 fadeEffect: { 417 crossFade: true 418 }, 419 autoHeight: true, 420 navigation: { 421 nextEl: '.others-slider-next', 422 prevEl: '.others-slider-prev', 423 } 424 }); 425 function geSlideDataIndex(swipe){ 426 var activeIndex = swipe.activeIndex; 427 var slidesLen = swipe.slides.length; 428 if(swipe.params.loop){ 429 switch(swipe.activeIndex){ 430 case 0: 431 activeIndex = slidesLen-3; 432 break; 433 case slidesLen-1: 434 activeIndex = 0; 435 break; 436 default: 437 --activeIndex; 438 } 439 } 440 return activeIndex; 441 } 442 othersSliderTxt.on('slideChange', function() { 443 othersSliderImg.removeClass('active'); 444 othersSliderImg.eq(geSlideDataIndex(othersSliderTxt)).addClass('active'); 445 }); 446 447 othersSliderImg.on('click', function(event) { 448 449 event.stopPropagation(); 450 var index = $(this).index(); 451 if($(this).is('.active')) { 452 othersSliderTxt.slideNext(); 453 } 454 else { 455 othersSliderTxt.slideTo(index+1); 456 } 457 }); 458 459 // keep track of swiper instances to destroy later 460 let slider; 461 var nextArt = $('a.next-artwork'); 462 slider = new Swiper('.about-slider', { 463 speed: 600,
464 spaceBetween: 20, 465 navigation: { 466 nextEl: '.about-slider-next', 467 prevEl: '.about-slider-prev', 468 } 469 }); 470 471 // --------------------------------------------------------------- // 472 // --------------------------------------------------------------- // 473 // --- SURVOL ITEMS HOMEPAGE / WORKS / MAALEMS ------------------- // 474 // --------------------------------------------------------------- // 475 // --------------------------------------------------------------- // 476 477 $('.section-all-artworks article a.img-col').mouseover(function(){ 478 $(this).parent().parent().parent().removeClass('hovered').removeClass('not-hovered').parent().find('article').addClass('not-hovered'); 479 $(this).parent().parent().parent().parent().parent().parent().parent().parent().find('h1').addClass('not-hovered'); 480 $(this).parent().parent().parent().removeClass('not-hovered').addClass('hovered'); 481 }); 482 483 $('.section-all-artworks article a.img-col').mouseout(function(){ 484 $(this).parent().parent().parent().parent().find('article').removeClass('hovered').removeClass('not-hovered'); 485 $(this).parent().parent().parent().parent().parent().parent().parent().parent().find('h1').removeClass('hovered').removeClass('not-hovered'); 486 }); 487 488 // --------------------------------------------------------------- // 489 // --------------------------------------------------------------- // 490 // --- OPEN / CLOSE VIDEO PLAYER HOMEPAGE ------------------------ // 491 // --------------------------------------------------------------- // 492 // --------------------------------------------------------------- // 493 494 $('.openVideo').click(function(e){ 495 e.preventDefault; 496 var videoId = $(this).data('youtube') 497 $('.videoPlayer').find('iframe').attr('src','https://www.youtube.com/embed/'+videoId+'?autoplay=1'); 498 $('.videoPlayer').addClass('open'); 499 }); 500 501 $('.videoPlayer .closeVideo').click(function(e){ 502 e.preventDefault; 503 $('.videoPlayer').find('iframe').attr('src',''); 504 $('.videoPlayer').removeClass('open'); 505 }); 506 507 const breakpoint = window.matchMedia('(min-width:768px)'); 508 509 const change_slider = function() { 510 // if larger viewport and multi-row layout needed 511 if (breakpoint.matches === true) { 512 // slider.changeDirection('vertical'); 513 slider.destroy(true, true); 514 slider = new Swiper('.about-slider', { 515 speed: 600, 516 navigation: { 517 nextEl: '.about-slider-next', 518 prevEl: '.about-slider-prev', 519 }, 520 grabCursor: true, 521 loop: true, 522 fadeEffect: { 523 crossFade: true 524 }, 525 }); 526 return; 527 // else if a small viewport and single column layout needed 528 } else if (breakpoint.matches === false) { 529 // slider.changeDirection('horizontal'); 530 slider.destroy(true, true); 531 slider = new Swiper('.about-slider', { 532 speed: 600, 533 spaceBetween: 16, 534 navigation: { 535 nextEl: '.about-slider-next', 536 prevEl: '.about-slider-prev', 537 } 538 }); 539 return; 540 } 541 }; 542 if ($('.about-slider').length > 0) { 543 // keep an eye on viewport size changes 544 breakpoint.addListener(change_slider); 545 // kickstart 546 change_slider(); 547 548 } 549 550 if ( $('body').hasClass('page-template-page-atelier') ) { 551 setTimeout(function() { 552 $('.others-slider-next').click(); 553 }, 500) 554 } 555 556 557 }); 558 559 560 561 562 563 564 565$(window).on('load', function() { 566 567 $('body').removeClass("preload"); 568 // $('.site-main').imagesLoaded(function() { 569 570 571 572 // }); 573}); 574 575 576 577 578 // var lastScrollTopV2 = 0; 579 // $(window).scroll(function() { 580 // console.log('okayyy'); 581 // var stV2 = $(this).scrollTop(); // last scroll value 582 // // TOP OR NOT 583 // if (stV2 < 1) { $('body').addClass('scrollTop'); } 584 // else { $('body').removeClass('scrollTop'); } 585 // // UP OR DOWN 586 // if (stV2 < lastScrollTopV2){ $('body').addClass('scrollUp'); } 587 // else { $('body').removeClass('scrollUp'); } 588 // lastScrollTopV2 = stV2; // new scroll value 589 // });
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.