-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
69 lines (53 loc) · 2.53 KB
/
Copy pathscript.js
File metadata and controls
69 lines (53 loc) · 2.53 KB
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
const countdowns = {
countdown2: { targetDate: new Date("2025-12-31T23:00:00Z"), timeZone: "Europe/London" },
countdown3: { targetDate: new Date("2026-12-31T23:00:00Z"), timeZone: "Europe/London" }
};
function updateCountdown(id) {
const now = new Date(new Date().toLocaleString("en-US", { timeZone: countdowns[id].timeZone }));
const target = countdowns[id].targetDate;
const timeRemaining = target - now;
if (timeRemaining <= 0) {
document.getElementById(id).innerText = "You have reached this year!";
return;
}
document.getElementById(`days${id.slice(-1)}`).textContent = Math.floor(timeRemaining / (1000 * 60 * 60 * 24));
document.getElementById(`hours${id.slice(-1)}`).textContent = Math.floor((timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
document.getElementById(`minutes${id.slice(-1)}`).textContent = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60));
document.getElementById(`seconds${id.slice(-1)}`).textContent = Math.floor((timeRemaining % (1000 * 60)) / 1000);
}
function setTimeZone(id, zone) {
countdowns[id].timeZone = zone;
updateCountdown(id);
}
// Fuer die onclick-Handler im HTML global verfuegbar machen
window.setTimeZone = setTimeZone;
function startCountdowns() {
for (const id in countdowns) {
setInterval(() => updateCountdown(id), 1000);
updateCountdown(id);
}
}
startCountdowns();
const emojiContainer = document.getElementById('emojiContainer');
const clockEmojis = ['🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚', '🕛','2026','2027'];
function createEmoji() {
const emojiElement = document.createElement('div');
emojiElement.textContent = clockEmojis[Math.floor(Math.random() * clockEmojis.length)];
emojiElement.className = 'emoji';
// Random size
const size = Math.random() * 3 + 0.5; // Between 3rem and 0.5rem
emojiElement.style.fontSize = `${size}rem`;
// Random initial position
const startX = Math.random() * 100; // 0 to 100% width
const startY = Math.random() * 100; // 0 to 100% height
emojiElement.style.left = `${startX}vw`;
emojiElement.style.top = `${startY}vh`;
// Random animation duration
const duration = Math.random() * + 0.2; // Between 0s and 3s
emojiElement.style.animationDuration = `${duration}s`;
emojiContainer.appendChild(emojiElement);
// Remove emoji after animation ends
setTimeout(() => emojiElement.remove(), duration * 1000);
}
// Generate emojis at intervals
setInterval(createEmoji, 0);