diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 3a8b625ce2..bd034d0a0f 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -15,12 +15,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.89", - "_release": "1.4.89", + "version": "1.4.90", + "_release": "1.4.90", "_resolution": { "type": "version", - "tag": "1.4.89", - "commit": "fb661d66f08795bad7137b9a193c7fd07d6ab9c8" + "tag": "1.4.90", + "commit": "36704279e05a90730af96c13b16c60ecc30cdce8" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-itemscontainer/emby-itemscontainer.js b/dashboard-ui/bower_components/emby-webcomponents/emby-itemscontainer/emby-itemscontainer.js index 1233c8ab6f..1c7b58158e 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-itemscontainer/emby-itemscontainer.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-itemscontainer/emby-itemscontainer.js @@ -33,6 +33,7 @@ button = parentWithAttribute(button, 'data-id'); var serverId = button.getAttribute('data-serverid'); var id = button.getAttribute('data-id'); + var type = button.getAttribute('data-type'); var apiClient = connectionManager.getApiClient(serverId); @@ -50,7 +51,8 @@ play: true, queue: true, playAllFromHere: !item.IsFolder, - queueAllFromHere: !item.IsFolder + queueAllFromHere: !item.IsFolder, + identify: false }).then(function(result) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js index 1138b8d43c..17d5561e83 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js @@ -1,7 +1,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', 'playbackManager'], function (appHost, globalize, connectionManager, itemHelper, embyRouter, playbackManager) { var isTheater = true; - appHost.appInfo().then(function(result) { + appHost.appInfo().then(function (result) { isTheater = result.appName.toLowerCase().indexOf('theater') != -1; }); @@ -85,10 +85,12 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } if (options.open !== false) { - commands.push({ - name: globalize.translate('sharedcomponents#Open'), - id: 'open' - }); + if (item.Type != 'Timer') { + commands.push({ + name: globalize.translate('sharedcomponents#Open'), + id: 'open' + }); + } } if (options.play !== false) { @@ -121,19 +123,31 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } } - if (user.Policy.IsAdministrator) { + if (item.Type == 'Program' && (!item.TimerId && !item.SeriesTimerId)) { commands.push({ - name: globalize.translate('sharedcomponents#Refresh'), - id: 'refresh' + name: Globalize.translate('sharedcomponents#Record'), + id: 'record' }); } - if (item.Type != 'Timer' && user.Policy.EnablePublicSharing && appHost.supports('sharing')) { - commands.push({ - name: globalize.translate('sharedcomponents#Share'), - id: 'share' - }); + if (user.Policy.IsAdministrator) { + + if (item.Type != 'Timer') { + commands.push({ + name: globalize.translate('sharedcomponents#Refresh'), + id: 'refresh' + }); + } + } + + if (options.share !== false) { + if (itemHelper.canShare(user, item)) { + commands.push({ + name: globalize.translate('sharedcomponents#Share'), + id: 'share' + }); + } } if (item.IsFolder || item.Type == "MusicArtist" || item.Type == "MusicGenre") { @@ -247,10 +261,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } case 'edit': { - require(['components/metadataeditor/metadataeditor'], function (metadataeditor) { - - metadataeditor.show(itemId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); - }); + editItem(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); break; } case 'editimages': @@ -283,28 +294,27 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } case 'play': { - playbackManager.play({ - items: [item] - }); + play(item, false); getResolveFunction(resolve, id)(); break; } case 'resume': { - playbackManager.play({ - items: [item] - }); + play(item, true); getResolveFunction(resolve, id)(); break; } case 'queue': { - playbackManager.queue({ - items: [item] - }); + play(item, false, true); getResolveFunction(resolve, id)(); break; } + case 'record': + require(['recordingCreator'], function (recordingCreator) { + recordingCreator.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); + }); + break; case 'shuffle': { playbackManager.shuffle(item); @@ -375,6 +385,40 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', }); } + function play(item, resume, queue) { + + var method = queue ? 'queue' : 'play'; + + if (item.Type == 'Program') { + playbackManager[method]({ + ids: [item.ChannelId] + }); + } else { + playbackManager[method]({ + items: [item] + }); + } + } + + function editItem(apiClient, item) { + + return new Promise(function (resolve, reject) { + + if (item.Type == 'Timer') { + require(['recordingEditor'], function (recordingEditor) { + + var serverId = apiClient.serverInfo().Id; + recordingEditor.show(item.Id, serverId).then(resolve, reject); + }); + } else { + require(['components/metadataeditor/metadataeditor'], function (metadataeditor) { + + metadataeditor.show(item.Id).then(resolve, reject); + }); + } + }); + } + function deleteItem(apiClient, itemId) { return new Promise(function (resolve, reject) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js b/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js index cfdef76a13..65bb913559 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js @@ -1,4 +1,4 @@ -define([], function () { +define(['apphost'], function (appHost) { function getDisplayName(item, options) { @@ -49,6 +49,11 @@ define([], function () { } function supportsAddingToCollection(item) { + + if (item.Type == 'Timer') { + return false; + } + var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'TvChannel', 'Program', 'MusicAlbum', 'Timer']; return !item.CollectionType && invalidTypes.indexOf(item.Type) == -1 && item.MediaType != 'Photo'; @@ -92,7 +97,7 @@ define([], function () { canEdit: function (user, itemType) { - if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView" || itemType == 'Timer') { + if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView") { return false; } @@ -111,6 +116,14 @@ define([], function () { } return item.SupportsSync; + }, + + canShare: function (user, item) { + + if (item.Type == 'Timer') { + return false; + } + return user.Policy.EnablePublicSharing && appHost.supports('sharing'); } }; }); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingeditor.js b/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingeditor.js index 4d9cbff24e..73ac37a8d5 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingeditor.js +++ b/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingeditor.js @@ -134,7 +134,10 @@ dlg.addEventListener('close', function () { if (recordingUpdated) { - resolve(); + resolve({ + updated: true, + deleted: false + }); } else { reject(); } diff --git a/dashboard-ui/components/metadataeditor/metadataeditor.js b/dashboard-ui/components/metadataeditor/metadataeditor.js index 846e24f192..3b9a5b0eaf 100644 --- a/dashboard-ui/components/metadataeditor/metadataeditor.js +++ b/dashboard-ui/components/metadataeditor/metadataeditor.js @@ -279,53 +279,25 @@ function showMoreMenu(context, button, user) { - var items = []; + require(['itemContextMenu'], function (itemContextMenu) { + itemContextMenu.show({ - items.push({ - name: Globalize.translate('ButtonEditImages'), - id: 'images' - }); - - if (itemHelper.canIdentify(user, currentItem.Type)) { - items.push({ - name: Globalize.translate('ButtonIdentify'), - id: 'identify' - }); - } - - items.push({ - name: Globalize.translate('ButtonRefresh'), - id: 'refresh' - }); - - require(['actionsheet'], function (actionsheet) { - - actionsheet.show({ - items: items, + item: currentItem, positionTo: button, - callback: function (id) { + edit: false, + sync: false, + share: false - switch (id) { + }).then(function (result) { - case 'identify': - LibraryBrowser.identifyItem(currentItem.Id).then(function () { - reload(context, currentItem.Id); - }); - break; - case 'refresh': - showRefreshMenu(context, button); - break; - case 'images': - LibraryBrowser.editImages(currentItem.Id); - break; - default: - break; - } + if (result.deleted) { + Emby.Page.goHome(); + + } else if (result.updated) { + reload(context, currentItem.Id); } }); - }); - } function onWebSocketMessageReceived(e, data) { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 8866692c55..42e0439af5 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -417,14 +417,6 @@ } }, - canShare: function (item, user) { - - if (item.Type == 'Timer') { - return false; - } - return user.Policy.EnablePublicSharing; - }, - getDateParamValue: function (date) { function formatDigit(i) { @@ -685,66 +677,6 @@ }); }, - getMoreCommands: function (item, user) { - - var commands = []; - - if (itemHelper.supportsAddingToCollection(item)) { - commands.push('addtocollection'); - } - - if (itemHelper.supportsAddingToPlaylist(item)) { - commands.push('playlist'); - } - - if (item.Type == 'BoxSet' || item.Type == 'Playlist') { - commands.push('delete'); - } - else if (item.CanDelete) { - commands.push('delete'); - } - - if (user.Policy.IsAdministrator) { - - if (itemHelper.canEdit(user, item.Type)) { - commands.push('edit'); - } - - if (item.MediaType == 'Video' && item.Type != 'TvChannel' && item.Type != 'Program' && item.LocationType != 'Virtual') { - commands.push('editsubtitles'); - } - - if (item.Type != 'Timer') { - commands.push('editimages'); - } - } - - if (user.Policy.IsAdministrator) { - - commands.push('refresh'); - } - - if (itemHelper.canSync(user, item)) { - commands.push('sync'); - } - - if (item.CanDownload) { - if (appHost.supports('filedownload')) { - commands.push('download'); - } - } - - if (LibraryBrowser.canShare(item, user)) { - commands.push('share'); - } - - if (itemHelper.canIdentify(user, item.Type)) { - commands.push('identify'); - } - - return commands; - }, - deleteItems: function (itemIds) { return new Promise(function (resolve, reject) { @@ -784,18 +716,6 @@ }); }, - editSubtitles: function (itemId) { - - return new Promise(function (resolve, reject) { - - require(['subtitleEditor'], function (subtitleEditor) { - - var serverId = ApiClient.serverInfo().Id; - subtitleEditor.show(itemId, serverId).then(resolve, reject); - }); - }); - }, - editMetadata: function (itemId) { require(['components/metadataeditor/metadataeditor'], function (metadataeditor) { @@ -804,203 +724,6 @@ }); }, - editTimer: function (id) { - - require(['recordingEditor'], function (recordingEditor) { - - var serverId = ApiClient.serverInfo().Id; - recordingEditor.show(id, serverId); - }); - }, - - showMoreCommands: function (positionTo, itemId, itemType, commands) { - - var items = []; - - if (commands.indexOf('addtocollection') != -1) { - items.push({ - name: Globalize.translate('ButtonAddToCollection'), - id: 'addtocollection', - ironIcon: 'add' - }); - } - - if (commands.indexOf('playlist') != -1) { - items.push({ - name: Globalize.translate('ButtonAddToPlaylist'), - id: 'playlist', - ironIcon: 'playlist-add' - }); - } - - if (commands.indexOf('delete') != -1) { - items.push({ - name: Globalize.translate('ButtonDelete'), - id: 'delete', - ironIcon: 'delete' - }); - } - - if (commands.indexOf('download') != -1) { - items.push({ - name: Globalize.translate('ButtonDownload'), - id: 'download', - ironIcon: 'file-download' - }); - } - - if (commands.indexOf('edit') != -1) { - items.push({ - name: Globalize.translate('ButtonEdit'), - id: 'edit', - ironIcon: 'mode-edit' - }); - } - - if (commands.indexOf('editimages') != -1) { - items.push({ - name: Globalize.translate('ButtonEditImages'), - id: 'editimages', - ironIcon: 'photo' - }); - } - - if (commands.indexOf('editsubtitles') != -1) { - items.push({ - name: Globalize.translate('ButtonEditSubtitles'), - id: 'editsubtitles', - ironIcon: 'closed-caption' - }); - } - - if (commands.indexOf('identify') != -1) { - items.push({ - name: Globalize.translate('ButtonIdentify'), - id: 'identify', - ironIcon: 'info' - }); - } - - if (commands.indexOf('refresh') != -1) { - items.push({ - name: Globalize.translate('ButtonRefresh'), - id: 'refresh', - ironIcon: 'refresh' - }); - } - - if (commands.indexOf('share') != -1) { - items.push({ - name: Globalize.translate('ButtonShare'), - id: 'share', - ironIcon: 'share' - }); - } - - return new Promise(function (resolve, reject) { - - var serverId = ApiClient.serverInfo().Id; - - require(['actionsheet'], function (actionsheet) { - - actionsheet.show({ - items: items, - positionTo: positionTo, - callback: function (id) { - - switch (id) { - - case 'share': - require(['sharingmanager'], function (sharingManager) { - sharingManager.showMenu({ - serverId: serverId, - itemId: itemId - }); - }); - break; - case 'addtocollection': - require(['collectionEditor'], function (collectionEditor) { - - new collectionEditor().show({ - items: [itemId], - serverId: serverId - }); - }); - break; - case 'playlist': - require(['playlistEditor'], function (playlistEditor) { - new playlistEditor().show({ - items: [itemId], - serverId: serverId - }); - }); - break; - case 'delete': - LibraryBrowser.deleteItems([itemId]); - break; - case 'download': - { - require(['fileDownloader'], function (fileDownloader) { - - var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", { - api_key: ApiClient.accessToken() - }); - - fileDownloader.download([ - { - url: downloadHref, - itemId: itemId, - serverId: serverId - }]); - }); - - break; - } - case 'edit': - if (itemType == 'Timer') { - LibraryBrowser.editTimer(itemId); - } else { - LibraryBrowser.editMetadata(itemId); - } - break; - case 'editsubtitles': - LibraryBrowser.editSubtitles(itemId).then(resolve, reject); - break; - case 'editimages': - LibraryBrowser.editImages(itemId).then(resolve, reject); - break; - case 'identify': - LibraryBrowser.identifyItem(itemId).then(resolve, reject); - break; - case 'refresh': - require(['refreshDialog'], function (refreshDialog) { - new refreshDialog({ - itemIds: [itemId], - serverId: serverId - }).show(); - }); - break; - default: - break; - } - } - }); - - }); - }); - }, - - identifyItem: function (itemId) { - - return new Promise(function (resolve, reject) { - - require(['components/itemidentifier/itemidentifier'], function (itemidentifier) { - - itemidentifier.show(itemId).then(resolve, reject); - }); - }); - }, - getHref: function (item, context, topParentId) { var href = LibraryBrowser.getHrefInternal(item, context); @@ -1173,16 +896,10 @@ var atts = []; - var itemCommands = LibraryBrowser.getItemCommands(item, options); - atts.push({ name: 'itemid', value: item.Id }); - atts.push({ - name: 'commands', - value: itemCommands.join(',') - }); if (options.context) { atts.push({ @@ -1217,28 +934,11 @@ }); } - atts.push({ - name: 'playaccess', - value: item.PlayAccess || '' - }); - - atts.push({ - name: 'locationtype', - value: item.LocationType || '' - }); - atts.push({ name: 'index', value: index }); - if (item.AlbumId) { - atts.push({ - name: 'albumid', - value: item.AlbumId - }); - } - if (item.ChannelId) { atts.push({ name: 'channelid', @@ -1246,13 +946,6 @@ }); } - if (item.ArtistItems && item.ArtistItems.length) { - atts.push({ - name: 'artistid', - value: item.ArtistItems[0].Id - }); - } - return atts; }, @@ -1271,76 +964,6 @@ return html; }, - getItemCommands: function (item, options) { - - var itemCommands = []; - - //if (MediaController.canPlay(item)) { - // itemCommands.push('playmenu'); - //} - - itemCommands.push('edit'); - - if (item.LocalTrailerCount) { - itemCommands.push('trailer'); - } - - if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "MusicGenre" || item.CollectionType == "music") { - itemCommands.push('instantmix'); - } - - if (item.IsFolder || item.Type == "MusicArtist" || item.Type == "MusicGenre") { - itemCommands.push('shuffle'); - } - - if (itemHelper.supportsAddingToPlaylist(item)) { - - if (options.showRemoveFromPlaylist) { - itemCommands.push('removefromplaylist'); - } else { - itemCommands.push('playlist'); - } - } - - if (options.showAddToCollection !== false) { - if (itemHelper.supportsAddingToCollection(item)) { - itemCommands.push('addtocollection'); - } - } - - if (options.showRemoveFromCollection) { - itemCommands.push('removefromcollection'); - } - - if (options.playFromHere) { - itemCommands.push('playfromhere'); - itemCommands.push('queuefromhere'); - } - - if (item.CanDelete) { - itemCommands.push('delete'); - } - - if (itemHelper.canSync({ Policy: {} }, item)) { - itemCommands.push('sync'); - } - - if (item.Type == 'Program' && (!item.TimerId && !item.SeriesTimerId)) { - - itemCommands.push('record'); - } - - if (item.MediaType == 'Video' && item.Type != 'TvChannel' && item.Type != 'Program' && item.LocationType != 'Virtual') { - itemCommands.push('editsubtitles'); - } - - if (item.Type != 'Timer') { - itemCommands.push('editimages'); - } - - return itemCommands; - }, - shapes: ['square', 'portrait', 'banner', 'smallBackdrop', 'homePageSmallBackdrop', 'backdrop', 'overflowBackdrop', 'overflowPortrait', 'overflowSquare'], getPostersPerRow: function (screenWidth) { diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 4b16f67c19..397e962415 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -67,7 +67,7 @@ }); } - function getOverlayHtml(item, currentUser, card, commands) { + function getOverlayHtml(item, currentUser, card) { var html = ''; @@ -153,7 +153,7 @@ buttonCount++; } - if (commands.indexOf('trailer') != -1) { + if (item.LocalTrailerCount) { html += ''; buttonCount++; } @@ -203,7 +203,12 @@ var card = parentWithClass(this, 'card'); showContextMenu(card, { - showPlayOptions: false + shuffle: false, + instantMix: false, + play: false, + playAllFromHere: false, + queue: false, + queueAllFromHere: false }); e.preventDefault(); @@ -261,404 +266,21 @@ } var itemId = card.getAttribute('data-itemid'); - var playlistItemId = card.getAttribute('data-playlistitemid'); - - var commands = card.getAttribute('data-commands').split(','); - var itemType = card.getAttribute('data-itemtype'); - var mediaType = card.getAttribute('data-mediatype'); - var playbackPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0'); - var playAccess = card.getAttribute('data-playaccess'); - var locationType = card.getAttribute('data-locationtype'); - var index = card.getAttribute('data-index'); - - var albumid = card.getAttribute('data-albumid'); - var artistid = card.getAttribute('data-artistid'); var serverId = ApiClient.serverInfo().Id; + var type = card.getAttribute('data-itemtype'); - Dashboard.getCurrentUser().then(function (user) { + var apiClient = ConnectionManager.getApiClient(serverId); - var items = []; + var promise = type == 'Timer' ? apiClient.getLiveTvTimer(itemId) : apiClient.getItem(apiClient.getCurrentUserId(), itemId); - if (commands.indexOf('addtocollection') != -1) { - items.push({ - name: Globalize.translate('ButtonAddToCollection'), - id: 'addtocollection', - ironIcon: 'add' - }); - } + promise.then(function (item) { - if (commands.indexOf('playlist') != -1) { - items.push({ - name: Globalize.translate('ButtonAddToPlaylist'), - id: 'playlist', - ironIcon: 'playlist-add' - }); - } - - if (user.Policy.EnableContentDownloading && appHost.supports('filedownload')) { - if (mediaType) { - items.push({ - name: Globalize.translate('ButtonDownload'), - id: 'download', - ironIcon: 'file-download' - }); - } - } - - if (commands.indexOf('delete') != -1) { - items.push({ - name: Globalize.translate('ButtonDelete'), - id: 'delete', - ironIcon: 'delete' - }); - } - - if (user.Policy.IsAdministrator) { - if (commands.indexOf('edit') != -1) { - items.push({ - name: Globalize.translate('ButtonEdit'), - id: 'edit', - ironIcon: 'mode-edit' - }); - } - - if (commands.indexOf('editimages') != -1) { - items.push({ - name: Globalize.translate('ButtonEditImages'), - id: 'editimages', - ironIcon: 'photo' - }); - } - - if (commands.indexOf('editsubtitles') != -1) { - items.push({ - name: Globalize.translate('ButtonEditSubtitles'), - id: 'editsubtitles', - ironIcon: 'closed-caption' - }); - } - } - - if (commands.indexOf('instantmix') != -1) { - items.push({ - name: Globalize.translate('ButtonInstantMix'), - id: 'instantmix', - ironIcon: 'shuffle' - }); - } - - if (itemType == 'Timer' && user.Policy.EnableLiveTvManagement) { - items.push({ - name: Globalize.translate('ButtonCancel'), - id: 'canceltimer', - ironIcon: 'cancel' - }); - } - - items.push({ - name: itemType == 'Timer' ? Globalize.translate('ButtonEdit') : Globalize.translate('ButtonOpen'), - id: 'open', - ironIcon: 'folder-open' - }); - - if (options.showPlayOptions !== false) { - - if (MediaController.canPlayByAttributes(itemType, mediaType, playAccess, locationType)) { - items.push({ - name: Globalize.translate('ButtonPlay'), - id: 'play', - ironIcon: 'play-arrow' - }); - - if (commands.indexOf('playfromhere') != -1) { - items.push({ - name: Globalize.translate('ButtonPlayAllFromHere'), - id: 'playallfromhere', - ironIcon: 'play-arrow' - }); - } - } - - if (mediaType == 'Video' && AppInfo.supportsExternalPlayers && appSettings.enableExternalPlayers()) { - items.push({ - name: Globalize.translate('ButtonPlayExternalPlayer'), - id: 'externalplayer', - ironIcon: 'airplay' - }); - } - - if (playbackPositionTicks && mediaType != "Audio") { - items.push({ - name: Globalize.translate('ButtonResume'), - id: 'resume', - ironIcon: 'play-arrow' - }); - } - - if (commands.indexOf('trailer') != -1) { - items.push({ - name: Globalize.translate('ButtonPlayTrailer'), - id: 'trailer', - ironIcon: 'play-arrow' - }); - } - } - - if (MediaController.canQueueMediaType(mediaType, itemType)) { - items.push({ - name: Globalize.translate('ButtonQueue'), - id: 'queue', - ironIcon: 'playlist-add' - }); - - if (commands.indexOf('queuefromhere') != -1) { - items.push({ - name: Globalize.translate('ButtonQueueAllFromHere'), - id: 'queueallfromhere', - ironIcon: 'playlist-add' - }); - } - } - - if (commands.indexOf('shuffle') != -1) { - items.push({ - name: Globalize.translate('ButtonShuffle'), - id: 'shuffle', - ironIcon: 'shuffle' - }); - } - - if (commands.indexOf('record') != -1) { - items.push({ - name: Globalize.translate('ButtonRecord'), - id: 'record', - ironIcon: 'videocam' - }); - } - - if (commands.indexOf('removefromcollection') != -1) { - items.push({ - name: Globalize.translate('ButtonRemoveFromCollection'), - id: 'removefromcollection', - ironIcon: 'remove' - }); - } - - if (commands.indexOf('removefromplaylist') != -1) { - items.push({ - name: Globalize.translate('ButtonRemoveFromPlaylist'), - id: 'removefromplaylist', - ironIcon: 'remove' - }); - } - - if (user.Policy.EnablePublicSharing && commands.indexOf('share') != -1) { - items.push({ - name: Globalize.translate('ButtonShare'), - id: 'share', - ironIcon: 'share' - }); - } - - if (commands.indexOf('sync') != -1) { - items.push({ - name: Globalize.translate('ButtonSync'), - id: 'sync', - ironIcon: 'sync' - }); - } - - if (albumid) { - items.push({ - name: Globalize.translate('ButtonViewAlbum'), - id: 'album', - ironIcon: 'album' - }); - } - - if (artistid) { - items.push({ - name: Globalize.translate('ButtonViewArtist'), - id: 'artist', - ironIcon: 'person' - }); - } - - var href = card.getAttribute('data-href') || card.href; - - if (!href) { - var links = card.getElementsByTagName('a'); - if (links.length) { - href = links[0].href; - } - } - - require(['actionsheet'], function (actionsheet) { - - actionsheet.show({ - items: items, - positionTo: displayContextItem, - callback: function (id) { - - switch (id) { - - case 'addtocollection': - require(['collectionEditor'], function (collectionEditor) { - - new collectionEditor().show({ - items: [itemId], - serverId: serverId - }); - }); - break; - case 'playlist': - require(['playlistEditor'], function (playlistEditor) { - new playlistEditor().show({ - items: [itemId], - serverId: serverId - }); - }); - break; - case 'delete': - LibraryBrowser.deleteItems([itemId]); - break; - case 'download': - { - require(['fileDownloader'], function (fileDownloader) { - var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", { - api_key: ApiClient.accessToken() - }); - - fileDownloader.download([ - { - url: downloadHref, - itemId: itemId, - serverId: serverId - }]); - }); - - break; - } - case 'edit': - if (itemType == 'Timer') { - LibraryBrowser.editTimer(itemId); - } else { - LibraryBrowser.editMetadata(itemId); - } - break; - case 'refresh': - require(['refreshDialog'], function (refreshDialog) { - new refreshDialog({ - itemIds: [itemId], - serverId: serverId - }).show(); - }); - break; - case 'instantmix': - MediaController.instantMix(itemId); - break; - case 'shuffle': - MediaController.shuffle(itemId); - break; - case 'open': - if (itemType == 'Timer') { - LibraryBrowser.editTimer(itemId); - } else { - Dashboard.navigate(href); - } - break; - case 'album': - Dashboard.navigate('itemdetails.html?id=' + albumid); - break; - case 'record': - require(['recordingCreator'], function (recordingCreator) { - recordingCreator.show(itemId, serverId); - }); - break; - case 'artist': - Dashboard.navigate('itemdetails.html?context=music&id=' + artistid); - break; - case 'play': - MediaController.play(itemId); - break; - case 'playallfromhere': - playAllFromHere(index, parentWithClass(card, 'itemsContainer'), 'play'); - break; - case 'queue': - MediaController.queue(itemId); - break; - case 'trailer': - ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), itemId).then(function (trailers) { - MediaController.play({ items: trailers }); - }); - break; - case 'resume': - MediaController.play({ - ids: [itemId], - startPositionTicks: playbackPositionTicks - }); - break; - case 'queueallfromhere': - playAllFromHere(index, parentWithClass(card, 'itemsContainer'), 'queue'); - break; - case 'sync': - require(['syncDialog'], function (syncDialog) { - syncDialog.showMenu({ - items: [ - { - Id: itemId - }] - }); - }); - break; - case 'editsubtitles': - LibraryBrowser.editSubtitles(itemId); - break; - case 'editimages': - LibraryBrowser.editImages(itemId); - break; - case 'externalplayer': - LibraryBrowser.playInExternalPlayer(itemId); - break; - case 'canceltimer': - deleteTimer(itemId, parentWithClass(card, 'itemsContainer')); - break; - case 'share': - require(['sharingmanager'], function (sharingManager) { - sharingManager.showMenu({ - serverId: serverId, - itemId: itemId - }); - }); - break; - case 'removefromplaylist': - var itemsContainer = parentWithClass(card, 'itemsContainer'); - if (itemsContainer) { - itemsContainer.dispatchEvent(new CustomEvent('removefromplaylist', { - detail: { - playlistItemId: playlistItemId - }, - cancelable: false - })); - } - break; - case 'removefromcollection': - var itemsContainer = parentWithClass(card, 'collectionItems'); - if (itemsContainer) { - itemsContainer.dispatchEvent(new CustomEvent('removefromcollection', { - detail: { - itemId: itemId - }, - cancelable: false - })); - } - break; - default: - break; - } - } - }); + require(['itemContextMenu'], function (itemContextMenu) { + itemContextMenu.show(Object.assign(options || {}, { + item: item, + positionTo: displayContextItem + })); }); }); } @@ -845,7 +467,11 @@ } var id = dataElement.getAttribute('data-itemid'); - var commands = dataElement.getAttribute('data-commands').split(','); + var type = dataElement.getAttribute('data-itemtype'); + + if (type == 'Timer') { + return; + } var promise1 = ApiClient.getItem(Dashboard.getCurrentUserId(), id); var promise2 = Dashboard.getCurrentUser(); @@ -861,7 +487,7 @@ card = card.parentNode; } - innerElem.innerHTML = getOverlayHtml(item, user, card, commands); + innerElem.innerHTML = getOverlayHtml(item, user, card); var btnPlayItem = innerElem.querySelector('.btnPlayItem'); if (btnPlayItem) { @@ -1416,15 +1042,6 @@ MediaController.instantMix(itemId); } - else if (action == 'edit') { - - var itemType = elemWithAttributes.getAttribute('data-itemtype'); - if (itemType == 'Timer') { - LibraryBrowser.editTimer(itemId); - } else { - LibraryBrowser.editMetadata(itemId); - } - } e.stopPropagation(); e.preventDefault(); diff --git a/dashboard-ui/scripts/livetvcomponents.js b/dashboard-ui/scripts/livetvcomponents.js index da8ebf2720..593e772b30 100644 --- a/dashboard-ui/scripts/livetvcomponents.js +++ b/dashboard-ui/scripts/livetvcomponents.js @@ -76,9 +76,9 @@ } if (enableScrollX()) { - html += '