-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
83 lines (71 loc) · 2.21 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="google-site-verification" content="ilalb0jZKO_byQAVbT-l4p7ivwqYNEbHAdryZd5jfP0" />
<title>Giffer - Show</title>
<style>
body {
margin: 0;
padding: 0;
}
.site-canvas {
width: 100%;
height: 150vh;
}
.media {
position: fixed;
height: 100%;
width: 100%;
background: #000 no-repeat center center;
background-size: contain;
}
.media--preloader {
position: fixed;
height: 100%;
width: 100%;
background: #000 no-repeat center center;
background-size: contain;
z-index: -1;
}
</style>
</head>
<body>
<!-- site-canvas -->
<div class="site-canvas">
<div id="the-image" class="media"></div>
<div id="the-preloader" class="media media--preloader"></div>
</div>
<!--/ site-canvas -->
<script>
var imgTime = 8000;
var theImage = document.querySelector('#the-image');
var thePrealoder = document.querySelector('#the-preloader');
var lastImg = null;
setInterval(function () {
var uuid = lastImg ? lastImg.uuid : 'no';
fetch('https://giffer-projector.herokuapp.com/gif/' + uuid)
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('json', json);
lastImg = json;
theImage.style.backgroundImage = "url(" + json.url + ")";
var nextImg = lastImg.uuid;
fetch('https://giffer-projector.herokuapp.com/gif/' + nextImg)
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('json', json);
thePrealoder.style.backgroundImage = "url(" + json.url + ")";
}).catch(function(ex) {
console.log('parsing failed', ex)
})
}).catch(function(ex) {
console.log('parsing failed', ex)
})
}, imgTime);
</script>
</body>
</html>