|
14 | 14 | let solverCancel = false; |
15 | 15 |
|
16 | 16 | // Navigation |
17 | | - $$('. nav-link[data-view]').forEach(link => { |
| 17 | + $$('.nav-link[data-view]').forEach(link => { |
18 | 18 | link.addEventListener('click', (e) => { |
19 | 19 | e.preventDefault(); |
20 | 20 | const view = link.dataset.view; |
21 | 21 |
|
22 | 22 | $$('.nav-link').forEach(l => l.classList.remove('active')); |
23 | 23 | link.classList.add('active'); |
24 | 24 |
|
25 | | - $$('.view').forEach(v => v.classList.remove('active')); |
| 25 | + $$('.view').forEach(v => v.classList. remove('active')); |
26 | 26 | $(`#view-${view}`).classList.add('active'); |
27 | 27 | }); |
28 | 28 | }); |
29 | 29 |
|
30 | 30 | // Tabs in Get view |
31 | | - $$('. tab').forEach(tab => { |
32 | | - tab.addEventListener('click', () => { |
| 31 | + $$('.tab').forEach(tab => { |
| 32 | + tab. addEventListener('click', () => { |
33 | 33 | const tabName = tab.dataset.tab; |
34 | 34 |
|
35 | | - $$('.tab').forEach(t => t.classList.remove('active')); |
36 | | - tab.classList. add('active'); |
| 35 | + $$('. tab').forEach(t => t.classList.remove('active')); |
| 36 | + tab.classList.add('active'); |
37 | 37 |
|
38 | 38 | $$('.tab-content').forEach(tc => tc.classList.remove('active')); |
39 | 39 | $(`#tab-${tabName}`).classList.add('active'); |
|
48 | 48 | ... options.headers |
49 | 49 | }; |
50 | 50 |
|
51 | | - const res = await fetch(url, { ...options, headers }); |
| 51 | + const res = await fetch(url, { ... options, headers }); |
52 | 52 | const text = await res.text(); |
53 | 53 |
|
54 | 54 | let data; |
|
58 | 58 | data = text; |
59 | 59 | } |
60 | 60 |
|
61 | | - if (! res.ok) { |
| 61 | + if (!res.ok) { |
62 | 62 | throw { status: res.status, data }; |
63 | 63 | } |
64 | 64 |
|
|
99 | 99 | function formatDuration(seconds) { |
100 | 100 | const m = Math.floor(seconds / 60); |
101 | 101 | const s = seconds % 60; |
102 | | - return `${m}:${s.toString().padStart(2, '0')}`; |
| 102 | + return `${m}: ${s.toString().padStart(2, '0')}`; |
103 | 103 | } |
104 | 104 |
|
105 | 105 | function renderLyrics(data, container) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 |
|
111 | | - const hasSynced = data.syncedLyrics && data.syncedLyrics.trim(); |
112 | | - const hasPlain = data.plainLyrics && data. plainLyrics.trim(); |
| 111 | + const hasSynced = data.syncedLyrics && data.syncedLyrics. trim(); |
| 112 | + const hasPlain = data.plainLyrics && data.plainLyrics.trim(); |
113 | 113 |
|
114 | 114 | let syncedHtml = ''; |
115 | 115 | if (hasSynced) { |
|
128 | 128 | container.innerHTML = ` |
129 | 129 | <div class="lyrics-display"> |
130 | 130 | <div class="lyrics-header"> |
131 | | - <h2>${escapeHtml(data.trackName)}</h2> |
| 131 | + <h2>${escapeHtml(data. trackName)}</h2> |
132 | 132 | <p>${escapeHtml(data.artistName)} — ${escapeHtml(data.albumName)}</p> |
133 | 133 | <div class="result-meta" style="margin-top: 12px;"> |
134 | 134 | <span class="result-badge">${formatDuration(data.duration)}</span> |
|
142 | 142 | <button class="lyrics-tab ${! hasSynced ? 'active' : ''}" data-lyrics="plain">Plain</button> |
143 | 143 | </div> |
144 | 144 | <div class="lyrics-content"> |
145 | | - <div id="lyrics-synced" ${!hasSynced ? 'style="display: none"' : ''}>${syncedHtml || '<p class="muted">No synchronized lyrics available</p>'}</div> |
| 145 | + <div id="lyrics-synced" ${! hasSynced ? 'style="display: none"' : ''}>${syncedHtml || '<p class="muted">No synchronized lyrics available</p>'}</div> |
146 | 146 | <div id="lyrics-plain" ${hasSynced ? 'style="display: none"' : ''}>${plainHtml}</div> |
147 | 147 | </div> |
148 | 148 | </div> |
|
221 | 221 | const data = await apiFetch(`/search?${qs}`); |
222 | 222 | renderSearchResults(data, container); |
223 | 223 | } catch (err) { |
224 | | - showError(container, err.data?.message || `Search failed (${err.status})`); |
| 224 | + showError(container, err. data?.message || `Search failed (${err.status})`); |
225 | 225 | } |
226 | 226 | }); |
227 | 227 |
|
|
328 | 328 |
|
329 | 329 | // Solve button |
330 | 330 | $('#btn-solve').addEventListener('click', async () => { |
331 | | - if (! currentChallenge) { |
| 331 | + if (!currentChallenge) { |
332 | 332 | $('#challenge-status').textContent = 'Please request a challenge first'; |
333 | 333 | return; |
334 | 334 | } |
|
379 | 379 | const prefix = data.prefix; |
380 | 380 | const nonce = data.nonce; |
381 | 381 |
|
382 | | - if (!prefix || !nonce) { |
| 382 | + if (!prefix || ! nonce) { |
383 | 383 | showError($('#publish-results'), 'Please request and solve a challenge first'); |
384 | 384 | return; |
385 | 385 | } |
|
0 commit comments