-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (58 loc) · 1.75 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Fotos">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
</head>
<body id="body">
<style>
body {
background-color: black;
margin: 0px;
}
h2 {
position: absolute;
bottom: 10px;
left: 10px;
background: rgba(0, 0, 0, 0.50);
padding: 4px 8px;
border-radius: 8px;
color: white;
margin: 0;
font: 28px Sans-Serif;
}
</style>
<img id="img" src="" width="1024" height="768">
<h2 id="title">Title here</h2>
</body>
<script>
var paused = false;
document.getElementById('body').ontouchstart = function (eve) {
document.getElementById('title').innerHTML = paused ? 'Es geht weiter...' : 'PAUSE';
paused = !paused;
}
var img = document.getElementById('img');
var title = document.getElementById('title');
var currentTitle = '';
img.onload = function() {
title.innerHTML = currentTitle;
};
function reqListener () {
var data = JSON.parse(this.responseText);
img.src = "/img/"+data.id+"#"+Date.now();
currentTitle = data.title;
}
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
function loadImg() {
if (paused) return;
oReq.open("GET", "/next");
oReq.send();
}
setInterval(loadImg, 20000);
loadImg();
</script>
</html>