|
734 | 734 | <source src="/static/splash-intro-fallback.mp3" type="audio/mpeg"> |
735 | 735 | </audio> |
736 | 736 |
|
737 | | - <button type="button" id="tp-audio-toggle" aria-pressed="false" aria-label="Turn sound on" title="Sound off — click for retro trading-floor jazz" |
| 737 | + <button type="button" id="tp-audio-toggle" aria-pressed="true" aria-label="Turn sound off" title="Sound on — click to mute retro jazz" |
738 | 738 | style=" |
739 | 739 | position: absolute; |
740 | 740 | bottom: 46px; |
|
760 | 760 | <span id="tp-audio-toggle-icon" aria-hidden="true" style="display:flex;width:20px;height:20px;align-items:center;justify-content:center;"> |
761 | 761 | <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
762 | 762 | <path d="M11 5L6 9H2v6h4l5 4V5z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/> |
763 | | - <path d="M23 9l-6 6M17 9l6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/> |
| 763 | + <path d="M15.54 8.46a5 5 0 010 7.07M19.07 4.93a9 9 0 010 14.14" stroke="currentColor" stroke-width="2" stroke-linecap="round"/> |
764 | 764 | </svg> |
765 | 765 | </span> |
766 | | - <span id="tp-audio-toggle-label">Sound off</span> |
| 766 | + <span id="tp-audio-toggle-label">Sound on</span> |
767 | 767 | </button> |
768 | 768 |
|
769 | 769 | <div style=" |
|
996 | 996 | var on = !introMusic.paused; |
997 | 997 | audioToggleBtn.setAttribute('aria-pressed', on ? 'true' : 'false'); |
998 | 998 | audioToggleBtn.setAttribute('aria-label', on ? 'Turn sound off' : 'Turn sound on'); |
999 | | - audioToggleBtn.title = on ? 'Sound on — retro jazz (click to mute)' : 'Sound off — click for retro trading-floor jazz'; |
| 999 | + audioToggleBtn.title = on ? 'Sound on — retro jazz (click to mute)' : 'Tap anywhere or click for retro jazz'; |
1000 | 1000 | if (audioToggleLabel) audioToggleLabel.textContent = on ? 'Sound on' : 'Sound off'; |
1001 | 1001 | if (audioToggleIcon) { |
1002 | 1002 | audioToggleIcon.innerHTML = on |
|
1040 | 1040 | }); |
1041 | 1041 | } |
1042 | 1042 |
|
1043 | | - syncIntroAudioButton(); |
| 1043 | + // Default sound on: first tap/click anywhere on splash starts playback if autoplay was blocked (mute button excluded) |
| 1044 | + var splashAudioRoot = document.getElementById('tp-splash'); |
| 1045 | + if (splashAudioRoot && introMusic && !audioLoadFailed) { |
| 1046 | + var splashAudioUnlock = function(ev) { |
| 1047 | + if (audioLoadFailed || dismissed) return; |
| 1048 | + if (ev.target.closest && ev.target.closest('#tp-audio-toggle')) return; |
| 1049 | + if (!splashAudioRoot.contains(ev.target)) return; |
| 1050 | + introMusic.play().then(function() { |
| 1051 | + splashAudioRoot.removeEventListener('pointerdown', splashAudioUnlock, true); |
| 1052 | + syncIntroAudioButton(); |
| 1053 | + }).catch(function() {}); |
| 1054 | + }; |
| 1055 | + splashAudioRoot.addEventListener('pointerdown', splashAudioUnlock, true); |
| 1056 | + } |
1044 | 1057 |
|
1045 | | - // Try autoplay where allowed (Chrome may still block until gesture — toggle always works) |
1046 | 1058 | if (introMusic && !audioLoadFailed) { |
1047 | 1059 | var introPlayTry = introMusic.play(); |
1048 | 1060 | if (introPlayTry !== undefined) { |
1049 | 1061 | introPlayTry.then(function() { syncIntroAudioButton(); }).catch(function() { syncIntroAudioButton(); }); |
| 1062 | + } else { |
| 1063 | + syncIntroAudioButton(); |
1050 | 1064 | } |
| 1065 | + } else { |
| 1066 | + syncIntroAudioButton(); |
1051 | 1067 | } |
1052 | 1068 |
|
1053 | 1069 | function dismiss() { |
|
0 commit comments