aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindex.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/index.html b/index.html
index 24490b4..940919e 100755
--- a/index.html
+++ b/index.html
@@ -767,6 +767,31 @@
// swap track live when theme changes while music is playing
window.addEventListener('themechange', applyMusicTheme);
+ // autoplay on load; fall back to first click if browser blocks it
+ (function() {
+ const track = MUSIC[Aero.getTheme()] || MUSIC.aero;
+ bgm.src = track.src;
+ bgm.load();
+ bgm.play().then(() => {
+ musicOn = true;
+ mtBtn.textContent = '❚❚';
+ mtLabel.textContent = track.label;
+ mtBtn.style.background = 'radial-gradient(circle at 30% 25%,white,oklch(75% 0.14 55) 60%,oklch(55% 0.15 35))';
+ }).catch(() => {
+ document.addEventListener('click', () => {
+ const t = MUSIC[Aero.getTheme()] || MUSIC.aero;
+ bgm.src = t.src;
+ bgm.load();
+ bgm.play().then(() => {
+ musicOn = true;
+ mtBtn.textContent = '❚❚';
+ mtLabel.textContent = t.label;
+ mtBtn.style.background = 'radial-gradient(circle at 30% 25%,white,oklch(75% 0.14 55) 60%,oklch(55% 0.15 35))';
+ });
+ }, { once: true });
+ });
+ })();
+
// counter
document.getElementById('cc').innerHTML = Aero.counterHTML(0, 'visitors');
Aero.fetchVisitorCount()