forked from phillip055/ktorio.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.html
36 lines (33 loc) · 1.16 KB
/
start.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
---
layout: none
permalink: /start
---
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ktor Project Generator</title>
<style type="text/css">
html, body { margin: 0; padding: 0; height:100% }
</style>
</head>
<body>
<div id="generator_id" style="width:100%;height:100%;"></div>
<script type="text/javascript">
window.addEventListener('popstate', function(event) {
const iframe = document.getElementById('iframe_generator');
if (iframe) {
iframe.contentWindow.postMessage({type: "updateHash", value: window.location.hash}, "*")
}
});
window.addEventListener('message', function(event) {
if (event.data && event.data.type === "updateHash") {
history.pushState({}, "", window.location.pathname + "#" + event.data.value.replace(/^#/, ''));
}
});
document.getElementById('generator_id').innerHTML = '<iframe id="iframe_generator" src="{{ site.ktor_init_tools_url }}' + location.hash.replace(/"/g, '\\"') + '" width="100%" height="100%" style="border:0;width:100%;height:100%;margin:0;padding:0;"></iframe>';
</script>
<noscript>
JavaScript is required for the generator.
</noscript>
</body>
</html>