import click
from bleach.css_sanitizer import CSSSanitizer
from flask import Flask, render_template, request, redirect, g, session, abort, \
- send_from_directory, flash
+ send_from_directory, flash, get_flashed_messages
from werkzeug.utils import secure_filename
DATA_DIR = Path(".")
// Play a new song from the list in the player
function play(event) {
- var song = event.target.parentElement.parentElement.parentElement;
- m_songIndex = m_allSongs.indexOf(song);
+ var songElement = event.target;
+ while (!songElement.classList.contains("song"))
+ {
+ songElement = songElement.parentElement;
+ console.log(songElement);
+ }
+ m_songIndex = m_allSongs.indexOf(songElement);
playCurrentSong();
}
playerPosition.addEventListener("mouseleave", songScrub);
playerPosition.addEventListener("mousemove", songScrub);
- // Song play
- for (const element of document.getElementsByClassName("song-play-button")) {
- m_allSongs.push(element.parentElement.parentElement.parentElement);
- element.addEventListener("click", play);
+ // Song queue
+ for (const element of document.getElementsByClassName("song")) {
+ console.log(element);
+ m_allSongs.push(element);
}
});
/* General */
+:root {
+ --yellow: #e8e590;
+ --purple: #9986a6;
+}
+
body {
- background: #ede99f;
+ background: var(--yellow);
+ color: var(--purple);
}
div.main {
.filter {
margin: 5px;
}
+
.filter-remove {
font-size: 12px;
}
align-items: center;
}
+a.song-list-button img {
+ image-rendering: pixelated;
+ width: 24px;
+}
+
div.song-details {
display: flex;
flex-direction: column;
right: 0;
height: 100px;
border: 3px solid #000;
- background: #fff;
+ background: var(--yellow);
}
div.player-info {
display: inline-block;
}
+a.player-button img {
+ image-rendering: pixelated;
+ width: 24px;
+}
+
#player-position {
display: inline-block;
position: relative;
<a id="player-artist" hidden></a>
</div>
<div class="player-controls">
- <a href="javascript:songPrevious()" class="player-button"><<</a>
- <a href="javascript:songPlayPause()" class="player-button">></a>
- <a href="javascript:songNext()" class="player-button">>></a>
+ <a href="javascript:songPrevious()" class="player-button">
+ <img src="/static/lsp_btn_prev.gif" alt="Previous">
+ </a>
+ <a href="javascript:songPlayPause()" class="player-button">
+ <img src="/static/lsp_btn_play.gif" alt="Play">
+ </a>
+ <a href="javascript:songNext()" class="player-button">
+ <img src="/static/lsp_btn_next.gif" alt="Next">
+ </a>
<div id="player-position">
<span id="player-position-bar"></span>
<span id="player-position-dot"></span>
<div class="song-buttons">
<!-- Details Button -->
- <a href="#" onclick="showDetails(event)" class="song-details-button">Show Details</a>
+ <a href="#" onclick="return showDetails(event)" class="song-list-button">
+ <img src="/static/lsp_btn_show.gif" alt="Show Details">
+ </a>
<!-- Owner-Specific Buttons (Edit/Delete) -->
{% if session["userid"] == song.userid %}
- <div class="song-edit-button">
- <a href="/edit-song?songid={{ song.songid }}">Edit</a>
- </div>
- <div class="song-delete-button">
- <a href="/delete-song/{{ song.userid }}/{{ song.songid }}" onclick="return confirm("Are you sure you want to delete this song?")">Delete</a>
- </div>
+ <a href="/edit-song?songid={{ song.songid }}" class="song-list-button">
+ <img src="/static/lsp_btn_edit.gif" alt="Edit">
+ </a>
+ <a href="/delete-song/{{ song.userid }}/{{ song.songid }}" onclick="return confirm("Are you sure you want to delete this song?")" class="song-list-button">
+ <img src="/static/lsp_btn_delete.gif" alt="Delete">
+ </a>
{% endif %}
<!-- Play Button -->
- <a href="#" class="song-play-button">Play</a>
+ <a href="#" onclick="return play(event)" class="song-list-button">
+ <img src="/static/lsp_btn_play.gif" alt="Play">
+ </a>
</div>
</div>
<script>
function showDetails(event) {
- var songElement = event.target.parentElement.parentElement.parentElement;
+ // Find song-main
+ var songElement = event.target;
+ while (!songElement.classList.contains("song"))
+ {
+ songElement = songElement.parentElement;
+ console.log(songElement);
+ }
+
for (const child of songElement.children) {
if (child.classList.contains("song-details")) {
if (child.hidden) {
}
}
}
+ return false;
}
</script>