Skip to content

Commit

Permalink
Fix various bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwilarg committed Jul 2, 2024
1 parent 1c897fe commit dd655af
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
1 change: 1 addition & 0 deletions discordbot/DiscordBot/Player/MusicPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static async Task PlayMusicAsync(IServiceProvider serviceProvider, JsonEx
break;
}
}
await serverData.VoiceChannel.DisconnectAsync();
}
}
}
1 change: 1 addition & 0 deletions web/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ html {
background-color: var(--settings);
padding: .5em;
height: 100%;
z-index: 2;
}

fieldset {
Expand Down
64 changes: 34 additions & 30 deletions web/src/getMusics.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,41 +265,45 @@ function displaySongs(musics, id, filter, doesSort, doesShuffle, count) {
musics.sort((a, b) => a.name.localeCompare(b.name));
}

let indexs = [];
for (let elem of musics) {
let albumImg = getAlbumImage(elem);
html += `
<div class="song" data-name="${sanitize(elem.name)}" id="song-${id}-${elem.id}">
<div class="song-img${isMinimalist ? " hidden" : ""}">
<img id="img-${id}-${elem.id}" src="${albumImg}"/>
if (filter !== "" && musics.length == 0) {
document.getElementById(id).innerHTML = "<b>No song match is matching your search</b>";
} else {
let indexs = [];
for (let elem of musics) {
let albumImg = getAlbumImage(elem);
html += `
<div class="song" data-name="${sanitize(elem.name)}" id="song-${id}-${elem.id}">
<div class="song-img${isMinimalist ? " hidden" : ""}">
<img id="img-${id}-${elem.id}" src="${albumImg}"/>
</div>
<p>
${sanitize(elem.name)}<br/>
${sanitize(elem.artist)}
</p>
</div>
<p>
${sanitize(elem.name)}<br/>
${sanitize(elem.artist)}
</p>
</div>
`;
indexs.push(elem.id);
}
document.getElementById(id).innerHTML = html;
for (let i of indexs) {
// Add listeners
// If we are in minimalist mode, we allow click anywhere on the song since only the text part is displayed
// If we are not, we only allow click on the image so user can copy text without starting song
document.getElementById(`img-${id}-${i}`).onclick = () => {
if (!isMinimalist) {
prepareShuffle(i);
}
`;
indexs.push(elem.id);
}
document.getElementById(`song-${id}-${i}`).onclick = () => {
if (isMinimalist) {
prepareShuffle(i);
document.getElementById(id).innerHTML = html;
for (let i of indexs) {
// Add listeners
// If we are in minimalist mode, we allow click anywhere on the song since only the text part is displayed
// If we are not, we only allow click on the image so user can copy text without starting song
document.getElementById(`img-${id}-${i}`).onclick = () => {
if (!isMinimalist) {
prepareShuffle(i);
}
}
document.getElementById(`song-${id}-${i}`).onclick = () => {
if (isMinimalist) {
prepareShuffle(i);
}
}
}
}

// Playlist changed, maybe there is a song we should highlight now
updateSongHighlightColor();
// Playlist changed, maybe there is a song we should highlight now
updateSongHighlightColor();
}
}

function addZero(nb) {
Expand Down

0 comments on commit dd655af

Please sign in to comment.