This commit is contained in:
LifeAdventurer
2025-05-05 06:50:12 +00:00
parent 264124a966
commit 2ad9039918
2 changed files with 24 additions and 17 deletions

View File

@@ -353,12 +353,6 @@ async function init_page() {
} }
} }
if (current_day_special_events.length) {
special_events_index = ip.split(".").map(num => parseInt(num)).reduce((acc, cur) => acc + cur);
special_events_index %= current_day_special_events.length;
special_events_index = current_day_special_events[special_events_index];
}
// if there is upcoming event then show // if there is upcoming event then show
for (let eventIndex = 0; eventIndex < showSpecialEventCount; eventIndex++) { for (let eventIndex = 0; eventIndex < showSpecialEventCount; eventIndex++) {
if (eventIndexList[eventIndex] != -1) { if (eventIndexList[eventIndex] != -1) {
@@ -371,15 +365,6 @@ async function init_page() {
} }
} }
// show special event if today is a special day
if (special) {
const special_event_today =
`<span class="desc" style="font-size:9vmin;">今日是<b class="good-fortune">${
special_events[special_events_index].event
}</b></span>`;
$("#special-day").html(special_event_today);
}
const last_date_str = localStorage.getItem("last_date"); const last_date_str = localStorage.getItem("last_date");
if (last_date_str !== null && last_date_str !== undefined) { if (last_date_str !== null && last_date_str !== undefined) {
const now_date = new Date(); const now_date = new Date();
@@ -391,9 +376,31 @@ async function init_page() {
now_date.getDate() === last_date.getDate() now_date.getDate() === last_date.getDate()
) { ) {
fortune_generated = true; fortune_generated = true;
Update();
} }
} }
if (fortune_generated) {
Update();
if (special) {
special_events_index = parseInt(localStorage.getItem("last_special_index"));
}
} else {
if (current_day_special_events.length) {
special_events_index = ip.split(".").map(num => parseInt(num)).reduce((acc, cur) => acc + cur);
special_events_index %= current_day_special_events.length;
special_events_index = current_day_special_events[special_events_index];
localStorage.setItem("last_special_index", special_events_index);
}
}
// show special event if today is a special day
if (special) {
const special_event_today =
`<span class="desc" style="font-size:9vmin;">今日是<b class="good-fortune">${
special_events[special_events_index].event
}</b></span>`;
$("#special-day").html(special_event_today);
}
} }
} }

View File

@@ -1 +1 @@
{ "commit_hash": "7a372a7003cacfad93e13082e73049dd659868ec" } { "commit_hash": "79965ea3a8425e38e8ec0e88fa5d2798f471540c" }