-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path23-boot.js
More file actions
90 lines (79 loc) · 2.61 KB
/
23-boot.js
File metadata and controls
90 lines (79 loc) · 2.61 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
// ---- Bootstrap ------------------------------------------
function init() {
// Restore persisted theme preference before rendering anything
try {
const savedTheme = localStorage.getItem(LS_THEME_KEY);
if (savedTheme === 'dark' || savedTheme === 'light') applyTheme(savedTheme);
} catch (_) { /* ignore */ }
// Theme toggle
const toggleBtn = document.getElementById('themeToggle');
if (toggleBtn) toggleBtn.addEventListener('click', toggleTheme);
// Hide completed milestones toggle
const hideCompletedCb = document.getElementById('hideCompletedMilestones');
if (hideCompletedCb) {
hideCompletedCb.addEventListener('change', function () {
const grid = document.getElementById('milestonesGrid');
if (grid) grid.classList.toggle('hide-completed', this.checked);
});
}
// Tab navigation
initTabs();
// Render static sections once
renderMilestones();
renderPredictionsTable();
renderTips();
renderChangelog();
renderFooterStats();
renderSectionAnchors();
// Chart init is isolated so a missing date-adapter or other chart error
// cannot prevent the counters and life-blocks from running.
try {
initChart();
} catch (err) {
console.error('Chart init failed:', err);
}
initLifeBlocks();
// Fun features
initBadges();
initTicker();
initEquivalences();
initSharePanel();
initFooterShare();
initReceiptModal();
initCalculator();
initAccelerator();
initHoroscope();
initGuiltMeter();
// Engagement features
initPresenceStrip();
initEventLog();
// Scary & satirical features (PRDs 1–7)
initEmergencyBroadcast();
initSessionTabStrip();
initApologies();
initShame();
initVillainLeaderboard();
initIntervention();
initGrimReaper();
// Persist accelerator game state every 30 seconds and on page hide
setInterval(saveAcceleratorState, 30000);
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'hidden') saveAcceleratorState();
});
// Kick off the live counter RAF loop
requestAnimationFrame(updateCounters);
// Populate extinction countdown immediately, then refresh every second
updateExtinctionCountdown();
// Check time-based badges and milestone alert every second
setInterval(() => {
checkTimeBadges();
checkMilestoneAlert();
updateExtinctionCountdown();
updateGuiltMeter();
}, 1000);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}