1document.addEventListener('DOMContentLoaded', function() { 2 var elevator = document.querySelector('.elevator__button'); 3 if (elevator) { 4 elevator.addEventListener('click', function () { 5 scrollTo(document.documentElement, 0, 500); 6 }); 7 } 8 9 reservationWidget = document.querySelector('.np-home__reservation'); 10 11 if (reservationWidget) { 12 scroll = reservationWidget.offsetTop; 13 } 14 window.addEventListener('scroll', reservationScroll); 15 jQuery('.nav-button').click(function() { 16 jQuery('body').toggleClass('stopScrolling'); 17 }); 18}); 19 20function scrollTo(element, to, duration) { 21 var start = element.scrollTop, 22 change = to - start, 23 increment = 20; 24 25 var animateScroll = function(elapsedTime) { 26 elapsedTime += increment; 27 var position = easeInOut(elapsedTime, start, change, duration); 28 element.scrollTop = position; 29 if (elapsedTime < duration) { 30 setTimeout(function() { 31 animateScroll(elapsedTime); 32 }, increment); 33 } 34 }; 35 36 animateScroll(0); 37} 38 39function easeInOut(currentTime, start, change, duration) { 40 currentTime /= duration / 2; 41 if (currentTime < 1) { 42 return change / 2 * currentTime * currentTime + start; 43 } 44 currentTime -= 1; 45 return -change / 2 * (currentTime * (currentTime - 2) - 1) + start; 46} 47 48function debounce(func, wait, immediate) { 49 var timeout; 50 return function() { 51 var context = this, args = arguments; 52 var later = function() { 53 timeout = null; 54 if (!immediate) func.apply(context, args); 55 }; 56 var callNow = immediate && !timeout; 57 clearTimeout(timeout); 58 timeout = setTimeout(later, wait); 59 if (callNow) func.apply(context, args); 60 }; 61}; 62 63var scroll = 0; 64var reservationScroll = debounce(function (event) { 65 var reservationWidget = document.querySelector('.np-home__reservation'); 66 if (! reservationWidget) { 67 return; 68 } 69 var boundingBox = reservationWidget.getBoundingClientRect(); 70 71 if (window.pageYOffset < (scroll - reservationWidget.scrollHeight)) { 72 document.body.classList.remove('bind-reservation'); 73 } else { 74 document.body.classList.add('bind-reservation'); 75 } 76}, 0); 77 78 79
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.