PageSourceSearch

https://spacewaves2.net/template/default/js/pwa-register.js

js spacewaves2.net collected 2026-09-26 03:39:14 UTC 1,620 bytes, 38 lines download raw bytes

1(function () {
2	if ('serviceWorker' in navigator) {
3		window.addEventListener('load', function () {
4			navigator.serviceWorker.register('/sw.js', { scope: '/' }).catch(function () {});
5		});
6	}
7	if (document.getElementById('expand-btn') || document.getElementById('game-frame')) {
8		var s = document.createElement('script');
9		s.src = '/template/default/js/game-mobile-expand.js?v=play-expand-10';
10		s.defer = true;
11		(document.head || document.documentElement).appendChild(s);
12	}
13
14	/* Capture BIP immediately — static snapshots without inc_pwa_install.html have no
15	   other early listener, and the idle-loaded logic would miss the event. */
16	window.__SPACEWAVES_PWA_DEFERRED = window.__SPACEWAVES_PWA_DEFERRED || null;
17	window.addEventListener('beforeinstallprompt', function (e) {
18		e.preventDefault();
19		window.__SPACEWAVES_PWA_DEFERRED = e;
20	});
21
22	/* Install prompt logic. inc_pwa_install.html schedules the same load with the
23	   same guard, so pages that already output the banner fetch it only once. */
24	function loadPwaInstall() {
25		if (window.__SPACEWAVES_PWA_SCRIPT) return;
26		window.__SPACEWAVES_PWA_SCRIPT = true;
27		var el = document.createElement('script');
28		el.src = '/template/default/js/spacewaves_pwa_install.js';
29		el.async = true;
30		(document.head || document.documentElement).appendChild(el);
31	}
32	function schedulePwaInstall() {
33		if ('requestIdleCallback' in window) requestIdleCallback(loadPwaInstall, { timeout: 3500 });
34		else setTimeout(loadPwaInstall, 2000);
35	}
36	if (document.readyState === 'complete') schedulePwaInstall();
37	else window.addEventListener('load', schedulePwaInstall);
38})();

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.