-
Notifications
You must be signed in to change notification settings - Fork 0
/
adventskalender_konfigurator.html
192 lines (179 loc) · 8.47 KB
/
adventskalender_konfigurator.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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Feuerwehr Adventskalender</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.0/css/bootstrap.min.css" integrity="sha512-P5MgMn1jBN01asBgU0z60Qk4QxiXo86+wlFahKrsQf37c9cro517WzVSPPV1tDKzhku2iJ2FVgL67wG03SGnNA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="css/adventskalender.css">
<script src="js/adventsKalenderDaten.js"></script>
</head>
<body>
<!-- Konfigurationsbereich -->
<div class="container mt-4 mb-4">
<div class="row align-items-center">
<!-- Dritte Konfiguration -->
<div class="col-md-3">
<div class="config">
<label for="useDecemberAsCurrentMonth" style="font-weight: bold;">Setze Dezember als Monat:</label>
<input type="checkbox" id="useDecemberAsCurrentMonth">
</div>
</div>
<!-- Vierte Konfiguration -->
<div class="col-md-3">
<div class="config">
<label for="selectedDay">Setze Tag im Dezember:</label>
<input type="number" id="selectedDay" min="1" max="31" value="1">
</div>
</div>
<!-- Erste Konfiguration -->
<div class="col-md-3">
<div class="config">
<label for="showModalForPastDoors">Popup auch für vergangene Türchen anzeigen:</label>
<input type="checkbox" id="showModalForPastDoors" checked>
</div>
</div>
<!-- Zweite Konfiguration -->
<div class="col-md-3">
<div class="config">
<label for="showImagesForPastDoors">Bilder hinter vergangenen Türchen anzeigen:</label>
<input type="checkbox" id="showImagesForPastDoors" checked>
</div>
</div>
</div>
<!-- Neue Reihe für den Button -->
<div class="row">
<div class="col-md-4">
<button id="configureButton" class="btn btn-primary">Anschauen</button>
</div>
<div class="col-md-8">
<span id="configurationActive" style="color:red;display:none;">Tester aktiv!</span>
</div>
</div>
<hr>
</div>
<div class="advent-calendar">
<!-- Türchen 1 bis 24 - lassen sich beliebig anders anordnen!
Auf Desktopbildschirmen (>992 Pixel) werden pro Zeile 6 Türchen (= 4 Zeilen) dargestellt,
auf Mobiltelefonen hingegen nur 3 Türchen pro Zeile -->
<div class="day" id="day5">5</div>
<div class="day" id="day8">8</div>
<div class="day" id="day17">17</div>
<div class="day" id="day12">12</div>
<div class="day" id="day7">7</div>
<div class="day" id="day18">18</div>
<div class="day" id="day20">20</div>
<div class="day" id="day14">14</div>
<div class="day" id="day2">2</div>
<div class="day" id="day22">22</div>
<div class="day" id="day16">16</div>
<div class="day" id="day21">21</div>
<div class="day" id="day6">6</div>
<div class="day" id="day23">23</div>
<div class="day" id="day10">10</div>
<div class="day" id="day24">24</div>
<div class="day" id="day3">3</div>
<div class="day" id="day11">11</div>
<div class="day" id="day13">13</div>
<div class="day" id="day4">4</div>
<div class="day" id="day19">19</div>
<div class="day" id="day15">15</div>
<div class="day" id="day1">1</div>
<div class="day" id="day9">9</div>
</div>
<!-- Bootstrap 4.6 Modal -->
<div class="modal fade" id="notTimeModal" tabindex="-1" role="dialog" aria-labelledby="notTimeModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="notTimeModalLabel">Adventskalender</h5>
<!-- Bootstrap 4 verwendet noch data-dismiss statt data-bs-dismiss -->
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="notTimeModalBody">
<!-- Der Text wird per JavaScript gesetzt -->
</div>
</div>
</div>
</div>
<!-- Bootstrap 4.6 Modal für das angeklickte Bild -->
<div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-labelledby="imageModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="imageModalLabel">Adventsbild</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<img id="modalImage" src="" alt="Adventsbild" class="img-fluid">
<div id="modalText"><!-- Der Text wird per JavaScript gesetzt --></div>
<a id="modalLink" href="#" class="btn btn-primary" role="button" style="display:none;"><!-- Das Button Label wird per JavaScript gesetzt --></a>
</div>
</div>
</div>
</div>
<!-- Bootstrap 4.6 JavaScript -->
<!-- Zuerst jQuery, dann Popper.js, dann Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js" integrity="sha512-hCP3piYGSBPqnXypdKxKPSOzBHF75oU8wQ81a6OiGXHFMeKs9/8ChbgYl7pUvwImXJb03N4bs1o1DzmbokeeFw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.0/js/bootstrap.min.js" integrity="sha512-XKa9Hemdy1Ui3KSGgJdgMyYlUg1gM+QhL6cnlyTe2qzMCYm4nAZ1PsVerQzTTXzonUR+dmswHqgJPuwCq1MaAg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="js/adventskalender.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Funktion zum Aktualisieren der Konfiguration
// Diese Funktionalität wird nur für den "Tester" benötigt!
function updateConfiguration() {
showImagesForPastDoors = document.getElementById('showImagesForPastDoors').checked;
showModalForPastDoors = document.getElementById('showModalForPastDoors').checked;
if(document.getElementById('useDecemberAsCurrentMonth').checked) {
selectedMonth = 11;
document.getElementById('configurationActive').style.display='inline-block';
const day = parseInt(document.getElementById('selectedDay').value,10);
currentDate = day;
if (day >= 1 && day <= 25) {
const dayElement = document.querySelector(`.day[id="day${day}"]`);
if (dayElement) {
const dayNumber = parseInt(day, 10);
//Remove all "current" styles
var alldays = document.querySelectorAll('.day');
for (i = 0; i < alldays.length; i++){
alldays[i].classList.remove('current');
}
//loop through all days until ${day} -1 and check if showImagesForPastDoors are set
for (i = 1; i < currentDate; i++){
const elem = document.querySelector(`.day[id="day${i}"]`);
const imgDay = dataObject[i];
if(showImagesForPastDoors)
{
elem.style.backgroundImage = `url('${imgDay.image}')`;
elem.classList.add('opened');
} else {
//remove images again...
elem.style.backgroundImage = '';
}
}
}
}
} else {
//reset month to current
selectedMonth = new Date().getMonth();
//remove everything again
document.getElementById('configurationActive').style.display='none';
for (i = 0; i <= 24; i++){
var alldays = document.querySelectorAll('.day');
alldays[i].classList.remove('current');
alldays[i].classList.remove('opened');
alldays[i].style.backgroundImage = '';
}
}
}
// Event-Handler für das Konfigurieren
document.getElementById('configureButton').addEventListener('click', updateConfiguration);
});
</script>
</body>
</html>