-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
141 lines (125 loc) · 4.88 KB
/
Copy pathindex.html
File metadata and controls
141 lines (125 loc) · 4.88 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>HoyoDex</title>
<link href="https://fonts.googleapis.com/css2?family=Lilita+One&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<link rel="icon" type="image/png" href="https://vectorseek.com/wp-content/uploads/2023/08/Hoyoverse-Icon-Logo-Vector.svg-.png">
</head>
<body>
<div class="container">
<h1>HOYODEX</h1>
<div class="game-icons">
<a href="00GI/000.html"><img src="assets/gameico/gi.webp" alt="Genshin Impact" /></a>
<a href="01HSR/000.html"><img src="assets/gameico/hsr.webp" alt="Honkai Star Rail" /></a>
<a href="02ZZZ/000.html"><img src="assets/gameico/zzz.png" alt="Zenless Zone Zero" /></a>
<a href="03HI3/000.html"><img src="assets/gameico/hi3.webp" alt="Honkai Impact 3rd" /></a>
<a href="Endfield/000.html"><img src="assets/gameico/ae.webp" alt="Arknight Endfield" /></a>
<a href="03HNA/000.html" style="filter: grayscale(100%); opacity:0.7;"
onmouseover="this.style.filter='none'; this.style.opacity='1';"
onmouseout="this.style.filter='grayscale(100%)'; this.style.opacity='0.7';">
<img src="assets/gameico/hna.webp" alt="Honkai Nexus Anima"/>
</a>
<!--<a href="Endfield/index.html" style="filter: grayscale(100%); opacity:0.7;"
onmouseover="this.style.filter='none'; this.style.opacity='1';"
onmouseout="this.style.filter='grayscale(100%)'; this.style.opacity='0.7';">
<img src="assets/gameico/ae.webp" alt="Endfield"/>
</a>-->
</div>
</div>
<!-- Birthday Popup -->
<div id="popup-overlay" style="display:none;">
<div id="popup-content">
<h2>Today's Birthdays 🎉</h2>
<div id="birthday-list"></div>
<button id="popup-close">Close</button>
</div>
</div>
<!-- Birthday Button -->
<button id="birthday-button">🎂 Birthdays Today</button>
<!-- Load birthday configs -->
<script src="00GI/js/bday.js"></script>
<script src="03HI3/js/bday.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
const allConfigs = [];
if (window.BDAY_CONFIG) allConfigs.push(window.BDAY_CONFIG);
if (window.ALL_BDAY_CONFIGS && Array.isArray(window.ALL_BDAY_CONFIGS)) {
window.ALL_BDAY_CONFIGS.forEach(cfg => allConfigs.push(cfg));
}
if (typeof window.Genshin_BDAY_CONFIG !== "undefined") allConfigs.push(window.Genshin_BDAY_CONFIG);
if (typeof window.Honkai_BDAY_CONFIG !== "undefined") allConfigs.push(window.Honkai_BDAY_CONFIG);
if (allConfigs.length === 0 && window.BDAY_CONFIG) allConfigs.push(window.BDAY_CONFIG);
if (!allConfigs.length) {
console.warn("No BDAY_CONFIG found");
return;
}
const popup = document.getElementById("popup-overlay");
const closeBtn = document.getElementById("popup-close");
const openBtn = document.getElementById("birthday-button");
const list = document.getElementById("birthday-list");
function getTodayDateKey() {
const today = new Date();
const day = String(today.getDate()).padStart(2, '0');
const month = String(today.getMonth() + 1).padStart(2, '0');
return `${month}-${day}`;
}
// Check if there’s any birthday today
const todayKey = getTodayDateKey();
let hasBirthday = false;
allConfigs.forEach(config => {
const todayList = config.birthdays?.[todayKey];
if (todayList && todayList.length) hasBirthday = true;
});
if (!hasBirthday) {
// No birthdays today, hide button and popup
openBtn.style.display = "none";
popup.style.display = "none";
return;
}
function createBirthdayElement(config, nameOrEntry) {
const el = config.createImageElement(nameOrEntry);
const img = el.querySelector("img");
if (img && !img.src.includes("track/")) {
const src = img.getAttribute("src").replace(/^(\.\/|\/)?/, "");
img.src = `track/${src}`;
}
return el;
}
function renderPopupContent() {
list.innerHTML = '';
const shownNames = new Set(); // prevents duplicates
allConfigs.forEach(config => {
const todayList = config.birthdays?.[todayKey];
if (todayList && todayList.length) {
todayList.forEach(entry => {
const name = typeof entry === "string" ? entry : entry.name || entry;
if (!shownNames.has(name)) {
shownNames.add(name);
list.appendChild(createBirthdayElement(config, entry));
}
});
}
});
}
openBtn.addEventListener("click", () => {
renderPopupContent();
popup.style.display = "flex";
});
closeBtn.addEventListener("click", () => {
popup.style.display = "none";
});
// Close when clicking outside the popup content
popup.addEventListener("click", (e) => {
if (e.target === popup) popup.style.display = "none";
});
// Close when pressing Escape
document.addEventListener("keydown", (e) => {
if (e.key === "Escape") popup.style.display = "none";
});
});
</script>
</body>
</html>