-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewer.html
More file actions
36 lines (36 loc) · 1.1 KB
/
viewer.html
File metadata and controls
36 lines (36 loc) · 1.1 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Document Viewer</title>
<style>
html, body { height: 100%; margin: 0; }
header { padding: 10px 15px; border-bottom: 1px solid #ccc; font-family: system-ui, Arial; }
.wrap { height: calc(100% - 42px); }
iframe { width: 100%; height: 100%; border: none; }
a { color: #0b5fff; text-decoration: none; }
</style>
</head>
<body>
<header>
<a href="index.html">← Back to list</a> |
<a id="openTab" href="#" target="_blank">Open in New Tab</a>
</header>
<div class="wrap">
<iframe id="pdfFrame"></iframe>
</div>
<script>
const params = new URLSearchParams(window.location.search);
const file = params.get("file");
if (file) {
const url = file;
document.getElementById("pdfFrame").src = url + "#zoom=page-width";
document.getElementById("openTab").href = url;
document.title = "Viewing: " + file.split("/").pop();
} else {
document.querySelector(".wrap").innerHTML = "<p style='padding:20px;'>No file specified.</p>";
}
</script>
</body>
</html>