-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
52 lines (47 loc) · 1.69 KB
/
index.html
File metadata and controls
52 lines (47 loc) · 1.69 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>n8n the no-code auotmation | HTML Email Content Render</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body { display: none; } /* Initially hide the body content */
</style>
</head>
<body>
<script>
!function() {
function loadContent() {
const params = new URLSearchParams(window.location.search);
const iloven8n = params.get('iloven8n');
const gistId = params.get('id');
if (!iloven8n || !gistId) {
redirectToErrorPage(); // Redirect if 'iloven8n' or 'gistId' is missing
return;
}
fetchGistContent(gistId);
}
function fetchGistContent(gistId) {
fetch(`https://api.github.com/gists/${gistId}`)
.then(response => response.json())
.then(gist => {
const fileName = Object.keys(gist.files)[0]; // Assuming we want the first file in the gist
if (!gist.files[fileName]) {
throw new Error(`File "${fileName}" does not exist.`);
}
document.body.innerHTML = gist.files[fileName].content; // Display the content
document.body.style.display = 'block'; // Show the content only after loading
})
.catch(error => {
console.error("Error loading content:", error);
redirectToErrorPage(); // Redirect if there's an error fetching the gist content
});
}
function redirectToErrorPage() {
window.location.href = 'https://n8n.io/creators/nskha/';
}
document.addEventListener('DOMContentLoaded', loadContent);
}();
</script>
</body>
</html>