change to double quotes

This commit is contained in:
grafixeyehero 2019-10-15 21:13:33 +03:00
parent 6bf18d80e0
commit b16534ba0a

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