-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
33 lines (29 loc) · 974 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
<head><title>Find around</title>
<script src="elm.js"></script>
<link type="text/css" href="styles.css" rel="stylesheet"/>
<link type="text/css" href="otherStyles.css" rel="stylesheet"/>
</head>
<body>
<script type="text/javascript">
var elm = Elm.fullscreen(Elm.Main);
elm.ports.out.subscribe(respondinate);
function respondinate(listOfNews) {
listOfNews.map( function( newsItem ) {
if ('focus' in newsItem) {
console.log("setting focus to " + newsItem.focus);
focusWhenItGetsHere(newsItem.focus)
} else {
console.log(newsItem);
}
});
};
function focusWhenItGetsHere(elementId) {
setTimeout(function() {
var element = document.getElementById(elementId);
if (element != null && document.activeElement !== element) {
element.focus()
}
}, 50);
}
</script>
</body>