update now playing screen
This commit is contained in:
parent
3ead8a75b4
commit
ad285bf734
20 changed files with 265 additions and 119 deletions
|
@ -107,20 +107,35 @@
|
|||
|
||||
function onDrop(evt, itemsContainer) {
|
||||
|
||||
|
||||
loading.show();
|
||||
|
||||
var el = evt.item;
|
||||
|
||||
var newIndex = evt.newIndex;
|
||||
var itemId = el.getAttribute('data-playlistitemid');
|
||||
var playlistId = el.getAttribute('data-playlistid');
|
||||
|
||||
if (!playlistId) {
|
||||
|
||||
var oldIndex = evt.oldIndex;
|
||||
|
||||
el.dispatchEvent(new CustomEvent('itemdrop', {
|
||||
detail: {
|
||||
oldIndex: oldIndex,
|
||||
newIndex: newIndex,
|
||||
playlistItemId: itemId
|
||||
},
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
var serverId = el.getAttribute('data-serverid');
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
newIndex = Math.max(0, newIndex - 1);
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.ajax({
|
||||
|
||||
url: apiClient.getUrl('Playlists/' + playlistId + '/Items/' + itemId + '/Move/' + newIndex),
|
||||
|
@ -129,7 +144,6 @@
|
|||
|
||||
}).then(function () {
|
||||
|
||||
el.setAttribute('data-index', newIndex);
|
||||
loading.hide();
|
||||
|
||||
}, function () {
|
||||
|
@ -171,7 +185,7 @@
|
|||
// dragging ended
|
||||
onEnd: function (/**Event*/evt) {
|
||||
|
||||
onDrop(evt, self);
|
||||
return onDrop(evt, self);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue