Skip to content

Commit 12092b4

Browse files
committed
Fix JS
1 parent 1a369d6 commit 12092b4

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Build/src/main.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@
1414
let solverCancel = false;
1515

1616
// Navigation
17-
$$('. nav-link[data-view]').forEach(link => {
17+
$$('.nav-link[data-view]').forEach(link => {
1818
link.addEventListener('click', (e) => {
1919
e.preventDefault();
2020
const view = link.dataset.view;
2121

2222
$$('.nav-link').forEach(l => l.classList.remove('active'));
2323
link.classList.add('active');
2424

25-
$$('.view').forEach(v => v.classList.remove('active'));
25+
$$('.view').forEach(v => v.classList. remove('active'));
2626
$(`#view-${view}`).classList.add('active');
2727
});
2828
});
2929

3030
// Tabs in Get view
31-
$$('. tab').forEach(tab => {
32-
tab.addEventListener('click', () => {
31+
$$('.tab').forEach(tab => {
32+
tab. addEventListener('click', () => {
3333
const tabName = tab.dataset.tab;
3434

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');
3737

3838
$$('.tab-content').forEach(tc => tc.classList.remove('active'));
3939
$(`#tab-${tabName}`).classList.add('active');
@@ -48,7 +48,7 @@
4848
... options.headers
4949
};
5050

51-
const res = await fetch(url, { ...options, headers });
51+
const res = await fetch(url, { ... options, headers });
5252
const text = await res.text();
5353

5454
let data;
@@ -58,7 +58,7 @@
5858
data = text;
5959
}
6060

61-
if (! res.ok) {
61+
if (!res.ok) {
6262
throw { status: res.status, data };
6363
}
6464

@@ -99,7 +99,7 @@
9999
function formatDuration(seconds) {
100100
const m = Math.floor(seconds / 60);
101101
const s = seconds % 60;
102-
return `${m}:${s.toString().padStart(2, '0')}`;
102+
return `${m}: ${s.toString().padStart(2, '0')}`;
103103
}
104104

105105
function renderLyrics(data, container) {
@@ -108,8 +108,8 @@
108108
return;
109109
}
110110

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();
113113

114114
let syncedHtml = '';
115115
if (hasSynced) {
@@ -128,7 +128,7 @@
128128
container.innerHTML = `
129129
<div class="lyrics-display">
130130
<div class="lyrics-header">
131-
<h2>${escapeHtml(data.trackName)}</h2>
131+
<h2>${escapeHtml(data. trackName)}</h2>
132132
<p>${escapeHtml(data.artistName)}${escapeHtml(data.albumName)}</p>
133133
<div class="result-meta" style="margin-top: 12px;">
134134
<span class="result-badge">${formatDuration(data.duration)}</span>
@@ -142,7 +142,7 @@
142142
<button class="lyrics-tab ${! hasSynced ? 'active' : ''}" data-lyrics="plain">Plain</button>
143143
</div>
144144
<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>
146146
<div id="lyrics-plain" ${hasSynced ? 'style="display: none"' : ''}>${plainHtml}</div>
147147
</div>
148148
</div>
@@ -221,7 +221,7 @@
221221
const data = await apiFetch(`/search?${qs}`);
222222
renderSearchResults(data, container);
223223
} catch (err) {
224-
showError(container, err.data?.message || `Search failed (${err.status})`);
224+
showError(container, err. data?.message || `Search failed (${err.status})`);
225225
}
226226
});
227227

@@ -328,7 +328,7 @@
328328

329329
// Solve button
330330
$('#btn-solve').addEventListener('click', async () => {
331-
if (! currentChallenge) {
331+
if (!currentChallenge) {
332332
$('#challenge-status').textContent = 'Please request a challenge first';
333333
return;
334334
}
@@ -379,7 +379,7 @@
379379
const prefix = data.prefix;
380380
const nonce = data.nonce;
381381

382-
if (!prefix || !nonce) {
382+
if (!prefix || ! nonce) {
383383
showError($('#publish-results'), 'Please request and solve a challenge first');
384384
return;
385385
}

0 commit comments

Comments
 (0)