-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreader.html
More file actions
50 lines (45 loc) · 1.6 KB
/
reader.html
File metadata and controls
50 lines (45 loc) · 1.6 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
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/static/css/main.css"/>
<script>
function handleKeyDown(e) {
if (e.key == 'g' || e.key == 'G') window.open('https://github.com/0x62b');
else if (e.key == 'w' || e.key == 'W') window.open('https://wasteof.money/users/0x62');
else if (e.key == 'q' || e.key == 'Q') {
e.preventDefault();
window.parent.closePopup();
}
}
window.addEventListener("keydown", handleKeyDown);
window.addEventListener('DOMContentLoaded', () => {
const params = new URLSearchParams(window.location.search);
const page = params.get('page');
let lang = params.get('lang');
if (!lang) {
lang = "en";
}
if (page) {
document.getElementById('content').setAttribute('src', `${page}?lang=${lang}`);
}
const embeds = document.querySelectorAll('embed');
embeds.forEach(embed => {
embed.addEventListener('load', () => {
const window = embed.contentWindow || embed.getSVGDocument()?.defaultView;
if (window) {
window.addEventListener('keydown', handleKeyDown);
}
});
});
});
</script>
</head>
<body style="height: 95vh; display: flex; flex-direction: column;">
<div style="height: 85%">
<embed id="content" type="text/html" width="100%" height="100%"/>
</div>
<div style="height: 15%;">
<embed id="footer" src="footer.html?lang=en" type="text/html" width="100%" height="100%"/>
</div>
</body>
</html>