forked from purify-video/purify-video.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
316 lines (278 loc) · 8.26 KB
/
index.html
File metadata and controls
316 lines (278 loc) · 8.26 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Watch purified YouTube videos with no ads. Just focus." />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<title>purify video – watch purified YouTube videos with no ads</title>
<!-- ✅ Google Font: Noto Sans. -->
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;600&display=swap" rel="stylesheet" />
<!-- ✅ Google Material Icons: Light Mode & Dark Mode. -->
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
<style>
/* ===================
Colors palette.
====================== */
:root {
--bg-light: #f4f4f5;
--text-light: #1f1f1f;
--bg-dark: #1e1e20;
--text-dark: #dcdcdc;
--primary: #46aae9;
--input-bg: #ffffff;
--input-border: #ced4da;
}
/* ===================
Themes.
====================== */
[data-theme="dark"] {
background-color: var(--bg-dark);
color: var(--text-dark);
}
[data-theme="light"] {
background-color: var(--bg-light);
color: var(--text-light);
}
/* ===================
Fonts.
====================== */
* {
box-sizing: border-box;
font-family: 'Noto Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
}
body {
margin: 0;
padding: 0;
transition: background-color 0.3s, color 0.3s;
}
/* ===================
Layout.
====================== */
header, footer, section {
max-width: 1200px;
margin: auto;
padding: 1rem;
text-align: center;
}
.iframe {
max-width: 100%;
aspect-ratio: 16 / 9;
padding: 1rem;
display: none;
}
iframe {
width: 100%;
height: 100%;
border: none;
}
/* ===================
Input and buttons.
====================== */
input[type="text"] {
padding: 0.5rem;
font-size: 1rem;
border-radius: 0.25rem;
border: 1px solid var(--input-border);
background-color: var(--input-bg);
color: var(--text-light);
}
button {
margin-left: 0.5rem;
padding: 0.5rem 1rem;
background-color: var(--primary);
color: white;
border: none;
border-radius: 0.25rem;
cursor: pointer;
font-weight: 600;
}
a {
color: inherit;
text-decoration: underline;
}
h1 {
font-size: 2rem;
margin-bottom: 0.5rem;
border-bottom: 1px solid #ccc;
}
/* ===================
Responsive.
====================== */
@media (max-width: 600px) {
input[type="text"], button {
display: block;
width: 100%;
margin: 0.5rem 0;
}
}
/* ==========================
Toggle switch with icons.
============================= */
.theme-toggle {
position: absolute;
top: 1rem;
right: 1rem;
display: flex;
align-items: center;
}
.icon-label {
font-family: 'Material Symbols Outlined', Arial, sans-serif;
font-size: 24px;
margin: 0 0.5rem;
line-height: 1;
user-select: none;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
}
.switch {
position: relative;
display: inline-block;
width: 48px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
border-radius: 24px;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: "";
height: 20px;
width: 20px;
left: 2px;
bottom: 2px;
background-color: white;
border-radius: 50%;
transition: 0.4s;
}
input:checked + .slider {
background-color: #666;
}
input:checked + .slider:before {
transform: translateX(24px);
}
/* Fallback icons. */
.fallback-icon {
display: none;
font-size: 16px;
}
.material-symbols-outlined:empty + .fallback-icon {
display: inline;
}
</style>
<script>
/**
* Set theme based on system.
*/
function setThemeFromPreference() {
const saved = localStorage.getItem("theme");
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
const theme = saved || (prefersDark ? "dark" : "light");
document.documentElement.setAttribute("data-theme", theme);
document.getElementById("theme-checkbox").checked = theme === "dark";
}
/**
* Change the theme and save on localStorage.
*/
function toggleTheme() {
const isDark = document.getElementById("theme-checkbox").checked;
const newTheme = isDark ? "dark" : "light";
document.documentElement.setAttribute("data-theme", newTheme);
localStorage.setItem("theme", newTheme);
}
/**
* Extract key from URL and start video player.
*/
function purify(path, params) {
document.querySelector('.iframe').style.display = 'block';
document.querySelector('iframe').setAttribute('src', 'https://www.youtube-nocookie.com/embed/' + path + '?' + params.toString());
}
/**
* Autostart on onload event.
*/
function init() {
setThemeFromPreference();
const params = new URLSearchParams(window.location.search.substring(1));
if (params.has('v')) {
const url = new URL(params.get('v'));
const urlParams = new URLSearchParams(url.search.substring(1));
// See https://developers.google.com/youtube/player_parameters for supported parameters
const outputParams = new URLSearchParams();
if (urlParams.has('t')) {
outputParams.append('start', urlParams.get('t'));
}
if (url.hostname == 'youtube.com' || url.hostname.endsWith('.youtube.com')) {
if (urlParams.has('list')) {
outputParams.append('listType', 'playlist');
outputParams.append('list', urlParams.get('list'));
}
let id = '';
if (urlParams.has('v')) {
id = urlParams.get('v');
}
purify(id, outputParams);
} else if (url.hostname == 'youtu.be') {
const id = url.pathname.substring(1);
purify(id, outputParams);
}
}
}
window.onload = init;
</script>
</head>
<body>
<!-- 🌗 Toggle Switch for Dark/Light mode with fallback icons. -->
<div class="theme-toggle">
<span class="icon-label">
<span class="material-symbols-outlined">light_mode</span>
<span class="fallback-icon">☀️</span>
</span>
<label class="switch">
<input type="checkbox" id="theme-checkbox" onchange="toggleTheme()" />
<span class="slider"></span>
</label>
<span class="icon-label">
<span class="material-symbols-outlined">dark_mode</span>
<span class="fallback-icon">🌙</span>
</span>
</div>
<header>
<h1>purify video</h1>
<h2>Watch purified YouTube videos with no ads. Just focus</h2>
<form method="get" action="">
<input type="text" name="v" placeholder="Enter YouTube URL" />
<button type="submit">Purify</button>
</form>
</header>
<section class="iframe">
<iframe src="" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</section>
<section>
<h1>Are you looking for a way to enhance your YouTube viewing experience?</h1>
<p>This app offers a clean and minimalistic interface for a distraction-free experience.</p>
<p>Teachers, students, parents, and organizers can use our app to remove ads, comments, and distracting sidebar videos.</p>
<p>Ensure your viewers see only the content you want them to see—nothing more, nothing less.</p>
</section>
<footer>
<p>YouTube is the source of all content</p>
<p><a href="https://github.com/purify-video" target="_blank">Made with 🖤 in Wrocław</a></p>
<p>This website <strong>does not store</strong> any data such as cookies to enable essential site functionality.</p>
</footer>
</body>
</html>