From: Chris Fulljames Date: Thu, 16 Jan 2025 01:18:53 +0000 (-0500) Subject: Add buttons X-Git-Url: https://littlesong.place/gitweb/?a=commitdiff_plain;h=9414a702027706e5c4470a519b1a247cd2132507;p=littlesongplace.git Add buttons --- diff --git a/main.py b/main.py index 3eeaaef..95efe86 100644 --- a/main.py +++ b/main.py @@ -17,7 +17,7 @@ import bleach 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(".") diff --git a/static/littlesongplace01.gif b/static/littlesongplace01.gif index d6bb789..a727c95 100644 Binary files a/static/littlesongplace01.gif and b/static/littlesongplace01.gif differ diff --git a/static/lsp_btn_delete.gif b/static/lsp_btn_delete.gif new file mode 100644 index 0000000..a7b9690 Binary files /dev/null and b/static/lsp_btn_delete.gif differ diff --git a/static/lsp_btn_edit.gif b/static/lsp_btn_edit.gif new file mode 100644 index 0000000..c3d599f Binary files /dev/null and b/static/lsp_btn_edit.gif differ diff --git a/static/lsp_btn_hide.gif b/static/lsp_btn_hide.gif new file mode 100644 index 0000000..6760fa3 Binary files /dev/null and b/static/lsp_btn_hide.gif differ diff --git a/static/lsp_btn_next.gif b/static/lsp_btn_next.gif new file mode 100644 index 0000000..ecff72c Binary files /dev/null and b/static/lsp_btn_next.gif differ diff --git a/static/lsp_btn_pause.gif b/static/lsp_btn_pause.gif new file mode 100644 index 0000000..4dce963 Binary files /dev/null and b/static/lsp_btn_pause.gif differ diff --git a/static/lsp_btn_play.gif b/static/lsp_btn_play.gif new file mode 100644 index 0000000..7e5d1de Binary files /dev/null and b/static/lsp_btn_play.gif differ diff --git a/static/lsp_btn_prev.gif b/static/lsp_btn_prev.gif new file mode 100644 index 0000000..9de19de Binary files /dev/null and b/static/lsp_btn_prev.gif differ diff --git a/static/lsp_btn_show.gif b/static/lsp_btn_show.gif new file mode 100644 index 0000000..901b52a Binary files /dev/null and b/static/lsp_btn_show.gif differ diff --git a/static/player.js b/static/player.js index b9fbc95..75b639b 100644 --- a/static/player.js +++ b/static/player.js @@ -3,8 +3,13 @@ var m_songIndex = 0; // 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(); } @@ -155,10 +160,10 @@ document.addEventListener("DOMContentLoaded", (event) => { 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); } }); diff --git a/static/styles.css b/static/styles.css index 4beab5c..3309e4a 100644 --- a/static/styles.css +++ b/static/styles.css @@ -1,6 +1,12 @@ /* General */ +:root { + --yellow: #e8e590; + --purple: #9986a6; +} + body { - background: #ede99f; + background: var(--yellow); + color: var(--purple); } div.main { @@ -22,6 +28,7 @@ div.navbar { .filter { margin: 5px; } + .filter-remove { font-size: 12px; } @@ -59,6 +66,11 @@ div.song-buttons { align-items: center; } +a.song-list-button img { + image-rendering: pixelated; + width: 24px; +} + div.song-details { display: flex; flex-direction: column; @@ -83,7 +95,7 @@ div.player { right: 0; height: 100px; border: 3px solid #000; - background: #fff; + background: var(--yellow); } div.player-info { @@ -110,6 +122,11 @@ a.player-button { display: inline-block; } +a.player-button img { + image-rendering: pixelated; + width: 24px; +} + #player-position { display: inline-block; position: relative; diff --git a/templates/base.html b/templates/base.html index c0d9b4a..0fbfaf9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -50,9 +50,15 @@
- << - > - >> + + Previous + + + Play + + + Next +
diff --git a/templates/song-list.html b/templates/song-list.html index af59a11..8e89af1 100644 --- a/templates/song-list.html +++ b/templates/song-list.html @@ -26,20 +26,24 @@
- Show Details + + Show Details + {% if session["userid"] == song.userid %} -
- Edit -
-
- Delete -
+ + Edit + + + Delete + {% endif %} - Play + + Play +
@@ -61,7 +65,14 @@