completely fixed the arrows

This commit is contained in:
oslomp
2018-12-19 00:39:21 +01:00
parent a000774e0b
commit b6a0f25d19

View File

@ -53,7 +53,6 @@ $(function () {
return false return false
} }
$.post('/api/report', {id: songId, msg: message, csrfmiddlewaretoken: csrf_token}, function (result) { $.post('/api/report', {id: songId, msg: message, csrfmiddlewaretoken: csrf_token}, function (result) {
console.log(result);
if (result.success) { if (result.success) {
createAlert('success', 'Thanks for your song report!'); createAlert('success', 'Thanks for your song report!');
} }
@ -208,18 +207,17 @@ function renderQueue(playNextAt, now)
//checks if id is the first item and returns false if the previous song is not Marietje, while the current song is. //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){ if(id === 0){
var requestPrev = false var requestPrev = false
//
} else { } else {
var requestPrev = !((queue[id-1].requested_by !== 'Marietje') && (requestedBy === 'Marietje')) var requestPrev = !((queue[id-1].requested_by !== 'Marietje') && (requestedBy === 'Marietje'))
var prevItem = queue[id-1].id
} }
console.log(requestNext, requestPrev, requestCurr);
var canDelete = song.can_move_down || canMoveSongs; var canDelete = song.can_move_down || canMoveSongs;
var canMoveUp = canMoveSongs && requestPrev || canDeletePrevious && requestCurr && requestPrev; var canMoveUp = canMoveSongs && requestPrev || canDeletePrevious && requestCurr && requestPrev;
var canMoveDown = canMoveSongs && requestNext || canDelete && requestCurr && requestNext; 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;
showTime = showTimeToPlay ? (timeToPlay < 0 ? '' : timeToPlay.secondsToMMSS()) : (playNextAt < now ? '' : playNextAt.timestampToHHMMSS()) showTime = showTimeToPlay ? (timeToPlay < 0 ? '' : timeToPlay.secondsToMMSS()) : (playNextAt < now ? '' : playNextAt.timestampToHHMMSS())
@ -228,7 +226,7 @@ function renderQueue(playNextAt, now)
+ '</td><td class="hidden-xs plays-at" style="text-align: right;">' + showTime + '</td><td class="hidden-xs plays-at" style="text-align: right;">' + showTime
+ '</td><td>' + '<a href="#" class="glyphicon glyphicon-arrow-up' + '</td><td>' + '<a href="#" class="glyphicon glyphicon-arrow-up'
+ (canMoveUp && id !== 0 ? '' : ' invisible') + (canMoveUp && id !== 0 ? '' : ' invisible')
+ '" onclick=" return moveDown(' + prevId + '" onclick=" return moveDown(' + prevItem
+ ')"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="glyphicon glyphicon-arrow-down' + ')"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="glyphicon glyphicon-arrow-down'
+ (canMoveDown ? '' : ' invisible') + '" onclick="return moveDown(' + (canMoveDown ? '' : ' invisible') + '" onclick="return moveDown('
+ song.id + ')"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="glyphicon glyphicon-trash' + song.id + ')"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="glyphicon glyphicon-trash'