Bläddra i källkod

fix(ui): move legacySym() out of if-block -- function decl in block illegal in strict mode

In ECMAScript 5 strict mode, function declarations inside blocks
(if/for/while) are a syntax error. Since app.js uses 'use strict',
the legacySym function defined inside the if(isLegacyIOS) block could
prevent the entire script from parsing, killing connect() on all browsers.

Moved legacySym() to module scope. The if-block now only contains
the call sites, which is valid everywhere.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
master
Jan Svabenik 1 månad sedan
förälder
incheckning
2c3ab34498
1 ändrade filer med 20 tillägg och 19 borttagningar
  1. +20
    -19
      web/static/app.js

+ 20
- 19
web/static/app.js Visa fil

@@ -560,33 +560,34 @@ function scrollToCurrentTrack() {

// ── Boot ──────────────────────────────────────────────────────────────────────

// Replace text and tune font so the symbol fills ~¾ of the button.
// Centering is already handled by flex on .btn.
// Defined outside if-block — function declarations inside blocks are
// forbidden in strict mode on older engines and can kill the whole script.
function legacySym(id, text, size) {
var el = $(id);
el.textContent = text;
el.style.fontSize = size;
el.style.fontWeight = 'bold';
el.style.letterSpacing = '2px';
}

// Replace emoji with legacy symbols on iOS 9 where the glyphs are missing.
// Centering is already handled by flex on .btn — we only set size/weight here.
if (isLegacyIOS) {
// Helper: replace text and tune font so the symbol fills ~¾ of the button.
function legacySym(id, text, size, weight) {
var el = $(id);
el.textContent = text;
el.style.fontSize = size;
el.style.fontWeight = weight || 'bold';
el.style.letterSpacing = '2px';
}

// Transport controls (btn-h = 64px):
// two-char symbols (<<, >>) → 26px bold; single-char (■) → 36px bold.
// ▶ is natively supported on iOS 9 and already 32px via .btn-play.
legacySym('btn-prev', SYM.prev, '26px'); // <<
legacySym('btn-play', SYM.play, '36px'); // ▶
legacySym('btn-stop', SYM.stop, '36px'); // ■
legacySym('btn-next', SYM.next, '26px'); // >>

// Volume mute (48px tall): short text, large and bold
// two-char symbols (<<, >>) → 26px bold; single-char (■ ▶) → 36px bold.
legacySym('btn-prev', SYM.prev, '26px');
legacySym('btn-play', SYM.play, '36px');
legacySym('btn-stop', SYM.stop, '36px');
legacySym('btn-next', SYM.next, '26px');

// Volume mute (48px tall)
legacySym('btn-mute', SYM.volOn, '16px');

// Playlist action button (52px tall)
legacySym('btn-show-playlist', SYM.playlist, '18px');

// Kill button: just drop the emoji, keep the label text
// Kill button: drop the emoji, keep the label
$('btn-kill').textContent = SYM.skip + ' Überspringen';
}



Laddar…
Avbryt
Spara