PageSourceSearch

https://www.jansatta.com/wp-content/themes/ie-network-theme/ctd-cl…/desktop-next-story.js?ver=06042026.01

js jansatta.com collected 2026-09-24 09:19:08 UTC 1,844 bytes, 77 lines download raw bytes

1(function () {
2	/***
3	 * This JS is used for the desktop Next Story widget.
4	 * It shows the widget on scroll, and if the user closes it,
5	 * the widget will be hidden for 24 hours and automatically shown again after that.
6	 */
7	const widget = document.getElementById( 'floatingNextStory' );
8	if ( ! widget ) {
9		return;
10	}
11
12	const closeBtn    = widget.querySelector( '.next-story-close' );
13	let lastY         = window.scrollY;
14	let closed        = false;
15	let activated     = false;
16	const STORAGE_KEY = 'nextStoryClosed';
17	const EXPIRY_TIME = 24 * 60 * 60 * 1000; // 24 hours in ms
18
19	function isClosedRecently() {
20		try {
21			const stored = localStorage.getItem( STORAGE_KEY );
22			if ( ! stored ) {
23				return false;
24			}
25			const data = JSON.parse( stored );
26			const now  = Date.now();
27			// Check if within 24 hours
28			if ( now - data.time < EXPIRY_TIME ) {
29				return true;
30			}
31			// Expired → clean up
32			localStorage.removeItem( STORAGE_KEY );
33			return false;
34		} catch ( e ) {
35			return false;
36		}
37	}
38
39	function onScroll() {
40		if ( closed ) {
41			return;
42		}
43		const y = window.scrollY;
44		if ( ! activated && y > 0 ) {
45			activated = true;
46			widget.classList.add( 'show' );
47		}
48		if ( y === 0 ) {
49			widget.classList.remove( 'show' );
50		}
51		if ( activated ) {
52			if ( y < lastY || window.innerHeight + y >= document.documentElement.scrollHeight - 200 ) {
53				widget.classList.add( 'show' );
54			}
55		}
56		lastY = y;
57	}
58	if ( isClosedRecently() ) {
59		closed = true;
60		widget.classList.remove( 'show' );
61	} else {
62		window.addEventListener( 'scroll', onScroll, { passive: true } );
63	}
64	if ( closeBtn ) {
65		closeBtn.onclick = function () {
66			widget.classList.remove( 'show' );
67			closed = true;
68			try {
69				localStorage.setItem(
70					STORAGE_KEY,
71					JSON.stringify( { time: Date.now() } )
72				);
73			} catch ( e ) {
74			}
75		};
76	}
77})();

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.