blob: c8e863f78c3e40131bee46dd31b24fc995f1ef8f (
plain)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
<!DOCTYPE html>
<html>
<head>
<title> waterpi </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.gallery {
max-width: 800px;
margin: 0 auto;
text-align: center;
}
.main-image {
margin-bottom: 20px;
}
.main-image img {
width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.controls {
display: flex;
justify-content: center;
gap: 20px;
align-items: center;
}
.nav-button {
padding: 10px 20px;
font-size: 24px;
cursor: pointer;
border: none;
background-color: #f0f0f0;
border-radius: 5px;
transition: background-color 0.3s;
}
.now-button {
padding: 12px 24px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
transition: background-color 0.3s;
}
.now-button:hover {
background-color: #45a049;
}
.nav-button:hover {
background-color: #e0e0e0;
}
.nav-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style>
</head>
<body>
<div class="gallery">
<div class="main-image">
<img id="featured" src="" alt="Hauptbild" onerror="this.src='error.png'">
</div>
<div class="controls">
<button onclick="jumpTime(-60)" class="nav-button"><img src="fbck.png"></button>
<button onclick="jumpTime(-15)" class="nav-button"><img src="bck.png"></button>
<button onclick="jumpToCurrent()" class="now-button"><img src="stop.png"></button>
<button onclick="jumpTime(15)" class="nav-button"><img src="fwd.png"></button>
<button onclick="jumpTime(60)" class="nav-button"><img src="ffwd.png"></button>
</div>
</div>
<a href="history.html">go to 12:00 images</a>
</body>
</html>
<script>
let currentDateTime = new Date();
function roundToQuarterHour(date) {
const minutes = date.getMinutes();
const roundedMinutes = Math.floor(minutes / 15) * 15;
const newDate = new Date(date);
newDate.setMinutes(roundedMinutes);
newDate.setSeconds(0);
newDate.setMilliseconds(0);
return newDate;
}
function formatTimeString(date) {
return date.getHours().toString().padStart(2, '0') + '_' +
date.getMinutes().toString().padStart(2, '0');
}
function updateGallery() {
currentDateTime = roundToQuarterHour(new Date());
updateImage();
updateButtons();
}
function jumpTime(minutes) {
const newTime = new Date(currentDateTime.getTime() + minutes * 60000);
const now = new Date();
if (newTime <= now) {
currentDateTime = newTime;
updateImage();
updateButtons();
}
}
function jumpToCurrent() {
currentDateTime = roundToQuarterHour(new Date());
updateImage();
updateButtons();
}
function updateImage() {
const timeString = formatTimeString(currentDateTime);
document.getElementById('featured').src = `${timeString}.jpg`;
}
function updateButtons() {
const now = roundToQuarterHour(new Date());
const buttons = document.querySelectorAll('.nav-button');
// Deaktiviere Vorwärts-Buttons wenn aktuelle Zeit erreicht
buttons[2].disabled = currentDateTime.getTime() + 15 * 60000 > now.getTime();
buttons[3].disabled = currentDateTime.getTime() + 60 * 60000 > now.getTime();
// Deaktiviere den Aktuell-Button wenn bereits das aktuelle Bild angezeigt wird
document.querySelector('.now-button').disabled =
currentDateTime.getTime() === now.getTime();
}
// Initial gallery setup
updateGallery();
// Aktualisiere die Galerie alle 15 Minuten
setInterval(updateGallery, 900000);
</script>
|