-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
35 lines (32 loc) · 904 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
35
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div id="elm-area" class="elm-area"></div>
<script src="elm.js"></script>
<script type="text/javascript">
window.onkeydown = function(event) {
if (event.keyCode == 8) {
//alert(event.target.tagName); //if you want to see how chrome handles keypresses not on an editable element
if (event.target.tagName == 'BODY') {
//alert("Prevented Navigation");
event.preventDefault();
}
}
}
</script>
<script>
var app = Elm.Typelm.embed(document.getElementById("elm-area"));
app.ports.urls.subscribe((url) => {
var page = parseInt(localStorage.getItem(url)) || 1
app.ports.pageGetter.send(page);
});
app.ports.pageSetter.subscribe(([url, page]) => {
localStorage.setItem(url, page)
});
</script>
</body>
</html>