]> Harvie.CZ GIT Repositories and Mirrors - mirrors/JukeBox.git/commitdiff
More html5 player improvements by Cursor AI
authorTomas Mudrunka <tomas.mudrunka@gmail.com>
Sat, 28 Feb 2026 21:02:51 +0000 (22:02 +0100)
committerTomas Mudrunka <tomas.mudrunka@gmail.com>
Sat, 28 Feb 2026 21:02:51 +0000 (22:02 +0100)
index.php
jbx/themes/default/jukebox.css

index 55b38ffcacca4abf555ff1610f8008f7edcae521..cb084c72bede179987ca2c73c79b7d8be8fcbe66 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -278,21 +278,32 @@ function html5_player() {
 <html><head><meta charset="<?= $GLOBALS['charset'] ?>"><title><?= htmlspecialchars($title, ENT_QUOTES, $GLOBALS['charset']) ?>: Music Player</title>
 <link rel="stylesheet" type="text/css" href="<?= htmlspecialchars($css, ENT_QUOTES) ?>" />
 </head><body class="jbx-player">
+<div class="jbx-player-bar">
+<?php if($is_playlist) { ?>
+<button type="button" class="jbx-skip" id="jbx-prev" title="Previous" aria-label="Previous">&#8249;</button>
+<button type="button" class="jbx-skip" id="jbx-next" title="Next" aria-label="Next">&#8250;</button>
+<?php } ?>
 <audio id="jbx-audio" controls preload="metadata"<?= $song_url && !$is_playlist ? ' src="'.htmlspecialchars($song_url, ENT_QUOTES).'" autoplay' : '' ?>></audio>
+</div>
 <?php if($is_playlist) { ?>
 <script>
 (function(){
        var playlistUrl = <?= json_encode($playlist_url) ?>;
        var el = document.getElementById('jbx-audio');
-       function playNext(list, idx) {
-               if (idx >= list.length) return;
+       var list = [];
+       var idx = 0;
+       function playAt(i) {
+               if (i < 0 || i >= list.length) return;
+               idx = i;
                el.src = list[idx];
-               el.onended = function() { playNext(list, idx + 1); };
+               el.onended = function() { if (idx + 1 < list.length) playAt(idx + 1); };
                el.play();
        }
+       document.getElementById('jbx-prev').onclick = function() { playAt(idx - 1); };
+       document.getElementById('jbx-next').onclick = function() { playAt(idx + 1); };
        fetch(playlistUrl).then(function(r){ return r.text(); }).then(function(text){
-               var list = text.trim().split(/\r?\n/).filter(function(u){ return u.length; });
-               if (list.length) playNext(list, 0);
+               list = text.trim().split(/\r?\n/).filter(function(u){ return u.length; });
+               if (list.length) playAt(0);
        });
 })();
 </script>
index 7d7ac6f010431c6e1b54db35cd888a0b8d3d5a32..88c7e16e3279585a15d0fd4ea9b3f08b2d6b8c84 100755 (executable)
@@ -67,11 +67,39 @@ body.jbx-player {
        padding: 0;
        border: 0;
        height: 48px;
+       width: 100%;
        overflow: hidden;
+       box-sizing: border-box;
 }
-body.jbx-player #jbx-audio {
+body.jbx-player .jbx-player-bar {
+       display: flex;
+       flex-direction: row;
+       align-items: center;
        width: 100%;
        height: 48px;
+       box-sizing: border-box;
+}
+body.jbx-player .jbx-player-bar .jbx-skip {
+       flex: 0 0 auto;
+       width: 32px;
+       height: 32px;
+       margin: 0 2px;
+       padding: 0;
+       border: 1px solid rgba(255,255,255,0.5);
+       background: #000099;
+       color: white;
+       font-size: 18px;
+       line-height: 1;
+       cursor: pointer;
+       vertical-align: middle;
+}
+body.jbx-player .jbx-player-bar .jbx-skip:hover {
+       background: #0000cc;
+}
+body.jbx-player .jbx-player-bar #jbx-audio {
+       flex: 1 1 0;
+       min-width: 0;
+       height: 48px;
        display: block;
 }
 
This page took 0.318896 seconds and 4 git commands to generate.