Repository navigation
Expand file tree
/
Copy pathsettings.html
More file actions
276 lines (236 loc) · 9.4 KB
/
Copy pathsettings.html
File metadata and controls
276 lines (236 loc) · 9.4 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-K8CCSDNPV3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-K8CCSDNPV3');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="icon" href="https://raw.githubusercontent.com/voucan/voucan.github.io/refs/heads/main/googleclassroom.png" type="image/png">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<style>
body {
background-color: black;
background-size: cover;
font-family: 'Arial', sans-serif;
margin: 0;
color: #ffffff;
padding: 0;
}
.settings-container {
background-color: rgba(0, 0, 0, 0.8);
border-radius: 10px;
width: 100%;
max-width: 400px;
margin: 50px auto;
padding: 20px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
text-align: center;
}
.settings-container h1 {
color: white;
font-size: 24px;
margin-bottom: 20px;
font-weight: bold;
}
.settings-container label {
display: block;
margin: 10px 0 5px;
font-size: 16px;
}
.settings-container input[type="text"], .settings-container input[type="file"] {
padding: 8px;
width: 100%;
margin: 5px 0;
border: 2px solid #444;
border-radius: 8px;
background-color: #222;
color: white;
font-size: 14px;
}
.settings-container input[type="checkbox"] {
margin: 10px 0;
}
.checkbox-container {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
margin-bottom: 20px;
}
.checkbox-container label {
margin: 0;
}
.settings-container button {
padding: 10px;
width: 100%;
background-color: #444;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
margin-top: 10px;
transition: background-color 0.3s ease;
}
.settings-container button:hover {
background-color: #666;
}
.reset-button {
background-color: #f44336;
}
.reset-button:hover {
background-color: #d32f2f;
}
hr {
border: 1px solid #555;
margin: 20px 0;
}
</style>
</head>
<body>
<div class="settings-container">
<h1>Settings</h1>
<div class="checkbox-container">
<div>
<label for="beforeUnloadToggle">Anti-Close</label>
<input type="checkbox" id="beforeUnloadToggle" />
</div>
<div>
<label for="autocloakToggle">Auto-about:blank</label>
<input type="checkbox" id="autocloakToggle" />
</div>
</div>
<hr>
<label for="siteTitle">Set Site Title:</label>
<input type="text" id="siteTitle" placeholder="Enter site title" />
<label for="siteLogo">Set Site Favicon:</label>
<input type="file" id="siteLogo" accept="image/*" />
<button id="saveSettings">Save Title & Favicon</button>
<hr>
<label for="panicKey">Set Panic Button Key:</label>
<input type="text" id="panicKey" placeholder="Enter key (e.g., F1)" />
<label for="panicUrl">Set Panic Button URL:</label>
<input type="text" id="panicUrl" placeholder="Enter URL to redirect to" />
<button id="savePanicButtonSettings">Save Panic Button Settings</button>
<hr>
<button id="resetSettings" class="reset-button">Reset Tab Name and Icon</button>
<button id="resetPanicButtonSettings" class="reset-button">Reset Panic Button Settings</button>
</div>
<script>
const beforeUnloadToggle = document.getElementById('beforeUnloadToggle');
const autocloakToggle = document.getElementById('autocloakToggle');
const siteTitleInput = document.getElementById('siteTitle');
const siteLogoInput = document.getElementById('siteLogo');
const panicKeyInput = document.getElementById('panicKey');
const panicUrlInput = document.getElementById('panicUrl');
const saveSettingsButton = document.getElementById('saveSettings');
const savePanicButtonSettingsButton = document.getElementById('savePanicButtonSettings');
const resetSettingsButton = document.getElementById('resetSettings');
const resetPanicButtonSettingsButton = document.getElementById('resetPanicButtonSettings');
beforeUnloadToggle.checked = localStorage.getItem('beforeUnloadEnabled') === 'true';
autocloakToggle.checked = localStorage.getItem('autocloakEnabled') === 'true';
siteTitleInput.value = localStorage.getItem('siteTitle') || '';
panicKeyInput.value = localStorage.getItem('panicKey') || '';
panicUrlInput.value = localStorage.getItem('panicUrl') || '';
const savedLogo = localStorage.getItem('siteLogo');
if (savedLogo) {
const faviconLink = document.createElement('link');
faviconLink.rel = 'icon';
faviconLink.href = savedLogo;
document.head.appendChild(faviconLink);
}
saveSettingsButton.addEventListener('click', function() {
const siteTitle = siteTitleInput.value;
const siteLogoFile = siteLogoInput.files[0];
if (siteTitle) {
localStorage.setItem('siteTitle', siteTitle);
}
if (siteLogoFile) {
const reader = new FileReader();
reader.onload = function(event) {
const logoUrl = event.target.result;
localStorage.setItem('siteLogo', logoUrl);
const faviconLink = document.createElement('link');
faviconLink.rel = 'icon';
faviconLink.href = logoUrl;
document.head.appendChild(faviconLink);
};
reader.readAsDataURL(siteLogoFile);
}
});
savePanicButtonSettingsButton.addEventListener('click', function() {
const panicKey = panicKeyInput.value;
const panicUrl = panicUrlInput.value;
if (panicKey) {
localStorage.setItem('panicKey', panicKey);
}
if (panicUrl) {
localStorage.setItem('panicUrl', panicUrl);
}
});
resetSettingsButton.addEventListener('click', function() {
localStorage.removeItem('siteTitle');
localStorage.removeItem('siteLogo');
document.title = 'Home';
const defaultFaviconLink = document.querySelector('link[rel="icon"]');
if (defaultFaviconLink) {
defaultFaviconLink.href = 'https://raw.githubusercontent.com/voucan/voucan.github.io/refs/heads/main/googleclassroom.png';
}
});
resetPanicButtonSettingsButton.addEventListener('click', function() {
localStorage.removeItem('panicKey');
localStorage.removeItem('panicUrl');
});
beforeUnloadToggle.addEventListener('change', function() {
localStorage.setItem('beforeUnloadEnabled', beforeUnloadToggle.checked);
if (beforeUnloadToggle.checked) {
window.addEventListener('beforeunload', function(e) {
e.preventDefault();
e.returnValue = '';
});
} else {
window.removeEventListener('beforeunload', function(e) {
e.preventDefault();
e.returnValue = '';
});
}
});
autocloakToggle.addEventListener('change', function() {
localStorage.setItem('autocloakEnabled', autocloakToggle.checked);
if (autocloakToggle.checked) {
const newTab = window.open('about:blank', '_blank');
if (newTab) {
const iframe = document.createElement('iframe');
iframe.src = '/';
iframe.style.width = '100vw';
iframe.style.height = '100vh';
iframe.style.border = 'none';
newTab.document.body.style.margin = '0';
newTab.document.body.appendChild(iframe);
}
const panicUrl = localStorage.getItem('panicUrl') || "https://classroom.google.com";
window.location.href = panicUrl;
}
});
if (beforeUnloadToggle.checked) {
window.addEventListener('beforeunload', function(e) {
e.preventDefault();
e.returnValue = '';
});
}
window.addEventListener('keydown', function(event) {
const panicKey = localStorage.getItem('panicKey');
const panicUrl = localStorage.getItem('panicUrl');
if (event.key === panicKey && panicUrl) {
window.location.href = panicUrl;
}
});
</script>
</body>
</html>