-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
123 lines (104 loc) · 3.87 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KnowUnity Link Generator</title>
<style>
body {
font-family: 'Space Grotesk', sans-serif;
text-align: center;
background-color: #1a1a1a;
color: #ffffff;
min-height: 100vh;
margin: 0;
padding: 0;
}
input {
padding: 8px;
background-color: #333;
color: #ffffff;
border: none;
margin-top: 10px;
}
button {
padding: 8px;
background-color: #4CAF50;
color: #ffffff;
border: none;
cursor: pointer;
margin-top: 10px;
}
#generatedUrl {
margin-top: 20px;
font-weight: bold;
color: #ffffff;
}
#contentUrl {
color: #4CAF50;
text-decoration: underline;
cursor: pointer;
}
#Footer {
background-color: transparent;
color: white;
text-align: center;
padding: 10px;
position: fixed;
bottom: 0;
width: 100%;
z-index: 1000;
}
</style>
<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=Space+Grotesk&display=swap" rel="stylesheet">
</head>
<body>
<h1>KnowUnity PDF-Link Generator</h1>
<label for="knowunity_url">Knowunity-Link:</label>
<input type="text" id="knowunity_url" placeholder="enter here">
<button onclick="generateUrl()">Generate URL</button>
<div id="generatedUrl"></div>
<script>
function generateUrl() {
var knowunityUrlInput = document.getElementById('knowunity_url').value;
// Extract Know-ID from Link
var match = knowunityUrlInput.match(/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})/);
var extractedId = match ? match[0] : null;
if (extractedId) {
// Create API Url
var apiUrl = 'https://apiedge-eu-central-1.knowunity.com/knows/' + extractedId;
// Fetch JSON from API Url
fetch(apiUrl)
.then(response => response.json())
.then(jsonResponse => {
// Extract Content URL pdf
var contentUrl = jsonResponse.documents[0].contentUrl;
// var for extracted URL
var generatedUrlDiv = document.getElementById('generatedUrl');
generatedUrlDiv.innerHTML = 'Content URL: <span id="contentUrl" onclick="openContentUrl(\'' + contentUrl + '\')">' + contentUrl + '</span>';
})
.catch(error => {
console.error('Error fetching API data:', error);
alert('Server Error');
});
} else {
alert('Invalid KnowUnity link. Make sure that a correct URL or ID is entered.');
}
}
function openContentUrl(url) {
window.open(url, '_blank');
}
</script>
<div id="Footer">
Made with ❤ by lennerd24<br>Inspired by
<a href="https://github.com/Snowad14/KnowUnity-Downloader/" target="_blank" style="color: white;">
Snowad14
</a>
<!-- Visitor Counter - REMOVE THIS -->
<br>Visitors: <a href="https://www.cutercounter.com/" target="_blank"><img src="https://www.cutercounter.com/hits.php?id=huxocxqk&nd=5&style=1" border="0" alt="hit counter"></a>
<!-- End of Visitor Counter -->
</div>
</body>
</html>