|
|
|
@@ -29,6 +29,36 @@ function apiFetch(url, opts) { |
|
|
|
// String.prototype.padStart not available in iOS < 10. |
|
|
|
function pad2(n) { return n < 10 ? '0' + n : '' + n; } |
|
|
|
|
|
|
|
// iOS version detection โ used to pick emoji vs. ASCII symbols. |
|
|
|
// Media-control emoji (โฎ โธ โน โญ) and several other glyphs are absent on iOS 9. |
|
|
|
var isLegacyIOS = (function() { |
|
|
|
var m = navigator.userAgent.match(/OS (\d+)_/); |
|
|
|
return /iPad|iPhone/.test(navigator.userAgent) && m && parseInt(m[1], 10) <= 9; |
|
|
|
}()); |
|
|
|
|
|
|
|
// Symbol set: modern emoji for capable browsers, plain text for iOS โค 9. |
|
|
|
var SYM = isLegacyIOS ? { |
|
|
|
prev: '<<', |
|
|
|
play: 'โถ', // U+25B6 โ works on iOS 9 |
|
|
|
pause: '||', |
|
|
|
stop: 'โ ', // U+25A0 โ works on iOS 9 |
|
|
|
next: '>>', |
|
|
|
volOn: 'vol', |
|
|
|
volOff: 'mut', |
|
|
|
playlist:'PL', |
|
|
|
skip: 'โ' // U+2715 โ works on iOS 9 |
|
|
|
} : { |
|
|
|
prev: 'โฎ', |
|
|
|
play: 'โถ', |
|
|
|
pause: 'โธ', |
|
|
|
stop: 'โน', |
|
|
|
next: 'โญ', |
|
|
|
volOn: '๐', |
|
|
|
volOff: '๐', |
|
|
|
playlist:'๐', |
|
|
|
skip: '๐ซ' |
|
|
|
}; |
|
|
|
|
|
|
|
// NodeList.prototype.forEach not available in iOS < 10. |
|
|
|
// Wrap querySelectorAll results in a real Array before iterating. |
|
|
|
function qsa(selector, root) { |
|
|
|
@@ -158,7 +188,7 @@ function applyStatus(st) { |
|
|
|
timeLength.textContent = '-0:00'; |
|
|
|
} |
|
|
|
|
|
|
|
btnPlay.textContent = st.state === 'playing' ? 'โธ' : 'โถ'; |
|
|
|
btnPlay.textContent = st.state === 'playing' ? SYM.pause : SYM.play; |
|
|
|
winampPlaying = st.state === 'playing'; |
|
|
|
|
|
|
|
if (typeof st.volume === 'number') { |
|
|
|
@@ -170,7 +200,7 @@ function applyStatus(st) { |
|
|
|
|
|
|
|
// โโ Controls โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
|
|
|
btnPlay.addEventListener('click', function() { |
|
|
|
var playing = btnPlay.textContent === 'โธ'; |
|
|
|
var playing = btnPlay.textContent === SYM.pause; |
|
|
|
send({ cmd: playing ? 'pause' : 'play' }); |
|
|
|
}); |
|
|
|
|
|
|
|
@@ -225,7 +255,7 @@ function updateVolumeFill(muted) { |
|
|
|
volumeFill.classList.toggle('muted', muted); |
|
|
|
} |
|
|
|
function updateMuteBtn(muted) { |
|
|
|
btnMute.textContent = muted ? '๐' : '๐'; |
|
|
|
btnMute.textContent = muted ? SYM.volOff : SYM.volOn; |
|
|
|
btnMute.classList.toggle('muted', muted); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -528,5 +558,17 @@ function scrollToCurrentTrack() { |
|
|
|
} |
|
|
|
|
|
|
|
// โโ Boot โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
|
|
|
|
|
|
|
// Replace emoji with legacy symbols on iOS 9 where the glyphs are missing. |
|
|
|
if (isLegacyIOS) { |
|
|
|
$('btn-prev').textContent = SYM.prev; |
|
|
|
$('btn-play').textContent = SYM.play; |
|
|
|
$('btn-stop').textContent = SYM.stop; |
|
|
|
$('btn-next').textContent = SYM.next; |
|
|
|
$('btn-mute').textContent = SYM.volOn; |
|
|
|
$('btn-show-playlist').textContent = SYM.playlist; |
|
|
|
$('btn-kill').textContent = SYM.skip + ' รberspringen'; |
|
|
|
} |
|
|
|
|
|
|
|
connect(); |
|
|
|
renderFrame(); |