Merge pull request #523 from grafixeyehero/itemcontextmenu-icon

Add icon on item context menu
This commit is contained in:
Vasily 2019-10-16 12:30:26 +03:00 committed by GitHub
commit d4862df266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter', 'playbackManager', 'loading', 'appSettings', 'browser', 'actionsheet'], function (appHost, globalize, connectionManager, itemHelper, appRouter, playbackManager, loading, appSettings, browser, actionsheet) { define(["apphost", "globalize", "connectionManager", "itemHelper", "appRouter", "playbackManager", "loading", "appSettings", "browser", "actionsheet"], function (appHost, globalize, connectionManager, itemHelper, appRouter, playbackManager, loading, appSettings, browser, actionsheet) {
'use strict'; "use strict";
function getCommands(options) { function getCommands(options) {
var item = options.item; var item = options.item;
@ -9,18 +9,20 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
var user = options.user; var user = options.user;
var commands = []; var commands = [];
if (canPlay && item.MediaType !== 'Photo') { if (canPlay && item.MediaType !== "Photo") {
if (options.play !== false) { if (options.play !== false) {
commands.push({ commands.push({
name: globalize.translate('Play'), name: globalize.translate("Play"),
id: 'resume' id: "resume",
icon: "play_arrow"
}); });
} }
if (options.playAllFromHere && item.Type !== 'Program' && item.Type !== 'TvChannel') { if (options.playAllFromHere && item.Type !== "Program" && item.Type !== "TvChannel") {
commands.push({ commands.push({
name: globalize.translate('PlayAllFromHere'), name: globalize.translate("PlayAllFromHere"),
id: 'playallfromhere' id: "playallfromhere",
icon: "play_arrow"
}); });
} }
} }
@ -28,22 +30,24 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (playbackManager.canQueue(item)) { if (playbackManager.canQueue(item)) {
if (options.queue !== false) { if (options.queue !== false) {
commands.push({ commands.push({
name: globalize.translate('AddToPlayQueue'), name: globalize.translate("AddToPlayQueue"),
id: 'queue' id: "queue",
icon: "playlist_add"
}); });
} }
if (options.queue !== false) { if (options.queue !== false) {
commands.push({ commands.push({
name: globalize.translate('PlayNext'), name: globalize.translate("PlayNext"),
id: 'queuenext' id: "queuenext",
icon: "playlist_add"
}); });
} }
//if (options.queueAllFromHere) { //if (options.queueAllFromHere) {
// commands.push({ // commands.push({
// name: globalize.translate('QueueAllFromHere'), // name: globalize.translate("QueueAllFromHere"),
// id: 'queueallfromhere' // id: "queueallfromhere"
// }); // });
//} //}
} }
@ -51,11 +55,12 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (item.IsFolder || item.Type === "MusicArtist" || item.Type === "MusicGenre") { if (item.IsFolder || item.Type === "MusicArtist" || item.Type === "MusicGenre") {
if (item.CollectionType !== 'livetv') { if (item.CollectionType !== "livetv") {
if (options.shuffle !== false) { if (options.shuffle !== false) {
commands.push({ commands.push({
name: globalize.translate('Shuffle'), name: globalize.translate("Shuffle"),
id: 'shuffle' id: "shuffle",
icon: "shuffle"
}); });
} }
} }
@ -64,8 +69,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (item.MediaType === "Audio" || item.Type === "MusicAlbum" || item.Type === "MusicArtist" || item.Type === "MusicGenre") { if (item.MediaType === "Audio" || item.Type === "MusicAlbum" || item.Type === "MusicArtist" || item.Type === "MusicGenre") {
if (options.instantMix !== false && !itemHelper.isLocalItem(item)) { if (options.instantMix !== false && !itemHelper.isLocalItem(item)) {
commands.push({ commands.push({
name: globalize.translate('InstantMix'), name: globalize.translate("InstantMix"),
id: 'instantmix' id: "instantmix",
icon: "shuffle"
}); });
} }
} }
@ -79,75 +85,91 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (!restrictOptions) { if (!restrictOptions) {
if (itemHelper.supportsAddingToCollection(item)) { if (itemHelper.supportsAddingToCollection(item)) {
commands.push({ commands.push({
name: globalize.translate('AddToCollection'), name: globalize.translate("AddToCollection"),
id: 'addtocollection' id: "addtocollection",
icon: "playlist_add"
}); });
} }
if (itemHelper.supportsAddingToPlaylist(item)) { if (itemHelper.supportsAddingToPlaylist(item)) {
commands.push({ commands.push({
name: globalize.translate('AddToPlaylist'), name: globalize.translate("AddToPlaylist"),
id: 'addtoplaylist' id: "addtoplaylist",
icon: "playlist_add"
}); });
} }
} }
if ((item.Type === 'Timer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) { if ((item.Type === "Timer") && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) {
commands.push({ commands.push({
name: globalize.translate('CancelRecording'), name: globalize.translate("CancelRecording"),
id: 'canceltimer' id: "canceltimer",
icon: "cancel"
}); });
} }
if ((item.Type === 'Recording' && item.Status === 'InProgress') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) { if ((item.Type === "Recording" && item.Status === "InProgress") && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) {
commands.push({ commands.push({
name: globalize.translate('CancelRecording'), name: globalize.translate("CancelRecording"),
id: 'canceltimer' id: "canceltimer",
icon: "cancel"
}); });
} }
if ((item.Type === 'SeriesTimer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) { if ((item.Type === "SeriesTimer") && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) {
commands.push({ commands.push({
name: globalize.translate('CancelSeries'), name: globalize.translate("CancelSeries"),
id: 'cancelseriestimer' id: "cancelseriestimer",
icon: "cancel"
}); });
} }
if (item.CanDelete && options.deleteItem !== false) { if (item.CanDelete && options.deleteItem !== false) {
if (item.Type === 'Playlist' || item.Type === 'BoxSet') { if (item.Type === "Playlist" || item.Type === "BoxSet") {
commands.push({ commands.push({
name: globalize.translate('Delete'), name: globalize.translate("Delete"),
id: 'delete' id: "delete",
icon: "delete"
}); });
} else { } else {
commands.push({ commands.push({
name: globalize.translate('DeleteMedia'), name: globalize.translate("DeleteMedia"),
id: 'delete' id: "delete",
icon: "delete"
}); });
} }
} }
// Books are promoted to major download Button and therefor excluded in the context menu // Books are promoted to major download Button and therefor excluded in the context menu
if ((item.CanDownload && appHost.supports('filedownload')) && item.Type !== "Book") { if ((item.CanDownload && appHost.supports("filedownload")) && item.Type !== "Book") {
commands.push({ commands.push({
name: globalize.translate('Download'), name: globalize.translate("Download"),
id: 'download' id: "download",
icon: "file_download"
}); });
commands.push({ commands.push({
name: globalize.translate('CopyStreamURL'), name: globalize.translate("CopyStreamURL"),
id: 'copy-stream' id: "copy-stream",
icon: "content_copy"
});
}
if (commands.length) {
commands.push({
divider: true
}); });
} }
var canEdit = itemHelper.canEdit(user, item); var canEdit = itemHelper.canEdit(user, item);
if (canEdit) { if (canEdit) {
if (options.edit !== false && item.Type !== 'SeriesTimer') { if (options.edit !== false && item.Type !== "SeriesTimer") {
var text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata'); var text = (item.Type === "Timer" || item.Type === "SeriesTimer") ? globalize.translate("Edit") : globalize.translate("EditMetadata");
commands.push({ commands.push({
name: text, name: text,
id: 'edit' id: "edit",
icon: "edit"
}); });
} }
} }
@ -155,18 +177,20 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (itemHelper.canEditImages(user, item)) { if (itemHelper.canEditImages(user, item)) {
if (options.editImages !== false) { if (options.editImages !== false) {
commands.push({ commands.push({
name: globalize.translate('EditImages'), name: globalize.translate("EditImages"),
id: 'editimages' id: "editimages",
icon: "edit"
}); });
} }
} }
if (canEdit) { if (canEdit) {
if (item.MediaType === 'Video' && item.Type !== 'TvChannel' && item.Type !== 'Program' && item.LocationType !== 'Virtual' && !(item.Type === 'Recording' && item.Status !== 'Completed')) { if (item.MediaType === "Video" && item.Type !== "TvChannel" && item.Type !== "Program" && item.LocationType !== "Virtual" && !(item.Type === "Recording" && item.Status !== "Completed")) {
if (options.editSubtitles !== false) { if (options.editSubtitles !== false) {
commands.push({ commands.push({
name: globalize.translate('EditSubtitles'), name: globalize.translate("EditSubtitles"),
id: 'editsubtitles' id: "editsubtitles",
icon: "closed_caption"
}); });
} }
} }
@ -175,8 +199,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (options.identify !== false) { if (options.identify !== false) {
if (itemHelper.canIdentify(user, item)) { if (itemHelper.canIdentify(user, item)) {
commands.push({ commands.push({
name: globalize.translate('Identify'), name: globalize.translate("Identify"),
id: 'identify' id: "identify",
icon: "edit"
}); });
} }
} }
@ -184,48 +209,54 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (item.MediaSources) { if (item.MediaSources) {
if (options.moremediainfo !== false) { if (options.moremediainfo !== false) {
commands.push({ commands.push({
name: globalize.translate('MoreMediaInfo'), name: globalize.translate("MoreMediaInfo"),
id: 'moremediainfo' id: "moremediainfo",
icon: "info"
}); });
} }
} }
if (item.Type === 'Program' && options.record !== false) { if (item.Type === "Program" && options.record !== false) {
if (item.TimerId) { if (item.TimerId) {
commands.push({ commands.push({
name: Globalize.translate('ManageRecording'), name: Globalize.translate("ManageRecording"),
id: 'record' id: "record",
icon: "fiber_manual_record"
}); });
} }
} }
if (item.Type === 'Program' && options.record !== false) { if (item.Type === "Program" && options.record !== false) {
if (!item.TimerId) { if (!item.TimerId) {
commands.push({ commands.push({
name: Globalize.translate('Record'), name: Globalize.translate("Record"),
id: 'record' id: "record",
icon: "fiber_manual_record"
}); });
} }
} }
if (itemHelper.canRefreshMetadata(item, user)) { if (itemHelper.canRefreshMetadata(item, user)) {
commands.push({ commands.push({
name: globalize.translate('RefreshMetadata'), name: globalize.translate("RefreshMetadata"),
id: 'refresh' id: "refresh",
icon: "refresh"
}); });
} }
if (item.PlaylistItemId && options.playlistId) { if (item.PlaylistItemId && options.playlistId) {
commands.push({ commands.push({
name: globalize.translate('RemoveFromPlaylist'), name: globalize.translate("RemoveFromPlaylist"),
id: 'removefromplaylist' id: "removefromplaylist",
icon: "remove"
}); });
} }
if (options.collectionId) { if (options.collectionId) {
commands.push({ commands.push({
name: globalize.translate('RemoveFromCollection'), name: globalize.translate("RemoveFromCollection"),
id: 'removefromcollection' id: "removefromcollection",
icon: "remove"
}); });
} }
@ -233,8 +264,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (options.share === true) { if (options.share === true) {
if (itemHelper.canShare(item, user)) { if (itemHelper.canShare(item, user)) {
commands.push({ commands.push({
name: globalize.translate('Share'), name: globalize.translate("Share"),
id: 'share' id: "share",
icon: "share"
}); });
} }
} }
@ -243,23 +275,26 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
if (options.sync !== false) { if (options.sync !== false) {
if (itemHelper.canSync(user, item)) { if (itemHelper.canSync(user, item)) {
commands.push({ commands.push({
name: globalize.translate('Sync'), name: globalize.translate("Sync"),
id: 'sync' id: "sync",
icon: "sync"
}); });
} }
} }
if (options.openAlbum !== false && item.AlbumId && item.MediaType !== 'Photo') { if (options.openAlbum !== false && item.AlbumId && item.MediaType !== "Photo") {
commands.push({ commands.push({
name: Globalize.translate('ViewAlbum'), name: Globalize.translate("ViewAlbum"),
id: 'album' id: "album",
icon: "album"
}); });
} }
if (options.openArtist !== false && item.ArtistItems && item.ArtistItems.length) { if (options.openArtist !== false && item.ArtistItems && item.ArtistItems.length) {
commands.push({ commands.push({
name: Globalize.translate('ViewArtist'), name: Globalize.translate("ViewArtist"),
id: 'artist' id: "artist",
icon: "person"
}); });
} }
@ -283,24 +318,24 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
switch (id) { switch (id) {
case 'addtocollection': case "addtocollection":
require(['collectionEditor'], function (collectionEditor) { require(["collectionEditor"], function (collectionEditor) {
new collectionEditor().show({ new collectionEditor().show({
items: [itemId], items: [itemId],
serverId: serverId serverId: serverId
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); }).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'addtoplaylist': case "addtoplaylist":
require(['playlistEditor'], function (playlistEditor) { require(["playlistEditor"], function (playlistEditor) {
new playlistEditor().show({ new playlistEditor().show({
items: [itemId], items: [itemId],
serverId: serverId serverId: serverId
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); }).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'download': case "download":
require(['fileDownloader'], function (fileDownloader) { require(["fileDownloader"], function (fileDownloader) {
var downloadHref = apiClient.getItemDownloadUrl(itemId); var downloadHref = apiClient.getItemDownloadUrl(itemId);
fileDownloader.download([{ fileDownloader.download([{
url: downloadHref, url: downloadHref,
@ -310,7 +345,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
getResolveFunction(getResolveFunction(resolve, id), id)(); getResolveFunction(getResolveFunction(resolve, id), id)();
}); });
break; break;
case 'copy-stream': case "copy-stream":
var downloadHref = apiClient.getItemDownloadUrl(itemId); var downloadHref = apiClient.getItemDownloadUrl(itemId);
var textArea = document.createElement("textarea"); var textArea = document.createElement("textarea");
textArea.value = downloadHref; textArea.value = downloadHref;
@ -318,10 +353,10 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
textArea.focus(); textArea.focus();
textArea.select(); textArea.select();
try { try {
document.execCommand('copy'); document.execCommand("copy");
require(['toast'], function (toast) { require(["toast"], function (toast) {
toast(globalize.translate('CopyStreamURLSuccess')); toast(globalize.translate("CopyStreamURLSuccess"));
}); });
} catch (err) { } catch (err) {
console.error("Failed to copy to clipboard"); console.error("Failed to copy to clipboard");
@ -330,118 +365,118 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
document.body.removeChild(textArea); document.body.removeChild(textArea);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'editsubtitles': case "editsubtitles":
require(['subtitleEditor'], function (subtitleEditor) { require(["subtitleEditor"], function (subtitleEditor) {
subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'edit': case "edit":
editItem(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); editItem(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
break; break;
case 'editimages': case "editimages":
require(['imageEditor'], function (imageEditor) { require(["imageEditor"], function (imageEditor) {
imageEditor.show({ imageEditor.show({
itemId: itemId, itemId: itemId,
serverId: serverId serverId: serverId
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); }).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'identify': case "identify":
require(['itemIdentifier'], function (itemIdentifier) { require(["itemIdentifier"], function (itemIdentifier) {
itemIdentifier.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); itemIdentifier.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'moremediainfo': case "moremediainfo":
require(['itemMediaInfo'], function (itemMediaInfo) { require(["itemMediaInfo"], function (itemMediaInfo) {
itemMediaInfo.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); itemMediaInfo.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'refresh': case "refresh":
refresh(apiClient, item); refresh(apiClient, item);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'open': case "open":
appRouter.showItem(item); appRouter.showItem(item);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'play': case "play":
play(item, false); play(item, false);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'resume': case "resume":
play(item, true); play(item, true);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'queue': case "queue":
play(item, false, true); play(item, false, true);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'queuenext': case "queuenext":
play(item, false, true, true); play(item, false, true, true);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'record': case "record":
require(['recordingCreator'], function (recordingCreator) { require(["recordingCreator"], function (recordingCreator) {
recordingCreator.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); recordingCreator.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
}); });
break; break;
case 'shuffle': case "shuffle":
playbackManager.shuffle(item); playbackManager.shuffle(item);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'instantmix': case "instantmix":
playbackManager.instantMix(item); playbackManager.instantMix(item);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'delete': case "delete":
deleteItem(apiClient, item).then(getResolveFunction(resolve, id, true, true), getResolveFunction(resolve, id)); deleteItem(apiClient, item).then(getResolveFunction(resolve, id, true, true), getResolveFunction(resolve, id));
break; break;
case 'share': case "share":
navigator.share({ navigator.share({
title: item.Name, title: item.Name,
text: item.Overview, text: item.Overview,
url: "https://github.com/jellyfin/jellyfin" url: "https://github.com/jellyfin/jellyfin"
}); });
break; break;
case 'album': case "album":
appRouter.showItem(item.AlbumId, item.ServerId); appRouter.showItem(item.AlbumId, item.ServerId);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'artist': case "artist":
appRouter.showItem(item.ArtistItems[0].Id, item.ServerId); appRouter.showItem(item.ArtistItems[0].Id, item.ServerId);
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'playallfromhere': case "playallfromhere":
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'queueallfromhere': case "queueallfromhere":
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();
break; break;
case 'removefromplaylist': case "removefromplaylist":
apiClient.ajax({ apiClient.ajax({
url: apiClient.getUrl('Playlists/' + options.playlistId + '/Items', { url: apiClient.getUrl("Playlists/" + options.playlistId + "/Items", {
EntryIds: [item.PlaylistItemId].join(',') EntryIds: [item.PlaylistItemId].join(",")
}), }),
type: 'DELETE' type: "DELETE"
}).then(function () { }).then(function () {
getResolveFunction(resolve, id, true)(); getResolveFunction(resolve, id, true)();
}); });
break; break;
case 'removefromcollection': case "removefromcollection":
apiClient.ajax({ apiClient.ajax({
type: "DELETE", type: "DELETE",
url: apiClient.getUrl("Collections/" + options.collectionId + "/Items", { url: apiClient.getUrl("Collections/" + options.collectionId + "/Items", {
Ids: [item.Id].join(',') Ids: [item.Id].join(",")
}) })
}).then(function () { }).then(function () {
getResolveFunction(resolve, id, true)(); getResolveFunction(resolve, id, true)();
}); });
break; break;
case 'canceltimer': case "canceltimer":
deleteTimer(apiClient, item, resolve, id); deleteTimer(apiClient, item, resolve, id);
break; break;
case 'cancelseriestimer': case "cancelseriestimer":
deleteSeriesTimer(apiClient, item, resolve, id); deleteSeriesTimer(apiClient, item, resolve, id);
break; break;
default: default:
@ -452,7 +487,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
} }
function deleteTimer(apiClient, item, resolve, command) { function deleteTimer(apiClient, item, resolve, command) {
require(['recordingHelper'], function (recordingHelper) { require(["recordingHelper"], function (recordingHelper) {
var timerId = item.TimerId || item.Id; var timerId = item.TimerId || item.Id;
recordingHelper.cancelTimerWithConfirmation(timerId, item.ServerId).then(function () { recordingHelper.cancelTimerWithConfirmation(timerId, item.ServerId).then(function () {
getResolveFunction(resolve, command, true)(); getResolveFunction(resolve, command, true)();
@ -461,7 +496,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
} }
function deleteSeriesTimer(apiClient, item, resolve, command) { function deleteSeriesTimer(apiClient, item, resolve, command) {
require(['recordingHelper'], function (recordingHelper) { require(["recordingHelper"], function (recordingHelper) {
recordingHelper.cancelSeriesTimerWithConfirmation(item.Id, item.ServerId).then(function () { recordingHelper.cancelSeriesTimerWithConfirmation(item.Id, item.ServerId).then(function () {
getResolveFunction(resolve, command, true)(); getResolveFunction(resolve, command, true)();
}); });
@ -469,14 +504,14 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
} }
function play(item, resume, queue, queueNext) { function play(item, resume, queue, queueNext) {
var method = queue ? (queueNext ? 'queueNext' : 'queue') : 'play'; var method = queue ? (queueNext ? "queueNext" : "queue") : "play";
var startPosition = 0; var startPosition = 0;
if (resume && item.UserData && item.UserData.PlaybackPositionTicks) { if (resume && item.UserData && item.UserData.PlaybackPositionTicks) {
startPosition = item.UserData.PlaybackPositionTicks; startPosition = item.UserData.PlaybackPositionTicks;
} }
if (item.Type === 'Program') { if (item.Type === "Program") {
playbackManager[method]({ playbackManager[method]({
ids: [item.ChannelId], ids: [item.ChannelId],
startPositionTicks: startPosition, startPositionTicks: startPosition,
@ -494,16 +529,16 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var serverId = apiClient.serverInfo().Id; var serverId = apiClient.serverInfo().Id;
if (item.Type === 'Timer') { if (item.Type === "Timer") {
require(['recordingEditor'], function (recordingEditor) { require(["recordingEditor"], function (recordingEditor) {
recordingEditor.show(item.Id, serverId).then(resolve, reject); recordingEditor.show(item.Id, serverId).then(resolve, reject);
}); });
} else if (item.Type === 'SeriesTimer') { } else if (item.Type === "SeriesTimer") {
require(['seriesRecordingEditor'], function (recordingEditor) { require(["seriesRecordingEditor"], function (recordingEditor) {
recordingEditor.show(item.Id, serverId).then(resolve, reject); recordingEditor.show(item.Id, serverId).then(resolve, reject);
}); });
} else { } else {
require(['metadataEditor'], function (metadataEditor) { require(["metadataEditor"], function (metadataEditor) {
metadataEditor.show(item.Id, serverId).then(resolve, reject); metadataEditor.show(item.Id, serverId).then(resolve, reject);
}); });
} }
@ -512,7 +547,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
function deleteItem(apiClient, item) { function deleteItem(apiClient, item) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
require(['deleteHelper'], function (deleteHelper) { require(["deleteHelper"], function (deleteHelper) {
deleteHelper.deleteItem({ deleteHelper.deleteItem({
item: item, item: item,
navigate: false navigate: false
@ -524,11 +559,11 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
} }
function refresh(apiClient, item) { function refresh(apiClient, item) {
require(['refreshDialog'], function (refreshDialog) { require(["refreshDialog"], function (refreshDialog) {
new refreshDialog({ new refreshDialog({
itemIds: [item.Id], itemIds: [item.Id],
serverId: apiClient.serverInfo().Id, serverId: apiClient.serverInfo().Id,
mode: item.Type === 'CollectionFolder' ? 'scan' : null mode: item.Type === "CollectionFolder" ? "scan" : null
}).show(); }).show();
}); });
} }
@ -542,7 +577,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
return actionsheet.show({ return actionsheet.show({
items: commands, items: commands,
positionTo: options.positionTo, positionTo: options.positionTo,
resolveOnClick: ['share'] resolveOnClick: ["share"]
}).then(function (id) { }).then(function (id) {
return executeCommand(options.item, id, options); return executeCommand(options.item, id, options);
}); });