album cover updates automatically
This commit is contained in:
parent
f23b55e5bd
commit
2f80e3c7a2
|
@ -41,8 +41,11 @@ img {
|
||||||
|
|
||||||
#albumCover {
|
#albumCover {
|
||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
|
padding-left: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#playerControls {
|
#playerControls {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
var httpRequest
|
var httpRequest
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
|
// track has ended
|
||||||
document.getElementById('player').addEventListener('ended', function() {
|
document.getElementById('player').addEventListener('ended', function() {
|
||||||
if (!document.getElementById('shuffle').checked) { return; }
|
// shuffle
|
||||||
|
if (document.getElementById('shuffle').checked) {
|
||||||
httpRequest = new XMLHttpRequest();
|
httpRequest = new XMLHttpRequest();
|
||||||
httpRequest.onreadystatechange = function() {
|
httpRequest.onreadystatechange = function() {
|
||||||
if (httpRequest.readyState !== XMLHttpRequest.DONE) { return; }
|
if (httpRequest.readyState !== XMLHttpRequest.DONE) { return; }
|
||||||
|
@ -12,6 +14,7 @@ function load() {
|
||||||
}
|
}
|
||||||
httpRequest.open('GET', '/musik/get_shuffle', true);
|
httpRequest.open('GET', '/musik/get_shuffle', true);
|
||||||
httpRequest.send();
|
httpRequest.send();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +40,10 @@ function change_track(track) {
|
||||||
player.load();
|
player.load();
|
||||||
player.play();
|
player.play();
|
||||||
document.getElementById('nowPlaying').innerHTML = track;
|
document.getElementById('nowPlaying').innerHTML = track;
|
||||||
|
|
||||||
|
let cd = document.getElementById('currentDirectory').innerText;
|
||||||
|
let art = document.getElementById('albumCover');
|
||||||
|
art.firstChild.src = '/musik/album_cover' + cd + 'folder.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_dir(item) {
|
function get_dir(item) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user