fixing arrows homescreen

This commit is contained in:
oslomp
2018-12-17 19:59:36 +01:00
parent 6cf1b4bef2
commit fe5a4b9119

View File

@ -197,15 +197,29 @@ function renderQueue(playNextAt, now)
var canDeletePrevious = false; var canDeletePrevious = false;
$.each(queue, function (id, song) { $.each(queue, function (id, song) {
var requestedBy = song.requested_by; var requestedBy = song.requested_by;
var requestCurr = requestedBy != 'Marietje';
//checks if id is the last item and returns false if the next song is Marietje, while the current song is not.
if(id === queue.length-1){
var requestNext = false
} else {
var requestNext = !((queue[id+1].requested_by === 'Marietje') && (requestedBy !== 'Marietje'))
}
//checks if id is the first item and returns false if the previous song is not Marietje, while the current song is.
if(id === 0){
var requestPrev = false
//
} else {
var requestPrev = !((queue[id-1].requested_by !== 'Marietje') && (requestedBy === 'Marietje'))
}
console.log(requestNext, requestPrev, requestCurr);
var canDelete = song.can_move_down || canMoveSongs; var canDelete = song.can_move_down || canMoveSongs;
var canMoveUp = canMoveSongs && id != queue.length -5 || canDeletePrevious && id < queue.length - 5; var canMoveUp = canMoveSongs && requestPrev || canDeletePrevious && requestCurr && requestPrev;
var canMoveDown = canDelete && id < queue.length - 6 || canMoveSongs && id < queue.length - 1 && id != queue.length - 6; var canMoveDown = canMoveSongs && requestNext || canDelete && requestCurr && requestNext;
var artist = song.song.artist.trim() === '' ? '?' : song.song.artist; var artist = song.song.artist.trim() === '' ? '?' : song.song.artist;
var title = song.song.title.trim() === '' ? '?' : song.song.title; var title = song.song.title.trim() === '' ? '?' : song.song.title;
var prevId = song.id - 1; var prevId = song.id - 1;
console.log(song.id, id);
console.log(song);
console.log(queue);
showTime = showTimeToPlay ? (timeToPlay < 0 ? '' : timeToPlay.secondsToMMSS()) : (playNextAt < now ? '' : playNextAt.timestampToHHMMSS()) showTime = showTimeToPlay ? (timeToPlay < 0 ? '' : timeToPlay.secondsToMMSS()) : (playNextAt < now ? '' : playNextAt.timestampToHHMMSS())