-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
82 lines (68 loc) · 3.61 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PDF-Viewer</title>
<meta name="author" content="n-km">
<link rel="icon" href="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ficon-library.com%2Fimages%2Ffree-pdf-icon%2Ffree-pdf-icon-21.jpg&f=1&nofb=1&ipt=e2ce7f9cfa33194d9f60929f9617c9946177d8ae8c45be2a4100f6d87ccbe794&ipo=images">
<meta name="description" content="View your PDF-Link & Share to your Friends">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=PT+Mono&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
</head>
<body>
<div class="content">
<h2>pdf-viewer</h2>
push your link - view modern
<form action=""id="pdfForm">
<input type="text" id="pdfLink">
<input type="submit" id="SEND">
<label for="SEND">View PDF</label>
</form>
<iframe frameborder="0" id="pdfViewer"></iframe>
</div>
<button id="shareButton"><span class="material-symbols-outlined">share</span></button>
<script>
document.getElementById("pdfForm").addEventListener("submit", function(event) {
event.preventDefault(); // Verhindert das Neuladen der Seite
var pdfLink = document.getElementById("pdfLink").value;
if (pdfLink) {
document.getElementById("pdfViewer").src = "https://docs.google.com/gview?url=" + encodeURIComponent(pdfLink) + "&embedded=true";
document.getElementById("pdfViewer").addEventListener("load", function() {
// Box-Schatten aktivieren, wenn der PDF-Viewer geladen ist
document.querySelector(".content iframe").style.boxShadow = "0 0 3px black";
});
} else {
alert("Bitte gib einen gültigen PDF-Link ein.");
}
});
window.addEventListener("DOMContentLoaded", function() {
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
var pdfLink = urlParams.get('pdfLink');
if (pdfLink) {
document.getElementById("pdfViewer").src = "https://docs.google.com/gview?url=" + encodeURIComponent(pdfLink) + "&embedded=true";
document.getElementById("pdfViewer").addEventListener("load", function() {
// Box-Schatten aktivieren, wenn der PDF-Viewer geladen ist
document.querySelector(".content iframe").style.boxShadow = "0 0 3px black";
});
}
});
document.getElementById("shareButton").addEventListener("click", function() {
var pdfLink = encodeURIComponent(document.getElementById("pdfLink").value);
var shareURL = window.location.href.split('?')[0] + "?pdfLink=" + pdfLink;
navigator.clipboard.writeText(shareURL)
.then(function() {
alert("Link wurde kopiert und kann geteilt werden: " + shareURL);
})
.catch(function() {
alert("Das Kopieren des Links ist fehlgeschlagen.");
});
});
</script>
</body>
</html>