PageSourceSearch

https://www.kayak.com/news/wp-content/plugins/r9-components/public/ScrollToTop/scripts.js?ver=35697182006

js kayak.com collected 2026-09-24 07:33:40 UTC 4,143 bytes, 2 lines download raw bytes

1(()=>{"use strict";class t{constructor(t,e=!1){if(this.handlers=[],this.event=t,e){let t;window.addEventListener(this.event,()=>{t&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(this.fire.bind(this))},!1)}else window.addEventListener(this.event,this.fire.bind(this));"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?this.fire():document.addEventListener("DOMContentLoaded",()=>{this.fire()})}subscribe(t,e=!1){this.handlers.push(t),e&&t()}unsubscribe(t){this.handlers=this.handlers.filter(e=>{if(e!==t)return e})}fire(){this.handlers.forEach(t=>{t()})}}const e=new t("resize",!0),i=new t("scroll",!0);function s(t){return Math.floor(t.getBoundingClientRect().top)}const n="DOWN";new class{constructor(){this.el=null,this.pageHeight=null,this.viewPortHeight=null,this.minDistance=null,this.prevPosition=null,this.currPosition=null,this.prevDirection=null,this.currDirection=null,this.isActive=!1,this.disableUpdateState=!1,this.topElementId=null,this.init()}init(){if(this.el=document.getElementById("scroll-to-top-fab"),this.el){this.onRestart(),i.subscribe(this.onScroll.bind(this),!1),e.subscribe(this.onRestart.bind(this),!1),this.el.addEventListener("click",this.onElTrigger.bind(this)),this.el.addEventListener("keydown",this.onElTrigger.bind(this)),document.addEventListener("keydown",this.onKeyTab.bind(this));const t=document.querySelector("body > *:first-child"),s=t.getAttribute("id");return null===s?(this.topElementId="document-top",t.setAttribute("id",this.topElementId)):this.topElementId=s,this.el.classList.add("ready"),!0}return!1}onScroll(){this.disableUpdateState||this.updateState()}onRestart(){this.viewPortHeight=window.innerHeight,this.pageHeight=document.documentElement.scrollHeight,this.minDistance=Math.min(1.5*this.viewPortHeight,this.pageHeight),this.updateState()}onElTrigger(t){"click"===t.type&&this.scrollToTop(),"keydown"===t.type&&[13,32].includes(t.keyCode)&&this.scrollToTop()}onKeyTab(t){9===t.keyCode&&(this.disableUpdateState=!0,this.isActive||(this.setIsActive(!0),this.updateElClasses()),setTimeout(()=>{this.disableUpdateState=!1},1e3))}setIsActive(t){this.isActive=t}meetsMinPosition(){return this.minDistance<this.currPosition}isScrollDirectionChange(){return this.currDirection!==this.prevDirection}isScrollDown(){return this.currPosition>this.prevPosition}isScrollUp(){return this.currPosition<this.prevPosition}scrollToTop(){!function(t,e=0){if(!t||t.length<=1)return;const i=document.getElementById(t);if(!i)return;setTimeout(()=>{const t=s(i)-e;window.scrollBy({top:t,left:0,behavior:"smooth"})},0);let n=0;const o=setInterval(()=>{n++;const r=window.innerHeight+window.scrollY>=document.body.offsetHeight-2;(s(i)-e===0||r||n>
1=20)&&(i.tabIndex="-1",function(t,e={}){if(!t)return;t.setAttribute("data-no-focus-outline","true"),t.focus(e);const i=()=>{t.removeAttribute("data-no-focus-outline"),t.removeEventListener("blur",i)};t.addEventListener("blur",i,{once:!0})}(i,{preventScroll:!0,focusVisible:!1}),window.location.hash!==`#${t}`&&window.history.pushState("","",window.location.pathname+window.location.search+`#${t}`),clearInterval(o))},50)}(this.topElementId,0)}getCurrentPosition(){return document.documentElement.scrollTop||document.body.scrollTop}getCurrentDirection(){return this.isScrollDown()?"DOWN":this.isScrollUp()?"UP":n}updateState(){this.prevPosition=this.currPosition||0,this.currPosition=this.getCurrentPosition(),this.prevDirection=this.currDirection||n,this.currDirection=this.getCurrentDirection(),this.meetsMinPosition()&&this.isScrollDirectionChange()&&(this.isScrollUp()?this.setIsActive(!0):this.setIsActive(!1),this.updateElClasses()),this.isActive&&!this.meetsMinPosition()&&(this.setIsActive(!1),this.updateElClasses())}updateElClasses(){this.isActive?(this.el.classList.add("is-active"),this.el.classList.remove("is-not-active"),this.el.removeAttribute("inert"),this.el.setAttribute("tabindex","0")):(this.el.classList.add("is-not-active"),this.el.classList.remove("is-active"),this.el.setAttribute("inert",!0),this.el.setAttribute("tabindex","-1"))}}})();
2//# sourceMappingURL=scripts.js.map

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.