PageSourceSearch

https://www.chathamdailynews.ca/wp-content/themes/postmedia-master…/timed-sticky/index.js?ver=1790268643

js chathamdailynews.ca collected 2026-09-24 19:03:46 UTC 2,847 bytes, 1 lines download raw bytes

1(()=>{"use strict";class e extends HTMLElement{static ROOT_TIMED_STICKY_OFFSET_CSS_VAR="--timed-sticky-offset";static DEFAULT_STICKY_DURATION_MS=5e3;resizeObserver=null;releaseTimeoutId=null;stickyDurationMs=e.DEFAULT_STICKY_DURATION_MS;contentHeightPx=0;isReleasedPhaseActive=!1;releaseStartScrollYPx=0;releaseScrollDeltaPx=0;connectedCallback(){const e=this.getAttribute("sticky");null!==e&&"false"===e.toLowerCase()||document.addEventListener("DOMContentLoaded",this.init.bind(this))}init(){this.stickyDurationMs=this.getStickyDurationMs(),this.updateWrapperHeight(),this.observeWrapperHeight(),this.setAttribute("sticky-state","active"),this.setGlobalOffset(this.contentHeightPx),this.releaseTimeoutId=window.setTimeout(()=>{this.releaseStickyState()},this.stickyDurationMs)}releaseStickyState(){null!==this.releaseTimeoutId&&(window.clearTimeout(this.releaseTimeoutId),this.releaseTimeoutId=null),this.setAttribute("sticky-state","released"),this.isReleasedPhaseActive=!0,this.releaseStartScrollYPx=window.scrollY,this.releaseScrollDeltaPx=0,this.style.removeProperty("transform"),this.collapseAdSlot(),window.addEventListener("scroll",this.collapseAdSlot,{passive:!0})}observeWrapperHeight(){"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{this.updateWrapperHeight()}),this.resizeObserver.observe(this))}getStickyDurationMs(){var t;const s=null!==(t=this.getAttribute("time")?.trim())&&void 0!==t?t:"",i=Number.parseInt(s,10);return!Number.isFinite(i)||i<0?e.DEFAULT_STICKY_DURATION_MS:i}updateWrapperHeight=()=>{this.contentHeightPx=Math.max(this.getBoundingClientRect().height,0),"active"!==this.getAttribute("sticky-state")?this.isReleasedPhaseActive&&this.collapseAdSlot():this.setGlobalOffset(this.contentHeightPx)};collapseAdSlot=()=>{const e=Math.max(window.scrollY-this.releaseStartScrollYPx,0);this.releaseScrollDeltaPx=e;const t=Math.min(this.releaseScrollDeltaPx,this.contentHeightPx),s=Math.max(this.contentHeightPx-t,0);this.style.transform=`translate3d(0, -${t}px, 0)`,s<=0?this.endReleasedPhase():this.setGlobalOffset(s)};endReleasedPhase(){this.isReleasedPhaseActive&&(this.isReleasedPhaseActive=!1,window.removeEventListener("scroll",this.collapseAdSlot),this.removeAttribute("sticky-state"),this.style.removeProperty("transform"),this.setGlobalOffset(null))}setGlobalOffset(t){null===t||t<=0?document.documentElement.style.removeProperty(e.ROOT_TIMED_STICKY_OFFSET_CSS_VAR):document.documentElement.style.setProperty(e.ROOT_TIMED_STICKY_OFFSET_CSS_VAR,`${t}px`)}disconnectedCallback(){window.removeEventListener("scroll",this.collapseAdSlot),null!==this.releaseTimeoutId&&(window.clearTimeout(this.releaseTimeoutId),this.releaseTimeoutId=null),this.resizeObserver?.disconnect(),this.resizeObserver=null}}customElements.get("pm-timed-sticky")||customElements.define("pm-timed-sticky",e)})();

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.