-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
34 lines (32 loc) · 874 Bytes
/
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
<!doctype html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
</style>
</head>
<body style="width: 100%; margin: 0; background-color: #111;">
<header style="display: flex; height: 36px; padding: 4px; background-color: #333;">
<form style="display: flex; flex-grow: 1;" id=header-form>
<input type=text style="padding: 5px; border: 0; font-size: 14px; flex-grow: 1; outline: none;" value="/demo.html" id=url-bar>
</form>
</header>
<script>
const headerForm = document.getElementById('header-form');
headerForm.addEventListener('submit', e => {
e.preventDefault();
const urlBar = document.getElementById('url-bar');
let url = urlBar.value;
if (!/^\//.test(url)) {
url = '/' + url;
}
url = __dirname + url;
window.location.href = url;
});
const nativeHtml = document.createElement('native-html');
nativeHtml.show();
</script>
</body>
</html>