refactor: tidy playlist-menu label and catch blocks

Pre-push code analysis pass for task #1

ClaudeQueue
This commit is contained in:
Claude Worker
2026-06-18 18:48:07 +00:00
parent 95dc9e3f98
commit 44fa24ca52

View File

@@ -1108,8 +1108,7 @@ function openCardMenu(video) {
data.playlists.forEach((pl) => { data.playlists.forEach((pl) => {
const btn = document.createElement('button'); const btn = document.createElement('button');
const label = () => ((pl.videos.some((x) => x.id === video.id)) ? '✓ ' : '+ ') + pl.name; btn.textContent = (pl.videos.some((x) => x.id === video.id) ? '✓ ' : '+ ') + pl.name;
btn.textContent = label();
btn.onclick = () => { btn.onclick = () => {
const key = pl.id + ':' + video.id; const key = pl.id + ':' + video.id;
// Guard against rapid double-clicks: the op is keyed by playlist+video, // Guard against rapid double-clicks: the op is keyed by playlist+video,
@@ -1132,7 +1131,7 @@ function openCardMenu(video) {
} }
persist(); persist();
toast(has ? `Removed from ${pl.name}` : `Added to ${pl.name}`); toast(has ? `Removed from ${pl.name}` : `Added to ${pl.name}`);
} catch (e) { } catch {
toast('⚠ Could not update playlist'); toast('⚠ Could not update playlist');
} }
closeModal(); closeModal();
@@ -1331,7 +1330,7 @@ document.querySelectorAll('.chip').forEach((c) => {
cachedIds.delete(id); cachedIds.delete(id);
markCardCacheState(id, 'none'); markCardCacheState(id, 'none');
toast('Removed from offline cache'); toast('Removed from offline cache');
} catch (e) { } catch {
// Non-blocking error; leave it marked cached and re-enable the button. // Non-blocking error; leave it marked cached and re-enable the button.
toast('⚠ Could not remove from cache'); toast('⚠ Could not remove from cache');
} }