forked from craep0/gn-math.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
155 lines (143 loc) · 6.46 KB
/
index.html
File metadata and controls
155 lines (143 loc) · 6.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<script>
navigator.serviceWorker.register('/sw.js');
</script>
<!-- PWA Manifest for Fullscreen App -->
<link rel="manifest" href="manifest.json">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#000000">
<!-- Favicons -->
<link rel="icon" type="image/png" href="favicon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png">
<link rel="apple-touch-icon" href="/favicon.png">
<!-- Main Script -->
<!-- Meta Tags -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GoonGames</title>
<meta name="title" content="GoonGames">
<meta name="description" content="Play unbl*cked games like Crazy Cattle 3D and DriveMad on GoonGames. Fast, free, no downloads—perfect for school or home.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://goon-games.vercel.app/">
<meta property="og:title" content="GoonGames">
<meta property="og:description" content="Play unbl*cked games like Crazy Cattle 3D and DriveMad on GoonGames. Fast, free, no downloads—perfect for school or home.">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://goon-games.vercel.app/">
<meta name="twitter:title" content="GoonGames">
<meta name="twitter:description" content="Play unbl*cked games like Crazy Cattle 3D and DriveMad on GoonGames. Fast, free, no downloads—perfect for school or home.">
<!-- Styles -->
<link rel="stylesheet" href="style.css">
<!-- PWA Install Prompt -->
<script>
// Prevent leaving confirmation (existing)
window.addEventListener('beforeunload', function (event) {
event.preventDefault();
event.returnValue = '';
return 'Are you sure you want to leave? Any unsaved changes will be lost.';
});
// PWA Service Worker Registration (NEW)
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('sw.js')
.then(registration => {
console.log('PWA Service Worker registered');
})
.catch(err => {
console.log('Service Worker registration failed: ', err);
});
});
}
// PWA Install Prompt (NEW)
let deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
// Optionally show an install button
setTimeout(() => {
if (deferredPrompt && !window.matchMedia('(display-mode: standalone)').matches) {
// You could show an install button here
console.log('PWA install available');
}
}, 3000);
});
// Detect if running as installed app (NEW)
if (window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone) {
document.documentElement.classList.add('pwa-mode');
console.log('Running as installed PWA app');
}
</script>
</head>
<body class="dark-mode">
<header>
<div class="header-content">
<div class="logo">GoonGames</div>
<div class="search-container">
<input type="text" id="searchBar" placeholder="Search zones..." oninput="filterZones()">
<select id="sortOptions" onchange="sortZones()">
<option value="name">Name</option>
<option value="id">ID (Date)</option>
<option value="popular">Popular</option>
</select>
</div>
<div class="control-buttons">
<button id="settings" style="background-color: var(--primary-color); color: white; border: none; border-radius: 4px; padding: 0.5rem 1rem; font-size: 16px; cursor: pointer;">Settings</button>
</div>
</div>
</header>
<main>
<details id="featuredZonesWrapper" open>
<summary id="allZonesSummary" style="font-size: 1.2rem; font-weight: bold; cursor: pointer;">Featured Zones</summary>
<div id="featuredZones" class="zone-container"></div>
</details>
<br><hr><br>
<details id="allZonesWrapper" open>
<summary id="allSummary" style="font-size: 1.2rem; font-weight: bold; cursor: pointer;">All Zones</summary>
<div id="container">Loading...</div>
</details>
</main>
<div id="zoneViewer">
<div class="zone-header">
<div class="zone-title">
<h2 id="zoneName">zone</h2>
<span id="zoneId" style="display: none;"></span>
<a id="zoneAuthor" href="#" target="_blank">by Author</a>
</div>
<div class="zone-controls">
<button onclick="fullscreenZone()">Fullscreen</button>
<button onclick="aboutBlank()">Open in New Tab</button>
<button onclick="downloadZone()">Download</button>
<button onclick="closeZone()">Close</button>
</div>
</div>
<iframe id="zoneFrame"></iframe>
</div>
<div id="popupOverlay">
<div class="popup">
<div class="popup-header">
<h3 id="popupTitle">Title</h3>
<button id="popupClose" onclick="closePopup()">×</button>
</div>
<div id="popupBody">
Content will be here
</div>
</div>
</div>
<footer>
<div class="footer-links">
<a href="javascript:saveData()">Export Data</a>
<a href="#" onclick="document.getElementById('importData').click(); return false;">Import Data</a>
<input type="file" id="importData" style="display: none;" onchange="loadData(event)">
</div>
</footer>
<script src="script.js"></script>
<script>
const search = new URLSearchParams(window.location.search);
const privacy = search.get('privacy');
if (privacy) {
loadPrivacy();
}
</script>
</body>
</html>