1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update listviews

This commit is contained in:
Luke Pulverenti 2016-07-16 14:02:39 -04:00
parent 1032fa887e
commit f458196922
31 changed files with 168 additions and 100 deletions

View file

@ -1,7 +1,11 @@
define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'globalize', 'loading'], function (playbackManager, inputManager, connectionManager, embyRouter, globalize, loading) {
function playAllFromHere(card, serverId) {
var cards = card.parentNode.querySelectorAll('.itemAction[data-id]');
var parent = card.parentNode;
var className = card.classList.length ? ('.' + card.classList[0]) : '';
var cards = parent.querySelectorAll(className + '[data-id]');
var ids = [];
var foundCard = false;
@ -13,6 +17,11 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
ids.push(cards[i].getAttribute('data-id'));
}
}
if (!ids.length) {
return;
}
playbackManager.play({
ids: ids,
serverId: serverId
@ -75,7 +84,14 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}
function executeAction(card, action) {
var id = card.getAttribute('data-id');
if (!id) {
card = parentWithAttribute(card, 'data-id');
id = card.getAttribute('data-id');
}
var serverId = card.getAttribute('data-serverid');
var type = card.getAttribute('data-type');
var isfolder = card.getAttribute('data-isfolder') == 'true';
@ -197,7 +213,14 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var card = parentWithClass(e.target, 'itemAction');
if (card) {
var action = card.getAttribute('data-action');
var actionElement = card;
var action = actionElement.getAttribute('data-action');
if (!action) {
actionElement = parentWithAttribute(actionElement, 'data-action');
action = actionElement.getAttribute('data-action');
}
if (action) {
executeAction(card, action);
@ -205,6 +228,19 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}
}
function parentWithAttribute(elem, name) {
while (!elem.getAttribute(name)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {