PageSourceSearch

https://sarock.com.au/res/pwa.js?2026-2-5-0

js sarock.com.au collected 2026-10-08 21:23:49 UTC 2,150 bytes, 86 lines download raw bytes

1
2var isIOS = [
3    'iPad Simulator',
4    'iPhone Simulator',
5    'iPod Simulator',
6    'iPad',
7    'iPhone',
8    'iPod'
9  ].includes(navigator.platform)
10  // iPad on iOS 13 detection
11  || (navigator.userAgent.includes("Mac") && "ontouchend" in document);
12
13var isAndroid = /(android)/i.test(navigator.userAgent);
14
15
16
17var hiddenInterval = 7*24*60*60*1000;
18
19function readLastHidden(){
20	let result = localStorage.getItem("pwaBannerHiddenTime");
21	if ( result == null ) {
22		return 0;
23	}
24	return result;
25}
26
27function writeLastHidden(){
28	localStorage.setItem("pwaBannerHiddenTime", (new Date()).getTime());
29}
30
31function isItTimeToShowBanner(){
32	if (window.matchMedia('(display-mode: standalone)').matches) return false;
33	let now = (new Date()).getTime();
34	let lastHidden = readLastHidden();
35	return ( now - lastHidden > hiddenInterval);
36}
37
38
39
40if ( ( isIOS || isAndroid ) && isItTimeToShowBanner() ) {
41
42	let installPrompt = null;
43
44	const installBanner = document.querySelector("#install_banner");
45	const installButtonContainer = document.querySelector("#install_button_container");
46	const installButton = document.querySelector("#install_button");
47	const installTextIOS = document.querySelector("#install_text_2");
48	const closeButton = document.querySelector("#install_close");
49
50	installBanner.style.display="block";
51	writeLastHidden();
52
53	if (isIOS) {
54		installButtonContainer.style.display="none";
55		installButton.style.display="none";
56	} else {
57		installTextIOS.style.display="none";
58	}
59
60	window.addEventListener("beforeinstallprompt", (event) => {
61		event.preventDefault();
62		installPrompt = event;
63	});
64
65	closeButton.addEventListener("click", async () => {
66		installBanner.style.display="none";
67	});
68
69	function disableInAppInstallPrompt() {
70		installPrompt = null;
71		installBanner.style.display="none";
72	}
73
74	installButton.addEventListener("click", async () => {
75		if (!installPrompt) {
76			return;
77		}
78		const result = await installPrompt.prompt();
79		disableInAppInstallPrompt();
80	});
81
82	window.addEventListener("appinstalled", () => {
83		disableInAppInstallPrompt();
84	});
85
86}

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.