-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewer.html
123 lines (113 loc) · 3.77 KB
/
viewer.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<title>Screenshot Viewer</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background: #f0f0f0;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
background: #fff;
padding: 20px;
border-radius: 5px;
margin-bottom: 20px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.stats {
display: flex;
gap: 20px;
margin-bottom: 20px;
}
.stat-box {
background: #fff;
padding: 15px;
border-radius: 5px;
flex: 1;
text-align: center;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.image-card {
background: #fff;
padding: 10px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.image-card img {
width: 100%;
height: auto;
border-radius: 3px;
}
.image-card .title {
margin-top: 10px;
font-size: 14px;
color: #666;
text-align: center;
word-break: break-all;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Screenshot Gallery</h1>
<p>Auto-refreshing every second</p>
</div>
<div class="stats">
<div class="stat-box">
<h3>Total Screenshots</h3>
<div id="totalCount">0</div>
</div>
<div class="stat-box">
<h3>Last Update</h3>
<div id="lastUpdate">-</div>
</div>
</div>
<div class="gallery" id="imageGallery"></div>
</div>
<script>
function updateGallery() {
fetch('http://localhost:8000/images')
.then(response => response.json())
.then(images => {
const gallery = document.getElementById('imageGallery');
const totalCount = document.getElementById('totalCount');
const lastUpdate = document.getElementById('lastUpdate');
// Update stats
totalCount.textContent = images.length;
lastUpdate.textContent = new Date().toLocaleTimeString();
// Clear existing images
gallery.innerHTML = '';
// Add new images
images.forEach(image => {
const card = document.createElement('div');
card.className = 'image-card';
const img = document.createElement('img');
img.src = `img/${image}`;
img.alt = image;
const title = document.createElement('div');
title.className = 'title';
title.textContent = image.replace(/_/g, '.').replace('.png', '');
card.appendChild(img);
card.appendChild(title);
gallery.appendChild(card);
});
})
.catch(error => console.error('Error:', error));
}
// Update immediately and then every second
updateGallery();
setInterval(updateGallery, 1000);
</script>
</body>
</html>