From: Chris Fulljames Date: Wed, 26 Feb 2025 01:09:12 +0000 (-0500) Subject: Add shuffle checkbox to song list X-Git-Url: https://littlesong.place/gitweb/gitweb.cgi?a=commitdiff_plain;h=059f2c7bd9b74a324e5d688ea8219da4e8387bd3;p=littlesongplace.git Add shuffle checkbox to song list --- diff --git a/static/player.js b/static/player.js index cdee152..a2dfb7e 100644 --- a/static/player.js +++ b/static/player.js @@ -155,8 +155,15 @@ function songUpdate() { } // Add event listeners +var m_firstLoad = true; document.addEventListener("DOMContentLoaded", (event) => { + // The player never gets rebuilt, so we only need to set it up the first time + if (!m_firstLoad) { + return; + } + m_firstLoad = false; + // Audio playback position while playing var audio = document.getElementById("player-audio"); audio.addEventListener("timeupdate", songUpdate); diff --git a/static/styles.css b/static/styles.css index fa18e73..b3006ae 100644 --- a/static/styles.css +++ b/static/styles.css @@ -298,13 +298,17 @@ input[type=file] { } /* Song Entry in Song List */ -div.song-list { +.song-list-controls { + padding-bottom: 5px; +} + +div.song-list-songs { display: flex; flex-direction: column; gap: 10px; } -.song-list .song { +.song-list-songs .song { box-shadow: 0px 0px 5px 0px; border-radius: 10px; } diff --git a/templates/song-list.html b/templates/song-list.html index 775125c..d135fc7 100644 --- a/templates/song-list.html +++ b/templates/song-list.html @@ -1,33 +1,39 @@ {% from "song-macros.html" import song_info, song_details %}
-{% for song in songs %} -
-
-
- {%- if song.user_has_pfp %} - - - {%- endif %} -
+
+ +
+ +
+ {% for song in songs %} +
+
+
+ {%- if song.user_has_pfp %} + + + {%- endif %} +
- {{ song_info(song) | indent(12) }} + {{ song_info(song) | indent(12) }} -
- - +
+ + - - + + +
+ {{ song_details(song, current_user_playlists) | indent(8) }}
- {{ song_details(song, current_user_playlists) | indent(8) }} + {% endfor %}
-{% endfor %}