mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update listviews
This commit is contained in:
parent
c87b1304da
commit
d9c694f564
13 changed files with 149 additions and 124 deletions
|
@ -15,12 +15,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.4.90",
|
||||
"_release": "1.4.90",
|
||||
"version": "1.4.91",
|
||||
"_release": "1.4.91",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.4.90",
|
||||
"commit": "36704279e05a90730af96c13b16c60ecc30cdce8"
|
||||
"tag": "1.4.91",
|
||||
"commit": "a4c5466d5a59e57b157aa941fcadb1e0df602f75"
|
||||
},
|
||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "^1.2.0",
|
||||
|
|
|
@ -112,8 +112,8 @@
|
|||
} else {
|
||||
|
||||
dialogOptions.modal = false;
|
||||
dialogOptions.entryAnimationDuration = 160;
|
||||
dialogOptions.exitAnimationDuration = 200;
|
||||
dialogOptions.entryAnimationDuration = 140;
|
||||
dialogOptions.exitAnimationDuration = 180;
|
||||
dialogOptions.autoFocus = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,18 @@
|
|||
return apiClient.getItem(apiClient.getCurrentUserId(), id);
|
||||
}
|
||||
|
||||
function showContextMenu(button) {
|
||||
function showContextMenu(button, itemsContainer) {
|
||||
|
||||
getItem(button).then(function (item) {
|
||||
|
||||
var playlistId = itemsContainer.getAttribute('data-playlistid');
|
||||
var collectionId = itemsContainer.getAttribute('data-collectionid');
|
||||
|
||||
if (playlistId) {
|
||||
var elem = parentWithAttribute(button, 'data-playlistitemid');
|
||||
item.PlaylistItemId = elem ? elem.getAttribute('data-playlistitemid') : null;
|
||||
}
|
||||
|
||||
require(['itemContextMenu'], function (itemContextMenu) {
|
||||
itemContextMenu.show({
|
||||
positionTo: button,
|
||||
|
@ -52,13 +60,23 @@
|
|||
queue: true,
|
||||
playAllFromHere: !item.IsFolder,
|
||||
queueAllFromHere: !item.IsFolder,
|
||||
identify: false
|
||||
identify: false,
|
||||
playlistId: playlistId,
|
||||
collectionId: collectionId
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
if (result.command == 'playallfromhere' || result.command == 'queueallfromhere') {
|
||||
itemShortcuts.execute(button, result.command);
|
||||
}
|
||||
else if (result.command == 'removefromplaylist' || result.command == 'removefromcollection') {
|
||||
|
||||
itemsContainer.dispatchEvent(new CustomEvent('needsrefresh', {
|
||||
detail: {},
|
||||
cancelable: false,
|
||||
bubbles: true
|
||||
}));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -66,9 +84,11 @@
|
|||
|
||||
function onClick(e) {
|
||||
|
||||
var itemsContainer = this;
|
||||
|
||||
var menuButton = parentWithClass(e.target, 'menuButton');
|
||||
if (menuButton) {
|
||||
showContextMenu(menuButton);
|
||||
showContextMenu(menuButton, itemsContainer);
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
var serverId = item.ServerId;
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
var canPlay = playbackManager.canPlay(item);
|
||||
|
||||
return apiClient.getCurrentUser().then(function (user) {
|
||||
|
||||
var commands = [];
|
||||
|
@ -42,7 +44,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
|
||||
if (!isTheater) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#Edit'),
|
||||
name: globalize.translate('sharedcomponents#EditInfo'),
|
||||
id: 'edit'
|
||||
});
|
||||
commands.push({
|
||||
|
@ -85,7 +87,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
}
|
||||
|
||||
if (options.open !== false) {
|
||||
if (item.Type != 'Timer') {
|
||||
if (item.Type != 'Timer' && item.Type != 'Audio') {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#Open'),
|
||||
id: 'open'
|
||||
|
@ -93,6 +95,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
}
|
||||
}
|
||||
|
||||
if (canPlay) {
|
||||
if (options.play !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#Play'),
|
||||
|
@ -122,6 +125,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item.Type == 'Program' && (!item.TimerId && !item.SeriesTimerId)) {
|
||||
|
||||
|
@ -141,6 +145,20 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
}
|
||||
}
|
||||
|
||||
if (item.PlaylistItemId && options.playlistId) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#RemoveFromPlaylist'),
|
||||
id: 'removefromplaylist'
|
||||
});
|
||||
}
|
||||
|
||||
if (options.collectionId) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#RemoveFromCollection'),
|
||||
id: 'removefromcollection'
|
||||
});
|
||||
}
|
||||
|
||||
if (options.share !== false) {
|
||||
if (itemHelper.canShare(user, item)) {
|
||||
commands.push({
|
||||
|
@ -197,7 +215,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
};
|
||||
}
|
||||
|
||||
function executeCommand(item, id) {
|
||||
function executeCommand(item, id, options) {
|
||||
|
||||
var itemId = item.Id;
|
||||
var serverId = item.ServerId;
|
||||
|
@ -378,6 +396,37 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
getResolveFunction(resolve, id)();
|
||||
break;
|
||||
}
|
||||
case 'removefromplaylist':
|
||||
|
||||
apiClient.ajax({
|
||||
|
||||
url: apiClient.getUrl('Playlists/' + options.playlistId + '/Items', {
|
||||
EntryIds: [item.PlaylistItemId].join(',')
|
||||
}),
|
||||
|
||||
type: 'DELETE'
|
||||
|
||||
}).then(function () {
|
||||
|
||||
getResolveFunction(resolve, id, true)();
|
||||
});
|
||||
|
||||
break;
|
||||
case 'removefromcollection':
|
||||
|
||||
apiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: apiClient.getUrl("Collections/" + options.collectionId + "/Items", {
|
||||
|
||||
Ids: [item.Id].join(',')
|
||||
})
|
||||
|
||||
}).then(function () {
|
||||
|
||||
getResolveFunction(resolve, id, true)();
|
||||
});
|
||||
|
||||
break;
|
||||
default:
|
||||
reject();
|
||||
break;
|
||||
|
@ -464,7 +513,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
|
|||
positionTo: options.positionTo
|
||||
|
||||
}).then(function (id) {
|
||||
executeCommand(options.item, id).then(resolve);
|
||||
executeCommand(options.item, id, options).then(resolve);
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -237,6 +237,10 @@ define(['datetime', 'globalize', 'embyRouter', 'material-icons', 'css!./mediainf
|
|||
miscInfo.push(item.Width + "x" + item.Height);
|
||||
}
|
||||
|
||||
if (item.Type == 'Audio' && item.Container) {
|
||||
miscInfo.push(item.Container);
|
||||
}
|
||||
|
||||
html += miscInfo.map(function (m) {
|
||||
return getMediaInfoItem(m);
|
||||
}).join('');
|
||||
|
|
|
@ -105,10 +105,12 @@
|
|||
"Shuffle": "Shuffle",
|
||||
"Identify": "Identify",
|
||||
"EditImages": "Edit Images",
|
||||
"EditInfo": "Edit Info",
|
||||
"Sync": "Sync",
|
||||
"InstantMix": "Instant Mix",
|
||||
"ViewAlbum": "View Album",
|
||||
"ViewArtist": "View Artist",
|
||||
"QueueAllFromHere": "Queue All from Here",
|
||||
"PlayAllFromHere": "Play All from Here"
|
||||
"PlayAllFromHere": "Play All from Here",
|
||||
"RemoveFromPlaylist": "Remove from Playlist"
|
||||
}
|
|
@ -881,11 +881,11 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
|
|||
font-size: 200%;
|
||||
}
|
||||
|
||||
.playedIndicator + .syncIndicator {
|
||||
.playedIndicator + .syncIndicator, .countIndicator + .syncIndicator {
|
||||
top: 32px;
|
||||
}
|
||||
|
||||
.card .playedIndicator {
|
||||
.card .playedIndicator, .card .countIndicator {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['layoutManager', 'datetime', 'mediaInfo', 'backdrop', 'listView', 'itemContextMenu', 'itemHelper', 'scrollStyles'], function (layoutManager, datetime, mediaInfo, backdrop, listView, itemContextMenu, itemHelper) {
|
||||
define(['layoutManager', 'datetime', 'mediaInfo', 'backdrop', 'listView', 'itemContextMenu', 'itemHelper', 'scrollStyles', 'emby-itemscontainer'], function (layoutManager, datetime, mediaInfo, backdrop, listView, itemContextMenu, itemHelper) {
|
||||
|
||||
var currentItem;
|
||||
|
||||
|
@ -1133,7 +1133,7 @@
|
|||
html += '<button class="btnAddToCollection autoSize" type="button" is="paper-icon-button-light" style="margin-left:1em;"><i class="md-icon" icon="add">add</i></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="detailSectionContent itemsContainer">';
|
||||
html += '<div is="emby-itemscontainer" class="detailSectionContent itemsContainer" data-collectionid="' + parentItem.Id + '">';
|
||||
|
||||
var shape = type.type == 'MusicAlbum' ? 'detailPageSquare' : 'detailPagePortrait';
|
||||
|
||||
|
@ -1166,26 +1166,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
function removeFromCollection(page, parentItem, itemIds) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var url = ApiClient.getUrl("Collections/" + parentItem.Id + "/Items", {
|
||||
|
||||
Ids: itemIds.join(',')
|
||||
});
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: url
|
||||
|
||||
}).then(function () {
|
||||
|
||||
renderChildren(page, parentItem);
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
function renderUserDataIcons(page, item) {
|
||||
|
||||
var userDataIcons = page.querySelectorAll('.userDataIcons');
|
||||
|
@ -2195,10 +2175,9 @@
|
|||
}
|
||||
});
|
||||
|
||||
view.querySelector('.collectionItems').addEventListener('removefromcollection', function (e) {
|
||||
view.querySelector('.collectionItems').addEventListener('needsrefresh', function (e) {
|
||||
|
||||
var itemId = e.detail.itemId;
|
||||
removeFromCollection(view, currentItem, [itemId]);
|
||||
renderChildren(view, currentItem);
|
||||
});
|
||||
|
||||
view.querySelector('.detailImageContainer').addEventListener('click', function (e) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['scrollHelper', 'viewManager', 'appSettings', 'appStorage', 'apphost', 'datetime', 'itemHelper', 'mediaInfo', 'scroller', 'scrollStyles'], function (scrollHelper, viewManager, appSettings, appStorage, appHost, datetime, itemHelper, mediaInfo, scroller) {
|
||||
define(['scrollHelper', 'viewManager', 'appSettings', 'appStorage', 'apphost', 'datetime', 'itemHelper', 'mediaInfo', 'scroller', 'indicators', 'scrollStyles'], function (scrollHelper, viewManager, appSettings, appStorage, appHost, datetime, itemHelper, mediaInfo, scroller, indicators) {
|
||||
|
||||
function parentWithClass(elem, className) {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
function fadeInRight(elem) {
|
||||
|
||||
var pct = browserInfo.mobile ? '2.5%' : '0.5%';
|
||||
var pct = browserInfo.mobile ? '3%' : '0.5%';
|
||||
|
||||
var keyframes = [
|
||||
{ opacity: '0', transform: 'translate3d(' + pct + ', 0, 0)', offset: 0 },
|
||||
|
@ -901,6 +901,16 @@
|
|||
value: item.Id
|
||||
});
|
||||
|
||||
atts.push({
|
||||
name: 'serverid',
|
||||
value: item.ServerId
|
||||
});
|
||||
|
||||
atts.push({
|
||||
name: 'id',
|
||||
value: item.Id
|
||||
});
|
||||
|
||||
if (options.context) {
|
||||
atts.push({
|
||||
name: 'context',
|
||||
|
@ -1553,7 +1563,7 @@
|
|||
html += LibraryBrowser.getOfflineIndicatorHtml(item);
|
||||
}
|
||||
} else if (options.showUnplayedIndicator !== false) {
|
||||
html += LibraryBrowser.getPlayedIndicatorHtml(item);
|
||||
html += indicators.getPlayedIndicatorHtml(item);
|
||||
} else if (options.showChildCountIndicator) {
|
||||
html += LibraryBrowser.getGroupCountIndicator(item);
|
||||
}
|
||||
|
@ -1597,7 +1607,7 @@
|
|||
html += '<div class="cardOverlayButtonContainer"><button is="paper-icon-button-light" class="cardOverlayPlayButton autoSize" onclick="return false;"><i class="md-icon">play_arrow</i></button></div>';
|
||||
}
|
||||
if (options.overlayMoreButton) {
|
||||
html += '<div class="cardOverlayButtonContainer"><button is="paper-icon-button-light" class="cardOverlayMoreButton autoSize" onclick="return false;"><i class="md-icon">' + AppInfo.moreIcon.replace('-', '_') + '</i></button></div>';
|
||||
html += '<div class="cardOverlayButtonContainer"><button is="paper-icon-button-light" class="cardOverlayMoreButton menuButton autoSize" onclick="return false;"><i class="md-icon">' + AppInfo.moreIcon.replace('-', '_') + '</i></button></div>';
|
||||
}
|
||||
|
||||
// cardScalable
|
||||
|
@ -1622,7 +1632,7 @@
|
|||
|
||||
if (options.cardLayout) {
|
||||
html += '<div class="cardButtonContainer">';
|
||||
html += '<button is="paper-icon-button-light" class="listviewMenuButton btnCardOptions autoSize"><i class="md-icon">' + AppInfo.moreIcon.replace('-', '_') + '</i></button>';
|
||||
html += '<button is="paper-icon-button-light" class="menuButton btnCardOptions autoSize"><i class="md-icon">' + AppInfo.moreIcon.replace('-', '_') + '</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
|
@ -1912,23 +1922,6 @@
|
|||
return '';
|
||||
},
|
||||
|
||||
getPlayedIndicatorHtml: function (item) {
|
||||
|
||||
if (item.Type == "Series" || item.Type == "Season" || item.Type == "BoxSet" || item.MediaType == "Video" || item.MediaType == "Game" || item.MediaType == "Book") {
|
||||
if (item.UserData.UnplayedItemCount) {
|
||||
return '<div class="playedIndicator">' + item.UserData.UnplayedItemCount + '</div>';
|
||||
}
|
||||
|
||||
if (item.Type != 'TvChannel') {
|
||||
if (item.UserData.PlayedPercentage && item.UserData.PlayedPercentage >= 100 || (item.UserData && item.UserData.Played)) {
|
||||
return '<div class="playedIndicator"><i class="md-icon">check</i></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
getGroupCountIndicator: function (item) {
|
||||
|
||||
if (item.ChildCount) {
|
||||
|
|
|
@ -336,22 +336,6 @@
|
|||
return onListViewPlayButtonClick(e, playButton);
|
||||
}
|
||||
|
||||
var listviewMenuButton = parentWithClass(e.target, 'listviewMenuButton') || parentWithClass(e.target, 'cardOverlayMoreButton');
|
||||
|
||||
if (listviewMenuButton) {
|
||||
showContextMenu(listviewMenuButton, {});
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
var button = parentWithClass(e.target, 'btnUserItemRating');
|
||||
if (button) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
var card = parentWithClass(e.target, 'card');
|
||||
|
||||
if (card) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
define(['appStorage'], function (appStorage) {
|
||||
|
||||
var currentDisplayInfo;
|
||||
var datetime;
|
||||
|
||||
function mirrorItem(info) {
|
||||
|
||||
var item = info.item;
|
||||
|
@ -614,6 +616,13 @@
|
|||
|
||||
self.canPlay = function (item) {
|
||||
|
||||
if (item.Type == "Program") {
|
||||
if (new Date().getTime() > datetime.parseISO8601Date(item.EndDate).getTime() || new Date().getTime() < datetime.parseISO8601Date(item.StartDate).getTime()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return self.canPlayByAttributes(item.Type, item.MediaType, item.PlayAccess, item.LocationType);
|
||||
};
|
||||
|
||||
|
@ -1052,6 +1061,10 @@
|
|||
MediaController.init = function () {
|
||||
|
||||
console.log('Beginning MediaController.init');
|
||||
require(['datetime'], function (datetimeInstance) {
|
||||
datetime = datetimeInstance;
|
||||
});
|
||||
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
}
|
||||
|
||||
var elem = page.querySelector('#childrenContent .itemsContainer');
|
||||
elem.setAttribute('data-playlistid', item.Id);
|
||||
elem.innerHTML = html;
|
||||
|
||||
var listParent = elem;
|
||||
|
@ -135,23 +136,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
function removeFromPlaylist(page, item, ids) {
|
||||
|
||||
ApiClient.ajax({
|
||||
|
||||
url: ApiClient.getUrl('Playlists/' + item.Id + '/Items', {
|
||||
EntryIds: ids.join(',')
|
||||
}),
|
||||
|
||||
type: 'DELETE'
|
||||
|
||||
}).then(function () {
|
||||
|
||||
reloadItems(page, item);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function showDragAndDropHelp() {
|
||||
|
||||
if (AppInfo.isTouchPreferred) {
|
||||
|
@ -176,12 +160,6 @@
|
|||
|
||||
var elem = page.querySelector('#childrenContent .itemsContainer');
|
||||
|
||||
elem.addEventListener('removefromplaylist', function (e) {
|
||||
|
||||
var playlistItemId = e.detail.playlistItemId;
|
||||
removeFromPlaylist(page, item, [playlistItemId]);
|
||||
});
|
||||
|
||||
elem.addEventListener('needsrefresh', function () {
|
||||
|
||||
reloadItems(page, item);
|
||||
|
|
|
@ -2032,6 +2032,9 @@ var AppInfo = {};
|
|||
},
|
||||
canQueueMediaType: function(mediaType) {
|
||||
return MediaController.canQueueMediaType(mediaType);
|
||||
},
|
||||
canPlay: function (item) {
|
||||
return MediaController.canPlay(item);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue