Skip to content

Commit c07bcfe

Browse files
committed
update
1 parent 75681ed commit c07bcfe

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

docs/_pages/ysec.md

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ custom_js:
1616
<p>A student-led exploration into practical science.</p>
1717

1818
<a href="https://forms.cloud.microsoft/r/Crfjj8ydZf" target="_blank">Register now!</a>
19-
<p id="register-timer" style="font-size: 0.8em; margin-top: 6px;">
20-
Registration closes in: Loading...
21-
</p>
22-
23-
<p id="timer" style="font-size: 1.1em; margin-top: 10px;">Loading...</p>
19+
<p id="timer" style="font-size: 0.95em; color: #ddd; margin-top: 8px;">Loading...</p>
2420
</div>
2521

2622
<div id="logo">
@@ -29,16 +25,15 @@ custom_js:
2925
</div>
3026

3127
<script>
32-
// === CONFIG ===
33-
const registrationEnd = new Date("2025-12-01T23:59:59+08:00"); // registration closes
34-
const preliminaryStart = new Date("2025-12-13T00:00:00+08:00"); // prelim start
35-
const preliminaryEnd = new Date("2025-12-14T23:59:59+08:00"); // prelim end
36-
const resultsAnnounce = new Date("2026-01-01T12:00:00+08:00"); // results day
37-
const finalStart = new Date("2026-02-15T00:00:00+08:00"); // final start
38-
const finalEnd = new Date("2026-02-16T23:59:59+08:00"); // final end
28+
// === CONFIGURATION ===
29+
const registrationEnd = new Date("2025-12-01T23:59:59+08:00");
30+
const preliminaryStart = new Date("2025-12-13T00:00:00+08:00");
31+
const preliminaryEnd = new Date("2025-12-14T23:59:59+08:00");
32+
const resultsAnnounce = new Date("2025-12-26T12:00:00+08:00");
33+
const finalStart = new Date("2026-02-15T00:00:00+08:00");
34+
const finalEnd = new Date("2026-02-16T23:59:59+08:00");
3935

40-
const registerTimer = document.getElementById("register-timer");
41-
const eventTimer = document.getElementById("timer");
36+
const timer = document.getElementById("timer");
4237

4338
function formatTime(diff) {
4439
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
@@ -48,43 +43,47 @@ custom_js:
4843
return `${days}d ${hours}h ${mins}m ${secs}s`;
4944
}
5045

51-
function updateTimers() {
46+
function updateTimer() {
5247
const now = new Date();
48+
let target;
49+
let label;
5350

54-
// === REGISTRATION TIMER ===
5551
if (now < registrationEnd) {
56-
const diff = registrationEnd - now;
57-
registerTimer.innerHTML = `Registration closes in: <b>${formatTime(diff)}</b>`;
58-
} else {
59-
registerTimer.innerHTML = "📝 Registration closed!";
60-
}
61-
62-
// === EVENT TIMER ===
63-
if (now < preliminaryStart) {
64-
const diff = preliminaryStart - now;
65-
eventTimer.innerHTML = `Countdown to Preliminary Round:<br><b>${formatTime(diff)}</b>`;
52+
target = registrationEnd;
53+
label = "🕒 Registration closes in:";
54+
} else if (now < preliminaryStart) {
55+
target = preliminaryStart;
56+
label = "📅 Countdown to Preliminary Round:";
6657
} else if (now < preliminaryEnd) {
67-
eventTimer.innerHTML = "🏁 Preliminary Round in progress!";
58+
target = preliminaryEnd;
59+
label = "🏁 Preliminary Round ends in:";
6860
} else if (now < resultsAnnounce) {
69-
eventTimer.innerHTML = "📄 Preliminary Round ended! Results will be announced on <b>1 January 2026</b>.";
61+
target = resultsAnnounce;
62+
label = "📄 Results announcement in:";
7063
} else if (now < finalStart) {
71-
const diff = finalStart - now;
72-
eventTimer.innerHTML = `Countdown to Final Round:<br><b>${formatTime(diff)}</b>`;
64+
target = finalStart;
65+
label = "Countdown to Final Round:";
7366
} else if (now < finalEnd) {
74-
eventTimer.innerHTML = "⚗️ Final Round in progress!";
67+
target = finalEnd;
68+
label = "⚗️ Final Round ends in:";
7569
} else {
76-
eventTimer.innerHTML = "🎉 Thanks for joining YSEC 2025! See you next year!";
70+
timer.innerHTML = "🎉 Thanks for joining YSEC 2025! See you next year!";
71+
return;
7772
}
73+
74+
const diff = target - now;
75+
timer.innerHTML = `${label} <b>${formatTime(diff)}</b>`;
7876
}
7977

80-
setInterval(updateTimers, 1000);
81-
updateTimers();
78+
setInterval(updateTimer, 1000);
79+
updateTimer();
8280
</script>
8381

8482

8583

8684

8785

86+
8887
# Introduction
8988
The Youth STEM Experimental Camp (YSEC) is the first ever student-led, nation-wide experimental science camp hosted by AMISO, in collaboration with DISTED College!
9089

0 commit comments

Comments
 (0)