PageSourceSearch

https://www.hockeytime.net/_av_share/branches/beta/wp_themes/seaml…/js/av-sticky-sidebar.js?t=1760516172

js hockeytime.net collected 2026-10-02 12:50:05 UTC 1,998 bytes, 54 lines download raw bytes

1/**
2 * This method allows the desktop sidebar to "lock" in place and only scroll upwards
3 * It does so by leveraging CSS Sticky positioning: the element starts in sticky
4 * positioning right from the start. When the timeout expires, the top is calculated
5 * and the container gets moved to relative positioning from top container
6 * When the scroll goes upwards crossing the limit, the position goes back in sticky,
7 * until the final top container is reached. The block then moves to static.
8 * Then, the scroll listener is removed to increase performance.
9 */
10(function(){
11	const timeout = 10000; // 10 seconds
12	let initialPosition = 0;
13	let sticky;
14
15	// Callback function for scroll detection
16	function handleScroll() {
17		let actualScroll = window.scrollY - initialPosition;
18		let newVal = (sticky.offsetTop + actualScroll);
19
20		// If scrolling is negative in respect to the line crossing, scroll up and update pos
21		if (actualScroll < 0 && newVal > 0 ) {
22			sticky.style.position = "sticky";
23			sticky.style.top = "0px";
24			initialPosition = window.scrollY;
25		} else if (actualScroll > 0) {
26			sticky.style.top = sticky.offsetTop + "px";
27			sticky.style.position = "relative";
28		} else if (newVal <= 0) {
29			// Top reached: reset to static positioning and detatch listener
30			sticky.style.top = "";
31			sticky.style.position = "static";
32			document.removeEventListener('scroll', handleScroll);
33		}
34	}
35
36	// This functions triggers after the timeout and locks the bar, adding the listener
37	function lockScroll() {
38		sticky = document.querySelector(".av-sidebar-sticky-wrap");
39		if (!sticky) return;
40		initialPosition = window.scrollY;
41		sticky.style.top = sticky.offsetTop + "px";
42		sticky.style.position = "relative";
43		document.addEventListener('scroll', handleScroll, false);
44	}
45
46	// Delayed lock launch on viewability
47	if (document.hidden) {
48		document.addEventListener('visibilitychange', () => {
49			setTimeout(lockScroll, timeout);
50		});
51	} else {
52		setTimeout(lockScroll, timeout);
53	}
54})();

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.