From 2c3ab3449842cb15a13bb83c22bf18b0be9d9be6 Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Thu, 28 May 2026 19:17:35 +0200 Subject: [PATCH] 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 --- web/static/app.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/web/static/app.js b/web/static/app.js index 33d6ccf..1d6e0ec 100644 --- a/web/static/app.js +++ b/web/static/app.js @@ -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'; }