-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathall.html
59 lines (48 loc) · 1.69 KB
/
all.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
<!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 - manage</title>
</head>
<body>
<input type="password" name="pwd" id="input-pwd"/>
<!-- site-canvas -->
<div class="site-canvas">
</div>
<!--/ site-canvas -->
<script>
var container = document.querySelector('.site-canvas');
function render () {
container.innerHTML = '';
fetch('https://giffer-projector.herokuapp.com/gifs?t=' + Date.now())
.then(function(response) {
return response.json()
}).then(function(json) {
json.forEach(function (o) {
var wrapper = document.createElement('div');
var img = document.createElement('img');
img.setAttribute('src', o.url);
var link = document.createElement('a');
link.onclick = function (e) {
e.preventDefault();
var pwd = document.querySelector('#input-pwd').value;
fetch('https://giffer-projector.herokuapp.com/gif/' + o.uuid + '?token=' + pwd, {
method: 'DELETE'
}).then(function () {
render ()
})
};
link.setAttribute('href', '#');
link.innerHTML = 'delete';
wrapper.appendChild(img);
wrapper.appendChild(link);
container.appendChild(wrapper);
});
})
}
render();
</script>
</body>
</html>