style: auto-fix linting issues
This commit is contained in:
parent
46c565e437
commit
0735d2a202
3 changed files with 73 additions and 39 deletions
30
index.html
30
index.html
|
|
@ -1649,11 +1649,17 @@
|
|||
<div class="modal-content">
|
||||
<h3 style="text-align: center; margin-bottom: 1rem">Support Monochrome</h3>
|
||||
<p style="text-align: center; margin-bottom: 1.5rem; line-height: 1.6; color: var(--muted-foreground)">
|
||||
If Monochrome has been useful to you and you're able to, consider making a donation. It helps pay for
|
||||
the server and domain, and you get to support us :)
|
||||
If Monochrome has been useful to you and you're able to, consider making a donation. It helps pay
|
||||
for the server and domain, and you get to support us :)
|
||||
</p>
|
||||
<div style="display: flex; justify-content: center; margin-bottom: 2rem">
|
||||
<a href="https://ko-fi.com/monochromemusic" target="_blank" rel="noopener noreferrer" class="btn-primary" style="text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem">
|
||||
<a
|
||||
href="https://ko-fi.com/monochromemusic"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="btn-primary"
|
||||
style="text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem"
|
||||
>
|
||||
Donate on Ko-fi
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -1661,7 +1667,19 @@
|
|||
<p style="font-size: 0.9rem; color: var(--muted-foreground); margin-bottom: 0.5rem">
|
||||
An alternative way to support us is by starring us on GitHub, and it's completely free!
|
||||
</p>
|
||||
<a href="https://github.com/monochrome-music/monochrome" target="_blank" rel="noopener noreferrer" class="btn-secondary" style="text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem">
|
||||
<a
|
||||
href="https://github.com/monochrome-music/monochrome"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="btn-secondary"
|
||||
style="
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
"
|
||||
>
|
||||
Star on GitHub
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -5180,7 +5198,9 @@
|
|||
It helps pay for the server and domain, and you get to support us :)
|
||||
</p>
|
||||
<div
|
||||
class="donate-button" id="donate-button-container" style="
|
||||
class="donate-button"
|
||||
id="donate-button-container"
|
||||
style="
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
|
|
|
|||
54
js/app.js
54
js/app.js
|
|
@ -1210,14 +1210,19 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
const totalTracks = songs.length;
|
||||
progressTotal.textContent = totalTracks.toString();
|
||||
|
||||
const result = await parseCSV(csvText, api, (progress) => {
|
||||
const percentage = totalTracks > 0 ? (progress.current / totalTracks) * 100 : 0;
|
||||
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
||||
progressCurrent.textContent = progress.current.toString();
|
||||
currentTrackElement.textContent = progress.currentTrack;
|
||||
if (currentArtistElement)
|
||||
currentArtistElement.textContent = progress.currentArtist || '';
|
||||
}, importOptions);
|
||||
const result = await parseCSV(
|
||||
csvText,
|
||||
api,
|
||||
(progress) => {
|
||||
const percentage = totalTracks > 0 ? (progress.current / totalTracks) * 100 : 0;
|
||||
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
||||
progressCurrent.textContent = progress.current.toString();
|
||||
currentTrackElement.textContent = progress.currentTrack;
|
||||
if (currentArtistElement)
|
||||
currentArtistElement.textContent = progress.currentArtist || '';
|
||||
},
|
||||
importOptions
|
||||
);
|
||||
|
||||
tracks = result.tracks;
|
||||
const missingTracks = result.missingTracks;
|
||||
|
|
@ -1354,17 +1359,22 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
const totalItems = Math.max(0, lines.length - 1);
|
||||
progressTotal.textContent = totalItems.toString();
|
||||
|
||||
const result = await parseDynamicCSV(csvText, api, (progress) => {
|
||||
const percentage = totalItems > 0 ? (progress.current / totalItems) * 100 : 0;
|
||||
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
||||
progressCurrent.textContent = progress.current.toString();
|
||||
currentTrackElement.textContent = progress.currentItem;
|
||||
if (currentArtistElement) {
|
||||
currentArtistElement.textContent = progress.type
|
||||
? `Importing ${progress.type}...`
|
||||
: '';
|
||||
}
|
||||
}, importOptions);
|
||||
const result = await parseDynamicCSV(
|
||||
csvText,
|
||||
api,
|
||||
(progress) => {
|
||||
const percentage = totalItems > 0 ? (progress.current / totalItems) * 100 : 0;
|
||||
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
||||
progressCurrent.textContent = progress.current.toString();
|
||||
currentTrackElement.textContent = progress.currentItem;
|
||||
if (currentArtistElement) {
|
||||
currentArtistElement.textContent = progress.type
|
||||
? `Importing ${progress.type}...`
|
||||
: '';
|
||||
}
|
||||
},
|
||||
importOptions
|
||||
);
|
||||
|
||||
const hasMultipleTypes =
|
||||
result.tracks.length > 0 && (result.albums.length > 0 || result.artists.length > 0);
|
||||
|
|
@ -2402,7 +2412,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
if (donateModal) {
|
||||
if (closeDonateModalBtn) closeDonateModalBtn.addEventListener('click', closeDonateModal);
|
||||
donateModal.querySelector('.modal-overlay')?.addEventListener('click', closeDonateModal);
|
||||
|
||||
|
||||
if (sidebarDonateLink) sidebarDonateLink.addEventListener('click', openDonateModal);
|
||||
if (donateBtnAbout) donateBtnAbout.addEventListener('click', openDonateModal);
|
||||
if (donateBtnPage) donateBtnPage.addEventListener('click', openDonateModal);
|
||||
|
|
@ -2606,7 +2616,9 @@ function showMissingTracksNotification(missingTracks) {
|
|||
newCopyBtn.addEventListener('click', () => {
|
||||
const textToCopy = missingTracks
|
||||
.map((track) => {
|
||||
return typeof track === 'string' ? track : `${track.artist ? track.artist + ' - ' : ''}${track.title}`;
|
||||
return typeof track === 'string'
|
||||
? track
|
||||
: `${track.artist ? track.artist + ' - ' : ''}${track.title}`;
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
|
|
|
|||
|
|
@ -9,22 +9,24 @@ function findBestMatch(items, targetArtist, targetAlbum, options) {
|
|||
if (!items || items.length === 0) return null;
|
||||
if (!options?.strictArtistMatch && !options?.albumMatch) return items[0];
|
||||
|
||||
return items.find((item) => {
|
||||
let artistOk = true;
|
||||
let albumOk = true;
|
||||
return (
|
||||
items.find((item) => {
|
||||
let artistOk = true;
|
||||
let albumOk = true;
|
||||
|
||||
if (options.strictArtistMatch && targetArtist) {
|
||||
const itemArtist = item.artist?.name || item.artists?.[0]?.name;
|
||||
if (!isFuzzyMatch(itemArtist, targetArtist)) artistOk = false;
|
||||
}
|
||||
if (options.strictArtistMatch && targetArtist) {
|
||||
const itemArtist = item.artist?.name || item.artists?.[0]?.name;
|
||||
if (!isFuzzyMatch(itemArtist, targetArtist)) artistOk = false;
|
||||
}
|
||||
|
||||
if (options.albumMatch && targetAlbum) {
|
||||
const itemAlbum = item.album?.title;
|
||||
if (itemAlbum && !isFuzzyMatch(itemAlbum, targetAlbum)) albumOk = false;
|
||||
}
|
||||
if (options.albumMatch && targetAlbum) {
|
||||
const itemAlbum = item.album?.title;
|
||||
if (itemAlbum && !isFuzzyMatch(itemAlbum, targetAlbum)) albumOk = false;
|
||||
}
|
||||
|
||||
return artistOk && albumOk;
|
||||
}) || null;
|
||||
return artistOk && albumOk;
|
||||
}) || null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue