PageSourceSearch

https://uflgame.com/wp-content/themes/theme/blocks/promo-intro/intro-popup.js?ver=1789650021

js uflgame.com collected 2026-09-24 10:47:20 UTC 2,225 bytes, 69 lines download raw bytes

1( function () {
2	'use strict';
3
4	/* setTimeout silently overflows for delays > 2^31-1 ms (~24.8 days) and
5	   fires immediately. Reschedule recursively to avoid that. */
6	var MAX_TIMEOUT_MS = 0x7FFFFFFF; // 2 147 483 647 ms
7
8	function applyDeadline( popup, deadline ) {
9		var msLeft = deadline - Date.now();
10		if ( msLeft <= 0 ) {
11			popup.classList.add( 'active' );
12		} else if ( msLeft > MAX_TIMEOUT_MS ) {
13			setTimeout( function () { applyDeadline( popup, deadline ); }, MAX_TIMEOUT_MS );
14		} else {
15			setTimeout( function () { popup.classList.add( 'active' ); }, msLeft );
16		}
17	}
18
19	/* Fallback: read deadline from the countdown <time datetime> element in the DOM.
20	   This element is always present when timer is enabled and a date is set. */
21	function deadlineFromDom() {
22		var timeEl = document.querySelector( '.intro__countdown time[datetime]' );
23		if ( ! timeEl ) return 0;
24		var ts = new Date( timeEl.getAttribute( 'datetime' ) ).getTime();
25		return isNaN( ts ) ? 0 : ts;
26	}
27
28	function initPopup() {
29		var popup = document.querySelector( '.popup.intro-popup' );
30		if ( ! popup ) return;
31
32		var postId  = popup.getAttribute( 'data-post-id' );
33		var apiBase = popup.getAttribute( 'data-api' );
34
35		function handleDeadline( deadline ) {
36			if ( deadline ) {
37				applyDeadline( popup, deadline );
38				return;
39			}
40			/* REST returned nothing — fall back to DOM */
41			var dom = deadlineFromDom();
42			if ( dom ) applyDeadline( popup, dom );
43		}
44
45		if ( postId && postId !== '0' && apiBase ) {
46			fetch( apiBase + postId, { credentials: 'same-origin' } )
47				.then( function ( r ) { return r.json(); } )
48				.then( function ( data ) {
49					var ts = ( data && data.deadline ) ? new Date( data.deadline ).getTime() : 0;
50					handleDeadline( isNaN( ts ) ? 0 : ts );
51				} )
52				.catch( function () {
53					/* REST failed — use DOM fallback */
54					var dom = deadlineFromDom();
55					if ( dom ) applyDeadline( popup, dom );
56				} );
57		} else {
58			/* No valid post ID — use DOM fallback directly */
59			var dom = deadlineFromDom();
60			if ( dom ) applyDeadline( popup, dom );
61		}
62	}
63
64	if ( document.readyState === 'loading' ) {
65		document.addEventListener( 'DOMContentLoaded', initPopup );
66	} else {
67		initPopup();
68	}
69}() );

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.