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

update components

This commit is contained in:
Luke Pulverenti 2016-10-18 01:06:48 -04:00
parent 138611efb5
commit 11615f4399
72 changed files with 829 additions and 623 deletions

View file

@ -16,12 +16,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.1.90", "version": "1.1.91",
"_release": "1.1.90", "_release": "1.1.91",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.1.90", "tag": "1.1.91",
"commit": "eb52e55b0f856ac89abcea9a71f475595d718627" "commit": "f94b80f14bce6922acf1dbd749a60ad54e4abfd8"
}, },
"_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git", "_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
"_target": "^1.1.51", "_target": "^1.1.51",

View file

@ -1252,11 +1252,9 @@
if (!username) { if (!username) {
return Promise.reject(); return Promise.reject();
return;
} }
if (!password) { if (!password) {
return Promise.reject(); return Promise.reject();
return;
} }
return ajax({ return ajax({

View file

@ -14,12 +14,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.4.314", "version": "1.4.320",
"_release": "1.4.314", "_release": "1.4.320",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.4.314", "tag": "1.4.320",
"commit": "087a1aa017a98fe347ce4388a794b3de13468a4d" "commit": "5b3dc54cf24d4f615a59e5954726231e446cfced"
}, },
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1", "_target": "^1.2.1",

View file

@ -264,7 +264,7 @@ define(['browser'], function (browser) {
// Otherwise with HLS and mp3 audio we're seeing some browsers // Otherwise with HLS and mp3 audio we're seeing some browsers
// safari is lying // safari is lying
if ((videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/, '') && !browser.safari) || browser.edgeUwp || browser.tizen) { if ((videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/, '') && !browser.safari) || browser.edgeUwp || browser.tizen) {
if ((options.disableVideoAudioCodecs || []).indexOf('ac3') == -1) { if ((options.disableVideoAudioCodecs || []).indexOf('ac3') === -1) {
videoAudioCodecs.push('ac3'); videoAudioCodecs.push('ac3');
// This works in edge desktop, but not mobile // This works in edge desktop, but not mobile

View file

@ -1,4 +1,5 @@
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'embyRouter', 'globalize', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, embyRouter, globalize) { define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'embyRouter', 'globalize', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, embyRouter, globalize) {
'use strict';
var currentServerId; var currentServerId;

View file

@ -148,6 +148,7 @@
} }
} }
if (toLocaleTimeStringSupportsLocales) {
return toLocaleTimeString(date, { return toLocaleTimeString(date, {
hour: 'numeric', hour: 'numeric',
@ -156,6 +157,40 @@
}); });
} }
var time = toLocaleTimeString(date);
var timeLower = time.toLowerCase();
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
time = timeLower;
var hour = date.getHours() % 12;
var suffix = date.getHours() > 11 ? 'pm' : 'am';
if (!hour) {
hour = 12;
}
var minutes = date.getMinutes();
if (minutes < 10) {
minutes = '0' + minutes;
}
minutes = ':' + minutes;
time = hour + minutes + suffix;
} else {
var timeParts = time.split(':');
// Trim off seconds
if (timeParts.length > 2) {
timeParts.length -= 1;
time = timeParts.join(':');
}
}
return time;
}
function isRelativeDay(date, offsetInDays) { function isRelativeDay(date, offsetInDays) {
var yesterday = new Date(); var yesterday = new Date();
var day = yesterday.getDate() + offsetInDays; var day = yesterday.getDate() + offsetInDays;

View file

@ -1,4 +1,5 @@
define(['itemShortcuts', 'connectionManager', 'layoutManager', 'browser', 'dom', 'loading', 'serverNotifications', 'events', 'registerElement'], function (itemShortcuts, connectionManager, layoutManager, browser, dom, loading, serverNotifications, events) { define(['itemShortcuts', 'connectionManager', 'layoutManager', 'browser', 'dom', 'loading', 'serverNotifications', 'events', 'registerElement'], function (itemShortcuts, connectionManager, layoutManager, browser, dom, loading, serverNotifications, events) {
'use strict';
var ItemsContainerProtoType = Object.create(HTMLDivElement.prototype); var ItemsContainerProtoType = Object.create(HTMLDivElement.prototype);

View file

@ -1,4 +1,5 @@
define(['multi-download'], function (multiDownload) { define(['multi-download'], function (multiDownload) {
'use strict';
return { return {
download: function (items) { download: function (items) {

View file

@ -1,4 +1,5 @@
define(['dom', 'fullscreenManager'], function (dom, fullscreenManager) { define(['dom', 'fullscreenManager'], function (dom, fullscreenManager) {
'use strict';
dom.addEventListener(window, 'dblclick', function () { dom.addEventListener(window, 'dblclick', function () {

View file

@ -1,4 +1,5 @@
define([], function () { define([], function () {
'use strict';
function fullscreenManager() { function fullscreenManager() {

View file

@ -339,13 +339,17 @@
.programTextIcon { .programTextIcon {
font-weight: bold; font-weight: bold;
color: rgb(30,30,30); color: rgb(30,30,30);
font-size: 1.0em; font-size: .9em;
background: #555; background: #555;
padding: .18em .32em; padding: .18em .32em;
border-radius: .25em; border-radius: .25em;
margin-right: .35em; margin-right: .35em;
} }
.programTextIcon-tv {
font-size: .7em;
}
.guideChannelNumber { .guideChannelNumber {
padding-left: 1em; padding-left: 1em;
max-width: 30%; max-width: 30%;

View file

@ -507,8 +507,12 @@
if (program.IsHD && options.showHdIcon) { if (program.IsHD && options.showHdIcon) {
//html += '<i class="guideHdIcon md-icon programIcon">hd</i>'; //html += '<i class="guideHdIcon md-icon programIcon">hd</i>';
if (layoutManager.tv) {
html += '<div class="programIcon programTextIcon programTextIcon-tv">HD</div>';
} else {
html += '<div class="programIcon programTextIcon">HD</div>'; html += '<div class="programIcon programTextIcon">HD</div>';
} }
}
html += getTimerIndicator(program); html += getTimerIndicator(program);

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focusManager', 'embyRouter'], function (connectionManager, playbackManager, events, inputManager, focusManager, embyRouter) { define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focusManager', 'embyRouter'], function (connectionManager, playbackManager, events, inputManager, focusManager, embyRouter) {
'use strict';
function notifyApp() { function notifyApp() {
@ -149,10 +150,10 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
notifyApp(); notifyApp();
var serverId = apiClient.serverInfo().Id; var serverId = apiClient.serverInfo().Id;
if (msg.Data.PlayCommand == "PlayNext") { if (msg.Data.PlayCommand === "PlayNext") {
playbackManager.queueNext({ ids: msg.Data.ItemIds, serverId: serverId }); playbackManager.queueNext({ ids: msg.Data.ItemIds, serverId: serverId });
} }
else if (msg.Data.PlayCommand == "PlayLast") { else if (msg.Data.PlayCommand === "PlayLast") {
playbackManager.queue({ ids: msg.Data.ItemIds, serverId: serverId }); playbackManager.queue({ ids: msg.Data.ItemIds, serverId: serverId });
} }
else { else {

View file

@ -1,4 +1,5 @@
define(['playbackManager', 'focusManager', 'embyRouter', 'dom'], function (playbackManager, focusManager, embyRouter, dom) { define(['playbackManager', 'focusManager', 'embyRouter', 'dom'], function (playbackManager, focusManager, embyRouter, dom) {
'use strict';
var lastInputTime = new Date().getTime(); var lastInputTime = new Date().getTime();

View file

@ -1,4 +1,5 @@
define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', 'playbackManager', 'loading', 'appSettings'], function (appHost, globalize, connectionManager, itemHelper, embyRouter, playbackManager, loading, appSettings) { define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', 'playbackManager', 'loading', 'appSettings'], function (appHost, globalize, connectionManager, itemHelper, embyRouter, playbackManager, loading, appSettings) {
'use strict';
var isMobileApp = window.Dashboard != null; var isMobileApp = window.Dashboard != null;
@ -29,21 +30,21 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
}); });
} }
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('sharedcomponents#CancelRecording'), name: globalize.translate('sharedcomponents#CancelRecording'),
id: 'canceltimer' id: 'canceltimer'
}); });
} }
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('sharedcomponents#CancelRecording'), name: globalize.translate('sharedcomponents#CancelRecording'),
id: 'canceltimer' id: 'canceltimer'
}); });
} }
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('sharedcomponents#CancelSeries'), name: globalize.translate('sharedcomponents#CancelSeries'),
id: 'cancelseriestimer' id: 'cancelseriestimer'
@ -52,7 +53,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (item.CanDelete) { if (item.CanDelete) {
if (item.Type == 'Playlist' || item.Type == 'BoxSet') { if (item.Type === 'Playlist' || item.Type === 'BoxSet') {
commands.push({ commands.push({
name: globalize.translate('sharedcomponents#Delete'), name: globalize.translate('sharedcomponents#Delete'),
id: 'delete' id: 'delete'
@ -67,9 +68,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (itemHelper.canEdit(user, item)) { if (itemHelper.canEdit(user, item)) {
if (options.edit !== false && item.Type != 'SeriesTimer') { if (options.edit !== false && item.Type !== 'SeriesTimer') {
var text = (item.Type == 'Timer' || item.Type == 'SeriesTimer') ? globalize.translate('sharedcomponents#Edit') : globalize.translate('sharedcomponents#EditInfo'); var text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('sharedcomponents#Edit') : globalize.translate('sharedcomponents#EditInfo');
commands.push({ commands.push({
name: text, name: text,
@ -90,7 +91,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (itemHelper.canEdit(user, item)) { if (itemHelper.canEdit(user, item)) {
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('sharedcomponents#EditSubtitles'), name: globalize.translate('sharedcomponents#EditSubtitles'),
@ -116,7 +117,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
} }
} }
if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "MusicGenre" || item.CollectionType == "music") { if (item.MediaType === "Audio" || item.Type === "MusicAlbum" || item.Type === "MusicArtist" || item.Type === "MusicGenre" || item.CollectionType === "music") {
if (options.instantMix !== false) { if (options.instantMix !== false) {
commands.push({ commands.push({
name: globalize.translate('sharedcomponents#InstantMix'), name: globalize.translate('sharedcomponents#InstantMix'),
@ -149,7 +150,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
} }
} }
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('sharedcomponents#PlayAllFromHere'), name: globalize.translate('sharedcomponents#PlayAllFromHere'),
id: 'playallfromhere' id: 'playallfromhere'
@ -173,7 +174,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
} }
} }
if (item.Type == 'Program') { if (item.Type === 'Program') {
commands.push({ commands.push({
name: Globalize.translate('sharedcomponents#Record'), name: Globalize.translate('sharedcomponents#Record'),
@ -183,7 +184,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (user.Policy.IsAdministrator) { if (user.Policy.IsAdministrator) {
if (item.Type != 'Timer' && item.Type != 'SeriesTimer' && item.Type != 'Program' && !(item.Type == 'Recording' && item.Status != 'Completed')) { if (item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program' && !(item.Type === 'Recording' && item.Status !== 'Completed')) {
commands.push({ commands.push({
name: globalize.translate('sharedcomponents#Refresh'), name: globalize.translate('sharedcomponents#Refresh'),
id: 'refresh' id: 'refresh'
@ -214,7 +215,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
} }
} }
if (item.IsFolder || item.Type == "MusicArtist" || item.Type == "MusicGenre") { if (item.IsFolder || item.Type === "MusicArtist" || item.Type === "MusicGenre") {
if (options.shuffle !== false) { if (options.shuffle !== false) {
commands.push({ commands.push({
name: globalize.translate('sharedcomponents#Shuffle'), name: globalize.translate('sharedcomponents#Shuffle'),
@ -534,7 +535,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
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
@ -553,12 +554,12 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
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);

View file

@ -1,4 +1,5 @@
define(['apphost'], function (appHost) { define(['apphost'], function (appHost) {
'use strict';
function getDisplayName(item, options) { function getDisplayName(item, options) {
@ -8,24 +9,24 @@ define(['apphost'], function (appHost) {
options = options || {}; options = options || {};
if (item.Type == 'Timer') { if (item.Type === 'Timer') {
item = item.ProgramInfo || item; item = item.ProgramInfo || item;
} }
var name = (item.Type == 'Program' && item.IsSeries ? item.EpisodeTitle : item.Name) || ''; var name = (item.Type === 'Program' && item.IsSeries ? item.EpisodeTitle : item.Name) || '';
if (item.Type == "TvChannel") { if (item.Type === "TvChannel") {
if (item.Number) { if (item.Number) {
return item.Number + ' ' + name; return item.Number + ' ' + name;
} }
return name; return name;
} }
if (/*options.isInlineSpecial &&*/ item.Type == "Episode" && item.ParentIndexNumber == 0) { if (/*options.isInlineSpecial &&*/ item.Type === "Episode" && item.ParentIndexNumber === 0) {
name = Globalize.translate('sharedcomponents#ValueSpecialEpisodeName', name); name = Globalize.translate('sharedcomponents#ValueSpecialEpisodeName', name);
} else if ((item.Type == "Episode" || item.Type == 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null) { } else if ((item.Type === "Episode" || item.Type === 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null) {
var displayIndexNumber = item.IndexNumber; var displayIndexNumber = item.IndexNumber;
@ -50,56 +51,56 @@ define(['apphost'], function (appHost) {
function supportsAddingToCollection(item) { function supportsAddingToCollection(item) {
if (item.Type == 'Timer' || item.Type == 'SeriesTimer') { if (item.Type === 'Timer' || item.Type === 'SeriesTimer') {
return false; return false;
} }
var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'TvChannel', 'Program', 'MusicAlbum', 'Timer']; var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'TvChannel', 'Program', 'MusicAlbum', 'Timer'];
if (item.Type == 'Recording') { if (item.Type === 'Recording') {
if (item.Status != 'Completed') { if (item.Status !== 'Completed') {
return false; return false;
} }
} }
return !item.CollectionType && invalidTypes.indexOf(item.Type) == -1 && item.MediaType != 'Photo'; return !item.CollectionType && invalidTypes.indexOf(item.Type) === -1 && item.MediaType !== 'Photo';
} }
function supportsAddingToPlaylist(item) { function supportsAddingToPlaylist(item) {
if (item.Type == 'Program') { if (item.Type === 'Program') {
return false; return false;
} }
if (item.Type == 'Timer') { if (item.Type === 'Timer') {
return false; return false;
} }
if (item.Type == 'SeriesTimer') { if (item.Type === 'SeriesTimer') {
return false; return false;
} }
if (item.Type == 'Recording') { if (item.Type === 'Recording') {
if (item.Status != 'Completed') { if (item.Status !== 'Completed') {
return false; return false;
} }
} }
return item.MediaType || item.IsFolder || item.Type == "Genre" || item.Type == "MusicGenre" || item.Type == "MusicArtist"; return item.MediaType || item.IsFolder || item.Type === "Genre" || item.Type === "MusicGenre" || item.Type === "MusicArtist";
} }
function canEdit(user, item) { function canEdit(user, item) {
var itemType = item.Type; var itemType = item.Type;
if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView") { if (itemType === "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType === "UserView") {
return false; return false;
} }
if (itemType == 'Program') { if (itemType === 'Program') {
return false; return false;
} }
if (item.Type == 'Recording') { if (item.Type === 'Recording') {
if (item.Status != 'Completed') { if (item.Status !== 'Completed') {
return false; return false;
} }
} }
@ -114,15 +115,15 @@ define(['apphost'], function (appHost) {
canIdentify: function (user, itemType) { canIdentify: function (user, itemType) {
if (itemType == "Movie" || if (itemType === "Movie" ||
itemType == "Trailer" || itemType === "Trailer" ||
itemType == "Series" || itemType === "Series" ||
itemType == "Game" || itemType === "Game" ||
itemType == "BoxSet" || itemType === "BoxSet" ||
itemType == "Person" || itemType === "Person" ||
itemType == "Book" || itemType === "Book" ||
itemType == "MusicAlbum" || itemType === "MusicAlbum" ||
itemType == "MusicArtist") { itemType === "MusicArtist") {
if (user.Policy.IsAdministrator) { if (user.Policy.IsAdministrator) {
@ -139,7 +140,7 @@ define(['apphost'], function (appHost) {
var itemType = item.Type; var itemType = item.Type;
if (itemType == 'UserView') { if (itemType === 'UserView') {
if (user.Policy.IsAdministrator) { if (user.Policy.IsAdministrator) {
return true; return true;
@ -148,13 +149,13 @@ define(['apphost'], function (appHost) {
return false; return false;
} }
if (item.Type == 'Recording') { if (item.Type === 'Recording') {
if (item.Status != 'Completed') { if (item.Status !== 'Completed') {
return false; return false;
} }
} }
return itemType != 'Timer' && itemType != 'SeriesTimer' && canEdit(user, item); return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item);
}, },
canSync: function (user, item) { canSync: function (user, item) {
@ -168,14 +169,14 @@ define(['apphost'], function (appHost) {
canShare: function (user, item) { canShare: function (user, item) {
if (item.Type == 'Timer') { if (item.Type === 'Timer') {
return false; return false;
} }
if (item.Type == 'SeriesTimer') { if (item.Type === 'SeriesTimer') {
return false; return false;
} }
if (item.Type == 'Recording') { if (item.Type === 'Recording') {
if (item.Status != 'Completed') { if (item.Status !== 'Completed') {
return false; return false;
} }
} }

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'itemHelper', 'mediaInfo', 'userdataButtons', 'playbackManager', 'globalize', 'dom', 'apphost', 'css!./itemhovermenu', 'emby-button'], function (connectionManager, itemHelper, mediaInfo, userdataButtons, playbackManager, globalize, dom, appHost) { define(['connectionManager', 'itemHelper', 'mediaInfo', 'userdataButtons', 'playbackManager', 'globalize', 'dom', 'apphost', 'css!./itemhovermenu', 'emby-button'], function (connectionManager, itemHelper, mediaInfo, userdataButtons, playbackManager, globalize, dom, appHost) {
'use strict';
var preventHover = false; var preventHover = false;
var showOverlayTimeout; var showOverlayTimeout;
@ -72,9 +73,9 @@
var className = card.className.toLowerCase(); var className = card.className.toLowerCase();
var isMiniItem = className.indexOf('mini') != -1; var isMiniItem = className.indexOf('mini') !== -1;
var isSmallItem = isMiniItem || className.indexOf('small') != -1; var isSmallItem = isMiniItem || className.indexOf('small') !== -1;
var isPortrait = className.indexOf('portrait') != -1; var isPortrait = className.indexOf('portrait') !== -1;
var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName; var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName;
var name = item.EpisodeTitle ? item.Name : itemHelper.getDisplayName(item); var name = item.EpisodeTitle ? item.Name : itemHelper.getDisplayName(item);
@ -136,7 +137,7 @@
buttonCount++; buttonCount++;
} }
var moreIcon = appHost.moreIcon == 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;'; var moreIcon = appHost.moreIcon === 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
html += '<button is="emby-button" class="itemAction autoSize fab cardOverlayFab mini" data-action="menu" data-playoptions="false"><i class="md-icon cardOverlayFab-md-icon">' + moreIcon + '</i></button>'; html += '<button is="emby-button" class="itemAction autoSize fab cardOverlayFab mini" data-action="menu" data-playoptions="false"><i class="md-icon cardOverlayFab-md-icon">' + moreIcon + '</i></button>';
buttonCount++; buttonCount++;
@ -191,7 +192,7 @@
var id = dataElement.getAttribute('data-id'); var id = dataElement.getAttribute('data-id');
var type = dataElement.getAttribute('data-type'); var type = dataElement.getAttribute('data-type');
if (type == 'Timer' || type == 'SeriesTimer') { if (type === 'Timer' || type === 'SeriesTimer') {
return; return;
} }
@ -265,7 +266,6 @@
} }
ItemHoverMenu.prototype = { ItemHoverMenu.prototype = {
constructor: ItemHoverMenu, constructor: ItemHoverMenu,
destroy: function () { destroy: function () {
@ -276,7 +276,7 @@
passive: true passive: true
}); });
} }
} };
return ItemHoverMenu; return ItemHoverMenu;
}); });

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'loading', 'cardBuilder', 'connectionManager', 'require', 'globalize', 'scrollHelper', 'layoutManager', 'focusManager', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'cardStyle'], function (dialogHelper, loading, cardBuilder, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager) { define(['dialogHelper', 'loading', 'cardBuilder', 'connectionManager', 'require', 'globalize', 'scrollHelper', 'layoutManager', 'focusManager', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'cardStyle'], function (dialogHelper, loading, cardBuilder, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager) {
'use strict';
var currentItem; var currentItem;
var currentItemType; var currentItemType;
@ -20,13 +21,14 @@
var i, length; var i, length;
var identifyField = page.querySelectorAll('.identifyField'); var identifyField = page.querySelectorAll('.identifyField');
var value;
for (i = 0, length = identifyField.length; i < length; i++) { for (i = 0, length = identifyField.length; i < length; i++) {
var value = identifyField[i].value; value = identifyField[i].value;
if (value) { if (value) {
if (identifyField[i].type == 'number') { if (identifyField[i].type === 'number') {
value = parseInt(value); value = parseInt(value);
} }
@ -39,7 +41,7 @@
var txtLookupId = page.querySelectorAll('.txtLookupId'); var txtLookupId = page.querySelectorAll('.txtLookupId');
for (i = 0, length = txtLookupId.length; i < length; i++) { for (i = 0, length = txtLookupId.length; i < length; i++) {
var value = txtLookupId[i].value; value = txtLookupId[i].value;
if (value) { if (value) {
hasId = true; hasId = true;
@ -177,11 +179,11 @@
var cardBoxCssClass = 'cardBox visualCardBox'; var cardBoxCssClass = 'cardBox visualCardBox';
var padderClass; var padderClass;
if (currentItemType == "Episode") { if (currentItemType === "Episode") {
cssClass += " backdropCard backdropCard-scalable"; cssClass += " backdropCard backdropCard-scalable";
padderClass = 'cardPadder-backdrop'; padderClass = 'cardPadder-backdrop';
} }
else if (currentItemType == "MusicAlbum" || currentItemType == "MusicArtist") { else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") {
cssClass += " squareCard squareCard-scalable"; cssClass += " squareCard squareCard-scalable";
padderClass = 'cardPadder-square'; padderClass = 'cardPadder-square';
} }
@ -297,7 +299,7 @@
page.querySelector('#txtLookupName').value = ''; page.querySelector('#txtLookupName').value = '';
if (item.Type == "Person" || item.Type == "BoxSet") { if (item.Type === "Person" || item.Type === "BoxSet") {
page.querySelector('.fldLookupYear').classList.add('hide'); page.querySelector('.fldLookupYear').classList.add('hide');
page.querySelector('#txtLookupYear').value = ''; page.querySelector('#txtLookupYear').value = '';
@ -455,7 +457,7 @@
dlg.querySelector('#txtLookupName').value = itemName; dlg.querySelector('#txtLookupName').value = itemName;
if (itemType == "Person" || itemType == "BoxSet") { if (itemType === "Person" || itemType === "BoxSet") {
dlg.querySelector('.fldLookupYear').classList.add('hide'); dlg.querySelector('.fldLookupYear').classList.add('hide');
dlg.querySelector('#txtLookupYear').value = ''; dlg.querySelector('#txtLookupYear').value = '';

View file

@ -3,7 +3,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
function setLayout(self, layout, selectedLayout) { function setLayout(self, layout, selectedLayout) {
if (layout == selectedLayout) { if (layout === selectedLayout) {
self[layout] = true; self[layout] = true;
document.documentElement.classList.add('layout-' + layout); document.documentElement.classList.add('layout-' + layout);
} else { } else {
@ -12,7 +12,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
} }
} }
function layoutManager() { function LayoutManager() {
var self = this; var self = this;
@ -62,7 +62,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
self.autoLayout(); self.autoLayout();
} }
}; };
}; }
return new layoutManager(); return new LayoutManager();
}); });

View file

@ -1,8 +1,9 @@
define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutManager', 'globalize', 'datetime', 'userdataButtons', 'apphost', 'css!./listview'], function (itemHelper, mediaInfo, indicators, connectionManager, layoutManager, globalize, datetime, userdataButtons, appHost) { define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutManager', 'globalize', 'datetime', 'userdataButtons', 'apphost', 'css!./listview'], function (itemHelper, mediaInfo, indicators, connectionManager, layoutManager, globalize, datetime, userdataButtons, appHost) {
'use strict';
function getIndex(item, options) { function getIndex(item, options) {
if (options.index == 'disc') { if (options.index === 'disc') {
return item.ParentIndexNumber == null ? '' : globalize.translate('sharedcomponents#ValueDiscNumber', item.ParentIndexNumber); return item.ParentIndexNumber == null ? '' : globalize.translate('sharedcomponents#ValueDiscNumber', item.ParentIndexNumber);
} }
@ -10,9 +11,11 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var sortBy = (options.sortBy || '').toLowerCase(); var sortBy = (options.sortBy || '').toLowerCase();
var code, name; var code, name;
if (sortBy.indexOf('sortname') == 0) { if (sortBy.indexOf('sortname') === 0) {
if (item.Type == 'Episode') return ''; if (item.Type === 'Episode') {
return '';
}
// SortName // SortName
name = (item.SortName || item.Name || '?')[0].toUpperCase(); name = (item.SortName || item.Name || '?')[0].toUpperCase();
@ -24,11 +27,11 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return name.toUpperCase(); return name.toUpperCase();
} }
if (sortBy.indexOf('officialrating') == 0) { if (sortBy.indexOf('officialrating') === 0) {
return item.OfficialRating || globalize.translate('sharedcomponents#Unrated'); return item.OfficialRating || globalize.translate('sharedcomponents#Unrated');
} }
if (sortBy.indexOf('communityrating') == 0) { if (sortBy.indexOf('communityrating') === 0) {
if (item.CommunityRating == null) { if (item.CommunityRating == null) {
return globalize.translate('sharedcomponents#Unrated'); return globalize.translate('sharedcomponents#Unrated');
@ -36,7 +39,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return Math.floor(item.CommunityRating); return Math.floor(item.CommunityRating);
} }
if (sortBy.indexOf('criticrating') == 0) { if (sortBy.indexOf('criticrating') === 0) {
if (item.CriticRating == null) { if (item.CriticRating == null) {
return globalize.translate('sharedcomponents#Unrated'); return globalize.translate('sharedcomponents#Unrated');
@ -44,7 +47,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return Math.floor(item.CriticRating); return Math.floor(item.CriticRating);
} }
if (sortBy.indexOf('metascore') == 0) { if (sortBy.indexOf('metascore') === 0) {
if (item.Metascore == null) { if (item.Metascore == null) {
return globalize.translate('sharedcomponents#Unrated'); return globalize.translate('sharedcomponents#Unrated');
@ -52,10 +55,12 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return Math.floor(item.Metascore); return Math.floor(item.Metascore);
} }
if (sortBy.indexOf('albumartist') == 0) { if (sortBy.indexOf('albumartist') === 0) {
// SortName // SortName
if (!item.AlbumArtist) return ''; if (!item.AlbumArtist) {
return '';
}
name = item.AlbumArtist[0].toUpperCase(); name = item.AlbumArtist[0].toUpperCase();
@ -78,9 +83,9 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
type: "Primary" type: "Primary"
}; };
if (item.ImageTags && item.ImageTags['Primary']) { if (item.ImageTags && item.ImageTags.Primary) {
options.tag = item.ImageTags['Primary']; options.tag = item.ImageTags.Primary;
return apiClient.getScaledImageUrl(item.Id, options); return apiClient.getScaledImageUrl(item.Id, options);
} }
@ -144,7 +149,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var groupTitle = ''; var groupTitle = '';
var action = options.action || 'link'; var action = options.action || 'link';
var isLargeStyle = options.imageSize == 'large'; var isLargeStyle = options.imageSize === 'large';
var enableOverview = options.enableOverview; var enableOverview = options.enableOverview;
var clickEntireItem = layoutManager.tv ? true : false; var clickEntireItem = layoutManager.tv ? true : false;
@ -163,13 +168,13 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var itemGroupTitle = getIndex(item, options); var itemGroupTitle = getIndex(item, options);
if (itemGroupTitle != groupTitle) { if (itemGroupTitle !== groupTitle) {
if (html) { if (html) {
html += '</div>'; html += '</div>';
} }
if (i == 0) { if (i === 0) {
html += '<h1 class="listGroupHeader listGroupHeader-first">'; html += '<h1 class="listGroupHeader listGroupHeader-first">';
} }
else { else {
@ -187,7 +192,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var cssClass = "listItem"; var cssClass = "listItem";
if (options.highlight !== false) { if (options.highlight !== false) {
if (i % 2 == 1) { if (i % 2 === 1) {
cssClass += ' listItem-odd'; cssClass += ' listItem-odd';
} }
} }
@ -270,7 +275,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var parentTitle = null; var parentTitle = null;
if (options.showParentTitle) { if (options.showParentTitle) {
if (item.Type == 'Episode') { if (item.Type === 'Episode') {
parentTitle = item.SeriesName; parentTitle = item.SeriesName;
} }
@ -306,23 +311,23 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
} }
if (options.artist !== false) { if (options.artist !== false) {
if (item.ArtistItems && item.Type != 'MusicAlbum') { if (item.ArtistItems && item.Type !== 'MusicAlbum') {
textlines.push(item.ArtistItems.map(function (a) { textlines.push(item.ArtistItems.map(function (a) {
return a.Name; return a.Name;
}).join(', ')); }).join(', '));
} }
if (item.AlbumArtist && item.Type == 'MusicAlbum') { if (item.AlbumArtist && item.Type === 'MusicAlbum') {
textlines.push(item.AlbumArtist); textlines.push(item.AlbumArtist);
} }
} }
if (item.Type == 'Game') { if (item.Type === 'Game') {
textlines.push(item.GameSystem); textlines.push(item.GameSystem);
} }
if (item.Type == 'TvChannel') { if (item.Type === 'TvChannel') {
if (item.CurrentProgram) { if (item.CurrentProgram) {
textlines.push(itemHelper.getDisplayName(item.CurrentProgram)); textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
@ -340,7 +345,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
html += '<div class="' + cssClass + '">'; html += '<div class="' + cssClass + '">';
var moreIcon = appHost.moreIcon == 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;'; var moreIcon = appHost.moreIcon === 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
html += getTextLinesHtml(textlines, isLargeStyle); html += getTextLinesHtml(textlines, isLargeStyle);
@ -376,7 +381,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
} }
} }
if (!options.recordButton && (item.Type == 'Timer' || item.Type == 'Program')) { if (!options.recordButton && (item.Type === 'Timer' || item.Type === 'Program')) {
html += indicators.getTimerIndicator(item).replace('indicatorIcon', 'indicatorIcon listItemAside'); html += indicators.getTimerIndicator(item).replace('indicatorIcon', 'indicatorIcon listItemAside');
} }

View file

@ -1,4 +1,5 @@
define(['css!./loading-legacy'], function () { define(['css!./loading-legacy'], function () {
'use strict';
var loadingElem; var loadingElem;

View file

@ -1,4 +1,5 @@
define(['css!./loading-lite'], function () { define(['css!./loading-lite'], function () {
'use strict';
var loadingElem; var loadingElem;

View file

@ -1,17 +1,18 @@
define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', 'css!./mediainfo.css', 'programStyles'], function (datetime, globalize, embyRouter, itemHelper) { define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', 'css!./mediainfo.css', 'programStyles'], function (datetime, globalize, embyRouter, itemHelper) {
'use strict';
function getTimerIndicator(item) { function getTimerIndicator(item) {
var status; var status;
if (item.Type == 'SeriesTimer') { if (item.Type === 'SeriesTimer') {
return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon">&#xE062;</i>'; return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon">&#xE062;</i>';
} }
else if (item.TimerId || item.SeriesTimerId) { else if (item.TimerId || item.SeriesTimerId) {
status = item.Status || 'Cancelled'; status = item.Status || 'Cancelled';
} }
else if (item.Type == 'Timer') { else if (item.Type === 'Timer') {
status = item.Status; status = item.Status;
} }
@ -21,7 +22,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
if (item.SeriesTimerId) { if (item.SeriesTimerId) {
if (status != 'Cancelled') { if (status !== 'Cancelled') {
return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon">&#xE062;</i>'; return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon">&#xE062;</i>';
} }
@ -93,12 +94,13 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
var miscInfo = []; var miscInfo = [];
options = options || {}; options = options || {};
var text, date, minutes; var text, date, minutes;
var count;
var showFolderRuntime = item.Type == "MusicAlbum" || item.MediaType == 'MusicArtist' || item.MediaType == 'Playlist' || item.MediaType == 'MusicGenre'; var showFolderRuntime = item.Type === "MusicAlbum" || item.MediaType === 'MusicArtist' || item.MediaType === 'Playlist' || item.MediaType === 'MusicGenre';
if (showFolderRuntime) { if (showFolderRuntime) {
var count = item.SongCount || item.ChildCount; count = item.SongCount || item.ChildCount;
if (count) { if (count) {
@ -110,9 +112,9 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
} }
else if (item.Type == "PhotoAlbum" || item.Type == "BoxSet") { else if (item.Type === "PhotoAlbum" || item.Type === "BoxSet") {
var count = item.ChildCount; count = item.ChildCount;
if (count) { if (count) {
@ -120,7 +122,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
} }
if (item.Type == "Episode" || item.MediaType == 'Photo') { if (item.Type === "Episode" || item.MediaType === 'Photo') {
if (item.PremiereDate) { if (item.PremiereDate) {
@ -136,7 +138,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
} }
if (item.StartDate && item.Type != 'Program') { if (item.StartDate && item.Type !== 'Program') {
try { try {
date = datetime.parseISO8601Date(item.StartDate); date = datetime.parseISO8601Date(item.StartDate);
@ -144,7 +146,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
text = datetime.toLocaleDateString(date); text = datetime.toLocaleDateString(date);
miscInfo.push(text); miscInfo.push(text);
if (item.Type != "Recording") { if (item.Type !== "Recording") {
text = datetime.getDisplayTime(date); text = datetime.getDisplayTime(date);
miscInfo.push(text); miscInfo.push(text);
} }
@ -154,9 +156,9 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
} }
if (options.year !== false && item.ProductionYear && item.Type == "Series") { if (options.year !== false && item.ProductionYear && item.Type === "Series") {
if (item.Status == "Continuing") { if (item.Status === "Continuing") {
miscInfo.push(globalize.translate('sharedcomponents#SeriesYearToPresent', item.ProductionYear)); miscInfo.push(globalize.translate('sharedcomponents#SeriesYearToPresent', item.ProductionYear));
} }
@ -170,7 +172,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear(); var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
if (endYear != item.ProductionYear) { if (endYear !== item.ProductionYear) {
text += "-" + datetime.parseISO8601Date(item.EndDate).getFullYear(); text += "-" + datetime.parseISO8601Date(item.EndDate).getFullYear();
} }
@ -184,7 +186,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
} }
if (item.Type == 'Program') { if (item.Type === 'Program') {
if (item.IsLive) { if (item.IsLive) {
miscInfo.push({ miscInfo.push({
@ -228,7 +230,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
if (options.year !== false) { if (options.year !== false) {
if (item.Type != "Series" && item.Type != "Episode" && item.Type != "Person" && item.MediaType != 'Photo' && item.Type != 'Program') { if (item.Type !== "Series" && item.Type !== "Episode" && item.Type !== "Person" && item.MediaType !== 'Photo' && item.Type !== 'Program') {
if (item.ProductionYear) { if (item.ProductionYear) {
@ -247,9 +249,9 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
} }
} }
if (item.RunTimeTicks && item.Type != "Series" && item.Type != 'Program' && !showFolderRuntime && options.runtime !== false) { if (item.RunTimeTicks && item.Type !== "Series" && item.Type !== 'Program' && !showFolderRuntime && options.runtime !== false) {
if (item.Type == "Audio") { if (item.Type === "Audio") {
miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks)); miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
@ -273,11 +275,11 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
miscInfo.push("3D"); miscInfo.push("3D");
} }
if (item.MediaType == 'Photo' && item.Width && item.Height) { if (item.MediaType === 'Photo' && item.Width && item.Height) {
miscInfo.push(item.Width + "x" + item.Height); miscInfo.push(item.Width + "x" + item.Height);
} }
if (options.container !== false && item.Type == 'Audio' && item.Container) { if (options.container !== false && item.Type === 'Audio' && item.Container) {
miscInfo.push(item.Container); miscInfo.push(item.Container);
} }
@ -313,7 +315,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
function getEndsAt(item) { function getEndsAt(item) {
if (item.MediaType == 'Video' && item.RunTimeTicks) { if (item.MediaType === 'Video' && item.RunTimeTicks) {
if (!item.StartDate) { if (!item.StartDate) {
var endDate = new Date().getTime() + (item.RunTimeTicks / 10000); var endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
@ -444,7 +446,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
if (options.interactive == null) { if (options.interactive == null) {
options.interactive = false; options.interactive = false;
} }
if (item.Type == 'Program') { if (item.Type === 'Program') {
return getProgramInfoHtml(item, options); return getProgramInfoHtml(item, options);
} }

View file

@ -1,4 +1,5 @@
define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loading', 'focusManager', 'connectionManager', 'globalize', 'require', 'shell', 'dom', 'emby-checkbox', 'emby-input', 'emby-select', 'listViewStyle', 'emby-textarea', 'emby-button', 'paper-icon-button-light', 'css!./../formdialog'], function (itemHelper, dom, layoutManager, dialogHelper, datetime, loading, focusManager, connectionManager, globalize, require, shell, dom) { define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loading', 'focusManager', 'connectionManager', 'globalize', 'require', 'shell', 'emby-checkbox', 'emby-input', 'emby-select', 'listViewStyle', 'emby-textarea', 'emby-button', 'paper-icon-button-light', 'css!./../formdialog'], function (itemHelper, dom, layoutManager, dialogHelper, datetime, loading, focusManager, connectionManager, globalize, require, shell) {
'use strict';
var currentContext; var currentContext;
var metadataEditorInfo; var metadataEditorInfo;
@ -33,7 +34,7 @@
var newContentType = form.querySelector('#selectContentType').value || ''; var newContentType = form.querySelector('#selectContentType').value || '';
if ((metadataEditorInfo.ContentType || '') != newContentType) { if ((metadataEditorInfo.ContentType || '') !== newContentType) {
apiClient.ajax({ apiClient.ajax({
@ -104,7 +105,7 @@
var parts = date.toISOString().split('T'); var parts = date.toISOString().split('T');
// If the date is the same, preserve the time // If the date is the same, preserve the time
if (parts[0].indexOf(val) == 0) { if (parts[0].indexOf(val) === 0) {
var iso = parts[1]; var iso = parts[1];
@ -189,14 +190,14 @@
item.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value; item.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
item.PreferredMetadataCountryCode = form.querySelector('#selectCountry').value; item.PreferredMetadataCountryCode = form.querySelector('#selectCountry').value;
if (currentItem.Type == "Person") { if (currentItem.Type === "Person") {
var placeOfBirth = form.querySelector('#txtPlaceOfBirth').value; var placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : []; item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
} }
if (currentItem.Type == "Series") { if (currentItem.Type === "Series") {
// 600000000 // 600000000
var seriesRuntime = form.querySelector('#txtSeriesRuntime').value; var seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
@ -248,7 +249,7 @@
personEditor.show(person).then(function (updatedPerson) { personEditor.show(person).then(function (updatedPerson) {
var isNew = index == -1; var isNew = index === -1;
if (isNew) { if (isNew) {
currentItem.People.push(updatedPerson); currentItem.People.push(updatedPerson);
@ -308,7 +309,7 @@
if (msg.MessageType === "LibraryChanged") { if (msg.MessageType === "LibraryChanged") {
if (msg.Data.ItemsUpdated.indexOf(currentItem.Id) != -1) { if (msg.Data.ItemsUpdated.indexOf(currentItem.Id) !== -1) {
console.log('Item updated - reloading metadata'); console.log('Item updated - reloading metadata');
reload(currentContext, currentItem.Id, currentItem.ServerId); reload(currentContext, currentItem.Id, currentItem.ServerId);
@ -400,16 +401,17 @@
context.querySelector('#peopleList').addEventListener('click', function (e) { context.querySelector('#peopleList').addEventListener('click', function (e) {
var index;
var btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson'); var btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
if (btnDeletePerson) { if (btnDeletePerson) {
var index = parseInt(btnDeletePerson.getAttribute('data-index')); index = parseInt(btnDeletePerson.getAttribute('data-index'));
currentItem.People.splice(index, 1); currentItem.People.splice(index, 1);
populatePeople(context, currentItem.People); populatePeople(context, currentItem.People);
} }
var btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson'); var btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson');
if (btnEditPerson) { if (btnEditPerson) {
var index = parseInt(btnEditPerson.getAttribute('data-index')); index = parseInt(btnEditPerson.getAttribute('data-index'));
editPerson(context, currentItem.People[index], index); editPerson(context, currentItem.People[index], index);
} }
}); });
@ -535,7 +537,7 @@
// Context is optional and restricts the querySelector to the context // Context is optional and restricts the querySelector to the context
function hideElement(selector, context, multiple) { function hideElement(selector, context, multiple) {
context = context || document; context = context || document;
if (typeof selector == 'string') { if (typeof selector === 'string') {
var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)]; var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
@ -554,7 +556,7 @@
// Context is optional and restricts the querySelector to the context // Context is optional and restricts the querySelector to the context
function showElement(selector, context, multiple) { function showElement(selector, context, multiple) {
context = context || document; context = context || document;
if (typeof selector == 'string') { if (typeof selector === 'string') {
var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)]; var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
@ -569,31 +571,31 @@
} }
function setFieldVisibilities(context, item) { function setFieldVisibilities(context, item) {
if (item.Path && item.LocationType != 'Remote') { if (item.Path && item.LocationType !== 'Remote') {
showElement('#fldPath', context); showElement('#fldPath', context);
} else { } else {
hideElement('#fldPath', context); hideElement('#fldPath', context);
} }
if (item.Type == "Series" || item.Type == "Movie" || item.Type == "Trailer") { if (item.Type === "Series" || item.Type === "Movie" || item.Type === "Trailer") {
showElement('#fldOriginalName', context); showElement('#fldOriginalName', context);
} else { } else {
hideElement('#fldOriginalName', context); hideElement('#fldOriginalName', context);
} }
if (item.Type == "Series") { if (item.Type === "Series") {
showElement('#fldSeriesRuntime', context); showElement('#fldSeriesRuntime', context);
} else { } else {
hideElement('#fldSeriesRuntime', context); hideElement('#fldSeriesRuntime', context);
} }
if (item.Type == "Series" || item.Type == "Person") { if (item.Type === "Series" || item.Type === "Person") {
showElement('#fldEndDate', context); showElement('#fldEndDate', context);
} else { } else {
hideElement('#fldEndDate', context); hideElement('#fldEndDate', context);
} }
if (item.Type == "Movie" || item.MediaType == "Game" || item.MediaType == "Trailer" || item.Type == "MusicVideo") { if (item.Type === "Movie" || item.MediaType === "Game" || item.MediaType === "Trailer" || item.Type === "MusicVideo") {
showElement('#fldBudget', context); showElement('#fldBudget', context);
showElement('#fldRevenue', context); showElement('#fldRevenue', context);
} else { } else {
@ -601,19 +603,19 @@
hideElement('#fldRevenue', context); hideElement('#fldRevenue', context);
} }
if (item.Type == "MusicAlbum") { if (item.Type === "MusicAlbum") {
showElement('#albumAssociationMessage', context); showElement('#albumAssociationMessage', context);
} else { } else {
hideElement('#albumAssociationMessage', context) hideElement('#albumAssociationMessage', context);
} }
if (item.MediaType == "Game") { if (item.MediaType === "Game") {
showElement('#fldPlayers', context); showElement('#fldPlayers', context);
} else { } else {
hideElement('#fldPlayers', context); hideElement('#fldPlayers', context);
} }
if (item.Type == "Movie" || item.Type == "Trailer") { if (item.Type === "Movie" || item.Type === "Trailer") {
showElement('#fldCriticRating', context); showElement('#fldCriticRating', context);
showElement('#fldCriticRatingSummary', context); showElement('#fldCriticRatingSummary', context);
} else { } else {
@ -621,19 +623,19 @@
hideElement('#fldCriticRatingSummary', context); hideElement('#fldCriticRatingSummary', context);
} }
if (item.Type == "Movie") { if (item.Type === "Movie") {
showElement('#fldAwardSummary', context); showElement('#fldAwardSummary', context);
} else { } else {
hideElement('#fldAwardSummary', context); hideElement('#fldAwardSummary', context);
} }
if (item.Type == "Movie" || item.Type == "Trailer") { if (item.Type === "Movie" || item.Type === "Trailer") {
showElement('#fldMetascore', context); showElement('#fldMetascore', context);
} else { } else {
hideElement('#fldMetascore', context); hideElement('#fldMetascore', context);
} }
if (item.Type == "Series") { if (item.Type === "Series") {
showElement('#fldStatus', context); showElement('#fldStatus', context);
showElement('#fldAirDays', context); showElement('#fldAirDays', context);
showElement('#fldAirTime', context); showElement('#fldAirTime', context);
@ -643,19 +645,19 @@
hideElement('#fldAirTime', context); hideElement('#fldAirTime', context);
} }
if (item.MediaType == "Video" && item.Type != "TvChannel") { if (item.MediaType === "Video" && item.Type !== "TvChannel") {
showElement('#fld3dFormat', context); showElement('#fld3dFormat', context);
} else { } else {
hideElement('#fld3dFormat', context); hideElement('#fld3dFormat', context);
} }
if (item.Type == "Audio") { if (item.Type === "Audio") {
showElement('#fldAlbumArtist', context); showElement('#fldAlbumArtist', context);
} else { } else {
hideElement('#fldAlbumArtist', context); hideElement('#fldAlbumArtist', context);
} }
if (item.Type == "Audio" || item.Type == "MusicVideo") { if (item.Type === "Audio" || item.Type === "MusicVideo") {
showElement('#fldArtist', context); showElement('#fldArtist', context);
showElement('#fldAlbum', context); showElement('#fldAlbum', context);
} else { } else {
@ -663,26 +665,26 @@
hideElement('#fldAlbum', context); hideElement('#fldAlbum', context);
} }
if (item.Type == "Episode") { if (item.Type === "Episode") {
showElement('#collapsibleDvdEpisodeInfo', context); showElement('#collapsibleDvdEpisodeInfo', context);
} else { } else {
hideElement('#collapsibleDvdEpisodeInfo', context); hideElement('#collapsibleDvdEpisodeInfo', context);
} }
if (item.Type == "Episode" && item.ParentIndexNumber == 0) { if (item.Type === "Episode" && item.ParentIndexNumber === 0) {
showElement('#collapsibleSpecialEpisodeInfo', context); showElement('#collapsibleSpecialEpisodeInfo', context);
} else { } else {
hideElement('#collapsibleSpecialEpisodeInfo', context); hideElement('#collapsibleSpecialEpisodeInfo', context);
} }
if (item.Type == "Person" || item.Type == "Genre" || item.Type == "Studio" || item.Type == "GameGenre" || item.Type == "MusicGenre" || item.Type == "TvChannel") { if (item.Type === "Person" || item.Type === "Genre" || item.Type === "Studio" || item.Type === "GameGenre" || item.Type === "MusicGenre" || item.Type === "TvChannel") {
hideElement('#fldCommunityRating', context); hideElement('#fldCommunityRating', context);
hideElement('#fldCommunityVoteCount', context); hideElement('#fldCommunityVoteCount', context);
hideElement('#genresCollapsible', context); hideElement('#genresCollapsible', context);
hideElement('#peopleCollapsible', context); hideElement('#peopleCollapsible', context);
hideElement('#studiosCollapsible', context); hideElement('#studiosCollapsible', context);
if (item.Type == "TvChannel") { if (item.Type === "TvChannel") {
showElement('#fldOfficialRating', context); showElement('#fldOfficialRating', context);
} else { } else {
hideElement('#fldOfficialRating', context); hideElement('#fldOfficialRating', context);
@ -698,7 +700,7 @@
showElement('#fldCustomRating', context); showElement('#fldCustomRating', context);
} }
if (item.Type == "TvChannel") { if (item.Type === "TvChannel") {
hideElement('#tagsCollapsible', context); hideElement('#tagsCollapsible', context);
hideElement('#metadataSettingsCollapsible', context); hideElement('#metadataSettingsCollapsible', context);
hideElement('#fldPremiereDate', context); hideElement('#fldPremiereDate', context);
@ -712,19 +714,19 @@
showElement('#fldYear', context); showElement('#fldYear', context);
} }
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") { if (item.Type === "Movie" || item.Type === "Trailer" || item.Type === "BoxSet") {
showElement('#keywordsCollapsible', context); showElement('#keywordsCollapsible', context);
} else { } else {
hideElement('#keywordsCollapsible', context); hideElement('#keywordsCollapsible', context);
} }
if (item.MediaType == "Video" && item.Type != "TvChannel") { if (item.MediaType === "Video" && item.Type !== "TvChannel") {
showElement('#fldSourceType', context); showElement('#fldSourceType', context);
} else { } else {
hideElement('#fldSourceType', context); hideElement('#fldSourceType', context);
} }
if (item.Type == "Person") { if (item.Type === "Person") {
//todo //todo
context.querySelector('#txtProductionYear').label(globalize.translate('sharedcomponents#LabelBirthYear')); context.querySelector('#txtProductionYear').label(globalize.translate('sharedcomponents#LabelBirthYear'));
context.querySelector("#txtPremiereDate").label(globalize.translate('sharedcomponents#LabelBirthDate')); context.querySelector("#txtPremiereDate").label(globalize.translate('sharedcomponents#LabelBirthDate'));
@ -737,20 +739,20 @@
hideElement('#fldPlaceOfBirth'); hideElement('#fldPlaceOfBirth');
} }
if (item.MediaType == "Video" && item.Type != "TvChannel") { if (item.MediaType === "Video" && item.Type !== "TvChannel") {
showElement('#fldOriginalAspectRatio'); showElement('#fldOriginalAspectRatio');
} else { } else {
hideElement('#fldOriginalAspectRatio'); hideElement('#fldOriginalAspectRatio');
} }
if (item.Type == "Audio" || item.Type == "Episode" || item.Type == "Season") { if (item.Type === "Audio" || item.Type === "Episode" || item.Type === "Season") {
showElement('#fldIndexNumber'); showElement('#fldIndexNumber');
if (item.Type == "Episode") { if (item.Type === "Episode") {
context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelEpisodeNumber')); context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelEpisodeNumber'));
} else if (item.Type == "Season") { } else if (item.Type === "Season") {
context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelSeasonNumber')); context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelSeasonNumber'));
} else if (item.Type == "Audio") { } else if (item.Type === "Audio") {
context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelTrackNumber')); context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelTrackNumber'));
} else { } else {
context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelNumber')); context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelNumber'));
@ -759,12 +761,12 @@
hideElement('#fldIndexNumber'); hideElement('#fldIndexNumber');
} }
if (item.Type == "Audio" || item.Type == "Episode") { if (item.Type === "Audio" || item.Type === "Episode") {
showElement('#fldParentIndexNumber'); showElement('#fldParentIndexNumber');
if (item.Type == "Episode") { if (item.Type === "Episode") {
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelSeasonNumber')); context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelSeasonNumber'));
} else if (item.Type == "Audio") { } else if (item.Type === "Audio") {
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelDiscNumber')); context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelDiscNumber'));
} else { } else {
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelParentNumber')); context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelParentNumber'));
@ -773,7 +775,7 @@
hideElement('#fldParentIndexNumber', context); hideElement('#fldParentIndexNumber', context);
} }
if (item.Type == "BoxSet") { if (item.Type === "BoxSet") {
showElement('#fldDisplayOrder', context); showElement('#fldDisplayOrder', context);
context.querySelector('#selectDisplayOrder').innerHTML = '<option value="SortName">' + globalize.translate('sharedcomponents#SortName') + '</option><option value="PremiereDate">' + globalize.translate('sharedcomponents#ReleaseDate') + '</option>'; context.querySelector('#selectDisplayOrder').innerHTML = '<option value="SortName">' + globalize.translate('sharedcomponents#SortName') + '</option><option value="PremiereDate">' + globalize.translate('sharedcomponents#ReleaseDate') + '</option>';
@ -784,7 +786,7 @@
var displaySettingFields = context.querySelectorAll('.fldDisplaySetting'); var displaySettingFields = context.querySelectorAll('.fldDisplaySetting');
var hiddenDisplaySettingFields = Array.prototype.filter.call(displaySettingFields, function (field) { var hiddenDisplaySettingFields = Array.prototype.filter.call(displaySettingFields, function (field) {
return field.style.display != 'none'; return field.style.display !== 'none';
}); });
if (hiddenDisplaySettingFields.length) { if (hiddenDisplaySettingFields.length) {
@ -815,7 +817,7 @@
context.querySelector('#select3dFormat', context).value = item.Video3DFormat || ""; context.querySelector('#select3dFormat', context).value = item.Video3DFormat || "";
Array.prototype.forEach.call(context.querySelectorAll('.chkAirDay', context), function (el) { Array.prototype.forEach.call(context.querySelectorAll('.chkAirDay', context), function (el) {
el.checked = (item.AirDays || []).indexOf(el.getAttribute('data-day')) != -1; el.checked = (item.AirDays || []).indexOf(el.getAttribute('data-day')) !== -1;
}); });
populateListView(context.querySelector('#listGenres'), item.Genres); populateListView(context.querySelector('#listGenres'), item.Genres);
@ -830,9 +832,9 @@
var chkLockData = context.querySelector("#chkLockData"); var chkLockData = context.querySelector("#chkLockData");
chkLockData.checked = lockData; chkLockData.checked = lockData;
if (chkLockData.checked) { if (chkLockData.checked) {
hideElement('.providerSettingsContainer', context) hideElement('.providerSettingsContainer', context);
} else { } else {
showElement('.providerSettingsContainer', context) showElement('.providerSettingsContainer', context);
} }
populateInternetProviderSettings(context, item, item.LockedFields); populateInternetProviderSettings(context, item, item.LockedFields);
@ -957,7 +959,7 @@
ratings.push({ Name: rating.Name, Value: rating.Name }); ratings.push({ Name: rating.Name, Value: rating.Name });
if (rating.Name == currentValue) { if (rating.Name === currentValue) {
currentValueFound = true; currentValueFound = true;
} }
} }
@ -1037,7 +1039,7 @@
html += (person.Name || ''); html += (person.Name || '');
html += '</div>'; html += '</div>';
if (person.Role && person.Role != lastType) { if (person.Role && person.Role !== lastType) {
html += '<div class="secondary">' + (person.Role) + '</div>'; html += '<div class="secondary">' + (person.Role) + '</div>';
} }
@ -1060,7 +1062,7 @@
var field = fields[i]; var field = fields[i];
var name = field.name; var name = field.name;
var value = field.value || field.name; var value = field.value || field.name;
var checkedHtml = currentFields.indexOf(value) == -1 ? ' checked' : ''; var checkedHtml = currentFields.indexOf(value) === -1 ? ' checked' : '';
html += '<label>'; html += '<label>';
html += '<input type="checkbox" is="emby-checkbox" class="selectLockedField" data-value="' + value + '"' + checkedHtml + '/>'; html += '<input type="checkbox" is="emby-checkbox" class="selectLockedField" data-value="' + value + '"' + checkedHtml + '/>';
html += '<span>' + name + '</span>'; html += '<span>' + name + '</span>';
@ -1071,7 +1073,7 @@
function populateInternetProviderSettings(context, item, lockedFields) { function populateInternetProviderSettings(context, item, lockedFields) {
var container = context.querySelector('.providerSettingsContainer'); var container = context.querySelector('.providerSettingsContainer');
lockedFields = lockedFields || new Array(); lockedFields = lockedFields || [];
var metadatafields = [ var metadatafields = [
{ name: globalize.translate('sharedcomponents#Name'), value: "Name" }, { name: globalize.translate('sharedcomponents#Name'), value: "Name" },
@ -1081,13 +1083,13 @@
{ name: globalize.translate('sharedcomponents#People'), value: "Cast" } { name: globalize.translate('sharedcomponents#People'), value: "Cast" }
]; ];
if (item.Type == "Person") { if (item.Type === "Person") {
metadatafields.push({ name: globalize.translate('sharedcomponents#BirthLocation'), value: "ProductionLocations" }); metadatafields.push({ name: globalize.translate('sharedcomponents#BirthLocation'), value: "ProductionLocations" });
} else { } else {
metadatafields.push({ name: globalize.translate('sharedcomponents#ProductionLocations'), value: "ProductionLocations" }); metadatafields.push({ name: globalize.translate('sharedcomponents#ProductionLocations'), value: "ProductionLocations" });
} }
if (item.Type == "Series") { if (item.Type === "Series") {
metadatafields.push({ name: globalize.translate('Runtime'), value: "Runtime" }); metadatafields.push({ name: globalize.translate('Runtime'), value: "Runtime" });
} }
@ -1097,7 +1099,7 @@
metadatafields.push({ name: globalize.translate('sharedcomponents#Images'), value: "Images" }); metadatafields.push({ name: globalize.translate('sharedcomponents#Images'), value: "Images" });
metadatafields.push({ name: globalize.translate('sharedcomponents#Backdrops'), value: "Backdrops" }); metadatafields.push({ name: globalize.translate('sharedcomponents#Backdrops'), value: "Backdrops" });
if (item.Type == "Game") { if (item.Type === "Game") {
metadatafields.push({ name: globalize.translate('sharedcomponents#Screenshots'), value: "Screenshots" }); metadatafields.push({ name: globalize.translate('sharedcomponents#Screenshots'), value: "Screenshots" });
} }
@ -1133,13 +1135,13 @@
setFieldVisibilities(context, item); setFieldVisibilities(context, item);
fillItemInfo(context, item, metadataEditorInfo.ParentalRatingOptions); fillItemInfo(context, item, metadataEditorInfo.ParentalRatingOptions);
if (item.MediaType == "Video" && item.Type != "Episode") { if (item.MediaType === "Video" && item.Type !== "Episode") {
showElement('#fldShortOverview', context); showElement('#fldShortOverview', context);
} else { } else {
hideElement('#fldShortOverview', context); hideElement('#fldShortOverview', context);
} }
if (item.MediaType == "Video" && item.Type != "Episode") { if (item.MediaType === "Video" && item.Type !== "Episode") {
showElement('#fldTagline', context); showElement('#fldTagline', context);
} else { } else {
hideElement('#fldTagline', context); hideElement('#fldTagline', context);

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'layoutManager', 'globalize', 'require', 'paper-icon-button-light', 'emby-input', 'emby-select', 'css!./../formdialog'], function (dialogHelper, layoutManager, globalize, require) { define(['dialogHelper', 'layoutManager', 'globalize', 'require', 'paper-icon-button-light', 'emby-input', 'emby-select', 'css!./../formdialog'], function (dialogHelper, layoutManager, globalize, require) {
'use strict';
function centerFocus(elem, horiz, on) { function centerFocus(elem, horiz, on) {
require(['scrollHelper'], function (scrollHelper) { require(['scrollHelper'], function (scrollHelper) {
@ -59,7 +60,7 @@
dlg.querySelector('.selectPersonType').addEventListener('change', function (e) { dlg.querySelector('.selectPersonType').addEventListener('change', function (e) {
if (this.value == 'Actor') { if (this.value === 'Actor') {
dlg.querySelector('.fldRole').classList.remove('hide'); dlg.querySelector('.fldRole').classList.remove('hide');
} else { } else {
dlg.querySelector('.fldRole').classList.add('hide'); dlg.querySelector('.fldRole').classList.add('hide');

View file

@ -1,4 +1,4 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.multiDownload = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ define([], function () {
'use strict'; 'use strict';
function fallback(urls) { function fallback(urls) {
@ -48,7 +48,7 @@ function download(url) {
a.dispatchEvent(new MouseEvent('click')); a.dispatchEvent(new MouseEvent('click'));
} }
module.exports = function (urls) { return function (urls) {
if (!urls) { if (!urls) {
throw new Error('`urls` required'); throw new Error('`urls` required');
} }
@ -67,7 +67,5 @@ module.exports = function (urls) {
download(url); download(url);
}); });
} };
},{}]},{},[1])(1)
}); });

View file

@ -1,4 +1,5 @@
define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'globalize', 'embyRouter', 'dom', 'css!./multiselect'], function (browser, appStorage, appHost, loading, connectionManager, globalize, embyRouter, dom) { define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'globalize', 'embyRouter', 'dom', 'css!./multiselect'], function (browser, appStorage, appHost, loading, connectionManager, globalize, embyRouter, dom) {
'use strict';
var selectedItems = []; var selectedItems = [];
var selectedElements = []; var selectedElements = [];
@ -54,7 +55,7 @@
if (selected) { if (selected) {
var current = selectedItems.filter(function (i) { var current = selectedItems.filter(function (i) {
return i == id; return i === id;
}); });
if (!current.length) { if (!current.length) {
@ -64,10 +65,10 @@
} else { } else {
selectedItems = selectedItems.filter(function (i) { selectedItems = selectedItems.filter(function (i) {
return i != id; return i !== id;
}); });
selectedElements = selectedElements.filter(function (i) { selectedElements = selectedElements.filter(function (i) {
return i != chkItemSelect; return i !== chkItemSelect;
}); });
} }
@ -130,7 +131,7 @@
html += '<span class="itemSelectionCount"></span>'; html += '<span class="itemSelectionCount"></span>';
html += '</div>'; html += '</div>';
var moreIcon = appHost.moreIcon == 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;'; var moreIcon = appHost.moreIcon === 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
html += '<button is="paper-icon-button-light" class="btnSelectionPanelOptions autoSize" style="margin-left:auto;"><i class="md-icon">' + moreIcon + '</i></button>'; html += '<button is="paper-icon-button-light" class="btnSelectionPanelOptions autoSize" style="margin-left:auto;"><i class="md-icon">' + moreIcon + '</i></button>';
selectionCommandsPanel.innerHTML = html; selectionCommandsPanel.innerHTML = html;
@ -354,7 +355,7 @@
var container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer'); var container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer');
if (container && elems.indexOf(container) == -1) { if (container && elems.indexOf(container) === -1) {
elems.push(container); elems.push(container);
} }
}); });
@ -400,7 +401,7 @@
require(['emby-checkbox'], function () { require(['emby-checkbox'], function () {
var cards = document.querySelectorAll('.card'); var cards = document.querySelectorAll('.card');
for (var i = 0, length = cards.length; i < length; i++) { for (var i = 0, length = cards.length; i < length; i++) {
showSelection(cards[i], initialCard == cards[i]); showSelection(cards[i], initialCard === cards[i]);
} }
showSelectionCommands(); showSelectionCommands();

View file

@ -1,4 +1,5 @@
define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'require'], function (serverNotifications, playbackManager, events, globalize, require) { define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'require'], function (serverNotifications, playbackManager, events, globalize, require) {
'use strict';
function onOneDocumentClick() { function onOneDocumentClick() {
@ -171,18 +172,18 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
data: {} data: {}
}; };
if (status == 'completed') { if (status === 'completed') {
notification.title = globalize.translate('sharedcomponents#PackageInstallCompleted').replace('{0}', installation.Name + ' ' + installation.Version); notification.title = globalize.translate('sharedcomponents#PackageInstallCompleted').replace('{0}', installation.Name + ' ' + installation.Version);
notification.vibrate = true; notification.vibrate = true;
} }
else if (status == 'cancelled') { else if (status === 'cancelled') {
notification.title = globalize.translate('sharedcomponents#PackageInstallCancelled').replace('{0}', installation.Name + ' ' + installation.Version); notification.title = globalize.translate('sharedcomponents#PackageInstallCancelled').replace('{0}', installation.Name + ' ' + installation.Version);
} }
else if (status == 'failed') { else if (status === 'failed') {
notification.title = globalize.translate('sharedcomponents#PackageInstallFailed').replace('{0}', installation.Name + ' ' + installation.Version); notification.title = globalize.translate('sharedcomponents#PackageInstallFailed').replace('{0}', installation.Name + ' ' + installation.Version);
notification.vibrate = true; notification.vibrate = true;
} }
else if (status == 'progress') { else if (status === 'progress') {
notification.title = globalize.translate('sharedcomponents#InstallingPackage').replace('{0}', installation.Name + ' ' + installation.Version); notification.title = globalize.translate('sharedcomponents#InstallingPackage').replace('{0}', installation.Name + ' ' + installation.Version);
notification.actions = notification.actions =
@ -197,14 +198,14 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
notification.data.id = installation.id; notification.data.id = installation.id;
} }
if (status == 'progress') { if (status === 'progress') {
var percentComplete = Math.round(installation.PercentComplete || 0); var percentComplete = Math.round(installation.PercentComplete || 0);
notification.body = percentComplete + '% complete.'; notification.body = percentComplete + '% complete.';
} }
var timeout = status == 'cancelled' ? 5000 : 0; var timeout = status === 'cancelled' ? 5000 : 0;
showNotification(notification, timeout, apiClient); showNotification(notification, timeout, apiClient);
}); });

View file

@ -1,5 +1,7 @@
define([], function () { define([], function () {
'use strict';
/** /**
* Detect click event * Detect click event
*/ */
@ -123,7 +125,9 @@ define([], function () {
*/ */
page.base = function (path) { page.base = function (path) {
if (0 === arguments.length) return base; if (0 === arguments.length) {
return base;
}
base = path; base = path;
}; };
@ -142,17 +146,31 @@ define([], function () {
page.start = function (options) { page.start = function (options) {
options = options || {}; options = options || {};
if (running) return; if (running) {
return;
}
running = true; running = true;
if (false === options.dispatch) dispatch = false; if (false === options.dispatch) {
if (false === options.decodeURLComponents) decodeURLComponents = false; dispatch = false;
if (false !== options.popstate) window.addEventListener('popstate', onpopstate, false); }
if (false === options.decodeURLComponents) {
decodeURLComponents = false;
}
if (false !== options.popstate) {
window.addEventListener('popstate', onpopstate, false);
}
if (false !== options.click) { if (false !== options.click) {
document.addEventListener(clickEvent, onclick, false); document.addEventListener(clickEvent, onclick, false);
} }
if (options.enableHistory != null) enableHistory = options.enableHistory; if (options.enableHistory != null) {
if (true === options.hashbang) hashbang = true; enableHistory = options.enableHistory;
if (!dispatch) return; }
if (true === options.hashbang) {
hashbang = true;
}
if (!dispatch) {
return;
}
var url = (hashbang && ~location.hash.indexOf('#!')) ? location.hash.substr(2) + location.search : location.pathname + location.search + location.hash; var url = (hashbang && ~location.hash.indexOf('#!')) ? location.hash.substr(2) + location.search : location.pathname + location.search + location.hash;
page.replace(url, null, true, dispatch); page.replace(url, null, true, dispatch);
}; };
@ -164,7 +182,9 @@ define([], function () {
*/ */
page.stop = function () { page.stop = function () {
if (!running) return; if (!running) {
return;
}
page.current = ''; page.current = '';
page.len = 0; page.len = 0;
running = false; running = false;
@ -186,8 +206,12 @@ define([], function () {
var ctx = new Context(path, state); var ctx = new Context(path, state);
ctx.isBack = isBack; ctx.isBack = isBack;
page.current = ctx.path; page.current = ctx.path;
if (false !== dispatch) page.dispatch(ctx); if (false !== dispatch) {
if (false !== ctx.handled && false !== push) ctx.pushState(); page.dispatch(ctx);
}
if (false !== ctx.handled && false !== push) {
ctx.pushState();
}
return ctx; return ctx;
}; };
@ -286,7 +310,9 @@ define([], function () {
page.current = ctx.path; page.current = ctx.path;
ctx.init = init; ctx.init = init;
ctx.save(); // save before dispatching, which may redirect ctx.save(); // save before dispatching, which may redirect
if (false !== dispatch) page.dispatch(ctx); if (false !== dispatch) {
page.dispatch(ctx);
}
return ctx; return ctx;
}; };
@ -306,7 +332,9 @@ define([], function () {
function nextExit() { function nextExit() {
var fn = page.exits[j++]; var fn = page.exits[j++];
if (!fn) return nextEnter(); if (!fn) {
return nextEnter();
}
fn(prev, nextExit); fn(prev, nextExit);
} }
@ -317,7 +345,9 @@ define([], function () {
ctx.handled = false; ctx.handled = false;
return; return;
} }
if (!fn) return unhandled(ctx); if (!fn) {
return unhandled(ctx);
}
fn(ctx, nextEnter); fn(ctx, nextEnter);
} }
@ -338,7 +368,9 @@ define([], function () {
*/ */
function unhandled(ctx) { function unhandled(ctx) {
if (ctx.handled) return; if (ctx.handled) {
return;
}
var current; var current;
if (hashbang) { if (hashbang) {
@ -347,7 +379,9 @@ define([], function () {
current = location.pathname + location.search; current = location.pathname + location.search;
} }
if (current === ctx.canonicalPath) return; if (current === ctx.canonicalPath) {
return;
}
page.stop(); page.stop();
ctx.handled = false; ctx.handled = false;
location.href = ctx.canonicalPath; location.href = ctx.canonicalPath;
@ -392,12 +426,16 @@ define([], function () {
*/ */
function Context(path, state) { function Context(path, state) {
if ('/' === path[0] && 0 !== path.indexOf(base)) path = base + (hashbang ? '#!' : '') + path; if ('/' === path[0] && 0 !== path.indexOf(base)) {
path = base + (hashbang ? '#!' : '') + path;
}
var i = path.indexOf('?'); var i = path.indexOf('?');
this.canonicalPath = path; this.canonicalPath = path;
this.path = path.replace(base, '') || '/'; this.path = path.replace(base, '') || '/';
if (hashbang) this.path = this.path.replace('#!', '') || '/'; if (hashbang) {
this.path = this.path.replace('#!', '') || '/';
}
this.title = document.title; this.title = document.title;
this.state = state || {}; this.state = state || {};
@ -409,7 +447,9 @@ define([], function () {
// fragment // fragment
this.hash = ''; this.hash = '';
if (!hashbang) { if (!hashbang) {
if (!~this.path.indexOf('#')) return; if (!~this.path.indexOf('#')) {
return;
}
var parts = this.path.split('#'); var parts = this.path.split('#');
this.path = parts[0]; this.path = parts[0];
this.hash = decodeURLEncodedURIComponent(parts[1]) || ''; this.hash = decodeURLEncodedURIComponent(parts[1]) || '';
@ -507,7 +547,9 @@ define([], function () {
Route.prototype.middleware = function (fn) { Route.prototype.middleware = function (fn) {
var self = this; var self = this;
return function (ctx, next) { return function (ctx, next) {
if (self.match(ctx.path, ctx.params)) return fn(ctx, next); if (self.match(ctx.path, ctx.params)) {
return fn(ctx, next);
}
next(); next();
}; };
}; };
@ -528,7 +570,9 @@ define([], function () {
pathname = ~qsIndex ? path.slice(0, qsIndex) : path, pathname = ~qsIndex ? path.slice(0, qsIndex) : path,
m = this.regexp.exec(decodeURIComponent(pathname)); m = this.regexp.exec(decodeURIComponent(pathname));
if (!m) return false; if (!m) {
return false;
}
for (var i = 1, len = m.length; i < len; ++i) { for (var i = 1, len = m.length; i < len; ++i) {
var key = keys[i - 1]; var key = keys[i - 1];
@ -587,8 +631,12 @@ define([], function () {
}); });
} }
return function onpopstate(e) { return function onpopstate(e) {
if (!loaded) return; if (!loaded) {
if (ignorePopState(e)) return; return;
}
if (ignorePopState(e)) {
return;
}
if (e.state) { if (e.state) {
var path = e.state.path; var path = e.state.path;
page.replace(path, e.state, null, null, true); page.replace(path, e.state, null, null, true);
@ -603,43 +651,63 @@ define([], function () {
function onclick(e) { function onclick(e) {
if (1 !== which(e)) return; if (1 !== which(e)) {
return;
}
if (e.metaKey || e.ctrlKey || e.shiftKey) return; if (e.metaKey || e.ctrlKey || e.shiftKey) {
if (e.defaultPrevented) return; return;
}
if (e.defaultPrevented) {
return;
}
// ensure link // ensure link
var el = e.target; var el = e.target;
while (el && 'A' !== el.nodeName) el = el.parentNode; while (el && 'A' !== el.nodeName) {
if (!el || 'A' !== el.nodeName) return; el = el.parentNode;
}
if (!el || 'A' !== el.nodeName) {
return;
}
// Ignore if tag has // Ignore if tag has
// 1. "download" attribute // 1. "download" attribute
// 2. rel="external" attribute // 2. rel="external" attribute
if (el.hasAttribute('download') || el.getAttribute('rel') === 'external') return; if (el.hasAttribute('download') || el.getAttribute('rel') === 'external') {
return;
}
// ensure non-hash for the same path // ensure non-hash for the same path
var link = el.getAttribute('href'); var link = el.getAttribute('href');
if (link == '#') { if (link === '#') {
e.preventDefault(); e.preventDefault();
return; return;
} }
if (!hashbang && el.pathname === location.pathname && (el.hash || '#' === link)) return; if (!hashbang && el.pathname === location.pathname && (el.hash || '#' === link)) {
return;
}
// Check for mailto: in the href // Check for mailto: in the href
if (link && link.indexOf('mailto:') > -1) return; if (link && link.indexOf('mailto:') > -1) {
return;
}
// check target // check target
if (el.target) return; if (el.target) {
return;
}
// x-origin // x-origin
if (!sameOrigin(el.href)) return; if (!sameOrigin(el.href)) {
return;
}
@ -653,9 +721,13 @@ define([], function () {
path = path.substr(base.length); path = path.substr(base.length);
} }
if (hashbang) path = path.replace('#!', ''); if (hashbang) {
path = path.replace('#!', '');
}
if (base && orig === path) return; if (base && orig === path) {
return;
}
e.preventDefault(); e.preventDefault();
page.show(orig); page.show(orig);
@ -676,7 +748,9 @@ define([], function () {
function sameOrigin(href) { function sameOrigin(href) {
var origin = location.protocol + '//' + location.hostname; var origin = location.protocol + '//' + location.hostname;
if (location.port) origin += ':' + location.port; if (location.port) {
origin += ':' + location.port;
}
return (href && (0 === href.indexOf(origin))); return (href && (0 === href.indexOf(origin)));
} }
@ -698,7 +772,7 @@ define([], function () {
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"] // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))' '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))'
].join('|'), 'g') ].join('|'), 'g');
/** /**
* Parse a string for the raw tokens. * Parse a string for the raw tokens.
@ -707,42 +781,42 @@ define([], function () {
* @return {Array} * @return {Array}
*/ */
function parse(str) { function parse(str) {
var tokens = [] var tokens = [];
var key = 0 var key = 0;
var index = 0 var index = 0;
var path = '' var path = '';
var res var res;
while ((res = PATH_REGEXP.exec(str)) != null) { while ((res = PATH_REGEXP.exec(str)) != null) {
var m = res[0] var m = res[0];
var escaped = res[1] var escaped = res[1];
var offset = res.index var offset = res.index;
path += str.slice(index, offset) path += str.slice(index, offset);
index = offset + m.length index = offset + m.length;
// Ignore already escaped sequences. // Ignore already escaped sequences.
if (escaped) { if (escaped) {
path += escaped[1] path += escaped[1];
continue continue;
} }
// Push the current path onto the tokens. // Push the current path onto the tokens.
if (path) { if (path) {
tokens.push(path) tokens.push(path);
path = '' path = '';
} }
var prefix = res[2] var prefix = res[2];
var name = res[3] var name = res[3];
var capture = res[4] var capture = res[4];
var group = res[5] var group = res[5];
var suffix = res[6] var suffix = res[6];
var asterisk = res[7] var asterisk = res[7];
var repeat = suffix === '+' || suffix === '*' var repeat = suffix === '+' || suffix === '*';
var optional = suffix === '?' || suffix === '*' var optional = suffix === '?' || suffix === '*';
var delimiter = prefix || '/' var delimiter = prefix || '/';
var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?') var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?');
tokens.push({ tokens.push({
name: name || key++, name: name || key++,
@ -751,24 +825,24 @@ define([], function () {
optional: optional, optional: optional,
repeat: repeat, repeat: repeat,
pattern: escapeGroup(pattern) pattern: escapeGroup(pattern)
}) });
} }
// Match any characters still remaining. // Match any characters still remaining.
if (index < str.length) { if (index < str.length) {
path += str.substr(index) path += str.substr(index);
} }
// If the path exists, push it onto the end. // If the path exists, push it onto the end.
if (path) { if (path) {
tokens.push(path) tokens.push(path);
} }
return tokens return tokens;
} }
var isarray = Array.isArray || function (arr) { var isarray = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]'; return Object.prototype.toString.call(arr) === '[object Array]';
}; };
/** /**
@ -778,7 +852,7 @@ define([], function () {
* @return {String} * @return {String}
*/ */
function escapeString(str) { function escapeString(str) {
return str.replace(/([.+*?=^!:${}()[\]|\/])/g, '\\$1') return str.replace(/([.+*?=^!:${}()[\]|\/])/g, '\\$1');
} }
/** /**
@ -788,7 +862,7 @@ define([], function () {
* @return {String} * @return {String}
*/ */
function escapeGroup(group) { function escapeGroup(group) {
return group.replace(/([=!:$\/()])/g, '\\$1') return group.replace(/([=!:$\/()])/g, '\\$1');
} }
/** /**
@ -799,8 +873,8 @@ define([], function () {
* @return {RegExp} * @return {RegExp}
*/ */
function attachKeys(re, keys) { function attachKeys(re, keys) {
re.keys = keys re.keys = keys;
return re return re;
} }
/** /**
@ -810,7 +884,7 @@ define([], function () {
* @return {String} * @return {String}
*/ */
function flags(options) { function flags(options) {
return options.sensitive ? '' : 'i' return options.sensitive ? '' : 'i';
} }
/** /**
@ -822,7 +896,7 @@ define([], function () {
*/ */
function regexpToRegexp(path, keys) { function regexpToRegexp(path, keys) {
// Use a negative lookahead to match only capturing groups. // Use a negative lookahead to match only capturing groups.
var groups = path.source.match(/\((?!\?)/g) var groups = path.source.match(/\((?!\?)/g);
if (groups) { if (groups) {
for (var i = 0; i < groups.length; i++) { for (var i = 0; i < groups.length; i++) {
@ -833,11 +907,11 @@ define([], function () {
optional: false, optional: false,
repeat: false, repeat: false,
pattern: null pattern: null
}) });
} }
} }
return attachKeys(path, keys) return attachKeys(path, keys);
} }
/** /**
@ -849,15 +923,15 @@ define([], function () {
* @return {RegExp} * @return {RegExp}
*/ */
function arrayToRegexp(path, keys, options) { function arrayToRegexp(path, keys, options) {
var parts = [] var parts = [];
for (var i = 0; i < path.length; i++) { for (var i = 0; i < path.length; i++) {
parts.push(pathToRegexp(path[i], keys, options).source) parts.push(pathToRegexp(path[i], keys, options).source);
} }
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)) var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
return attachKeys(regexp, keys) return attachKeys(regexp, keys);
} }
/** /**
@ -869,17 +943,17 @@ define([], function () {
* @return {RegExp} * @return {RegExp}
*/ */
function stringToRegexp(path, keys, options) { function stringToRegexp(path, keys, options) {
var tokens = parse(path) var tokens = parse(path);
var re = tokensToRegExp(tokens, options) var re = tokensToRegExp(tokens, options);
// Attach keys back to the regexp. // Attach keys back to the regexp.
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
if (typeof tokens[i] !== 'string') { if (typeof tokens[i] !== 'string') {
keys.push(tokens[i]) keys.push(tokens[i]);
} }
} }
return attachKeys(re, keys) return attachKeys(re, keys);
} }
/** /**
@ -891,39 +965,39 @@ define([], function () {
* @return {RegExp} * @return {RegExp}
*/ */
function tokensToRegExp(tokens, options) { function tokensToRegExp(tokens, options) {
options = options || {} options = options || {};
var strict = options.strict var strict = options.strict;
var end = options.end !== false var end = options.end !== false;
var route = '' var route = '';
var lastToken = tokens[tokens.length - 1] var lastToken = tokens[tokens.length - 1];
var endsWithSlash = typeof lastToken === 'string' && /\/$/.test(lastToken) var endsWithSlash = typeof lastToken === 'string' && /\/$/.test(lastToken);
// Iterate over the tokens and create our regexp string. // Iterate over the tokens and create our regexp string.
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
var token = tokens[i] var token = tokens[i];
if (typeof token === 'string') { if (typeof token === 'string') {
route += escapeString(token) route += escapeString(token);
} else { } else {
var prefix = escapeString(token.prefix) var prefix = escapeString(token.prefix);
var capture = token.pattern var capture = token.pattern;
if (token.repeat) { if (token.repeat) {
capture += '(?:' + prefix + capture + ')*' capture += '(?:' + prefix + capture + ')*';
} }
if (token.optional) { if (token.optional) {
if (prefix) { if (prefix) {
capture = '(?:' + prefix + '(' + capture + '))?' capture = '(?:' + prefix + '(' + capture + '))?';
} else { } else {
capture = '(' + capture + ')?' capture = '(' + capture + ')?';
} }
} else { } else {
capture = prefix + '(' + capture + ')' capture = prefix + '(' + capture + ')';
} }
route += capture route += capture;
} }
} }
@ -932,18 +1006,18 @@ define([], function () {
// is valid at the end of a path match, not in the middle. This is important // is valid at the end of a path match, not in the middle. This is important
// in non-ending mode, where "/test/" shouldn't match "/test//route". // in non-ending mode, where "/test/" shouldn't match "/test//route".
if (!strict) { if (!strict) {
route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?' route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?';
} }
if (end) { if (end) {
route += '$' route += '$';
} else { } else {
// In non-ending mode, we need the capturing groups to match as much as // In non-ending mode, we need the capturing groups to match as much as
// possible by using a positive lookahead to the end or next path segment. // possible by using a positive lookahead to the end or next path segment.
route += strict && endsWithSlash ? '' : '(?=\\/|$)' route += strict && endsWithSlash ? '' : '(?=\\/|$)';
} }
return new RegExp('^' + route, flags(options)) return new RegExp('^' + route, flags(options));
} }
/** /**
@ -959,24 +1033,24 @@ define([], function () {
* @return {RegExp} * @return {RegExp}
*/ */
function pathToRegexp(path, keys, options) { function pathToRegexp(path, keys, options) {
keys = keys || [] keys = keys || [];
if (!isarray(keys)) { if (!isarray(keys)) {
options = keys options = keys;
keys = [] keys = [];
} else if (!options) { } else if (!options) {
options = {} options = {};
} }
if (path instanceof RegExp) { if (path instanceof RegExp) {
return regexpToRegexp(path, keys, options) return regexpToRegexp(path, keys, options);
} }
if (isarray(path)) { if (isarray(path)) {
return arrayToRegexp(path, keys, options) return arrayToRegexp(path, keys, options);
} }
return stringToRegexp(path, keys, options) return stringToRegexp(path, keys, options);
} }
return page; return page;

View file

@ -1,4 +1,5 @@
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'userSettings', 'embyRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, userSettings, embyRouter, globalize) { define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'userSettings', 'embyRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, userSettings, embyRouter, globalize) {
'use strict';
var currentServerId; var currentServerId;

View file

@ -1,4 +1,5 @@
define(['actionsheet', 'datetime', 'playbackManager', 'globalize', 'appSettings'], function (actionsheet, datetime, playbackManager, globalize, appSettings) { define(['actionsheet', 'datetime', 'playbackManager', 'globalize', 'appSettings'], function (actionsheet, datetime, playbackManager, globalize, appSettings) {
'use strict';
var isMobileApp = window.Dashboard != null; var isMobileApp = window.Dashboard != null;
@ -14,10 +15,10 @@ define(['actionsheet', 'datetime', 'playbackManager', 'globalize', 'appSettings'
var serverId = item.ServerId; var serverId = item.ServerId;
var resumePositionTicks = item.UserData ? item.UserData.PlaybackPositionTicks : null; var resumePositionTicks = item.UserData ? item.UserData.PlaybackPositionTicks : null;
var showExternalPlayer = isMobileApp && mediaType == 'Video' && !isFolder && appSettings.enableExternalPlayers(); var showExternalPlayer = isMobileApp && mediaType === 'Video' && !isFolder && appSettings.enableExternalPlayers();
var playableItemId = itemType == 'Program' ? channelId : itemId; var playableItemId = itemType === 'Program' ? channelId : itemId;
if (!resumePositionTicks && mediaType != "Audio" && !isFolder && !showExternalPlayer) { if (!resumePositionTicks && mediaType !== "Audio" && !isFolder && !showExternalPlayer) {
playbackManager.play({ playbackManager.play({
ids: [playableItemId], ids: [playableItemId],
serverId: serverId serverId: serverId
@ -58,14 +59,14 @@ define(['actionsheet', 'datetime', 'playbackManager', 'globalize', 'appSettings'
}); });
} }
if (itemType == "Audio" || itemType == "MusicAlbum" || itemType == "MusicArtist" || itemType == "MusicGenre") { if (itemType === "Audio" || itemType === "MusicAlbum" || itemType === "MusicArtist" || itemType === "MusicGenre") {
menuItems.push({ menuItems.push({
name: globalize.translate('sharedcomponents#InstantMix'), name: globalize.translate('sharedcomponents#InstantMix'),
id: 'instantmix' id: 'instantmix'
}); });
} }
if (isFolder || itemType == "MusicArtist" || itemType == "MusicGenre") { if (isFolder || itemType === "MusicArtist" || itemType === "MusicGenre") {
menuItems.push({ menuItems.push({
name: globalize.translate('sharedcomponents#Shuffle'), name: globalize.translate('sharedcomponents#Shuffle'),
id: 'shuffle' id: 'shuffle'

View file

@ -1,4 +1,5 @@
define([], function () { define([], function () {
'use strict';
function replaceAll(str, find, replace) { function replaceAll(str, find, replace) {

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle'], function (dialogHelper, layoutManager, scrollHelper, globalize, dom, require) { define(['dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle'], function (dialogHelper, layoutManager, scrollHelper, globalize, dom, require) {
'use strict';
function setInputProperties(dlg, options) { function setInputProperties(dlg, options) {
var txtInput = dlg.querySelector('#txtInput'); var txtInput = dlg.querySelector('#txtInput');

View file

@ -1,4 +1,5 @@
define([], function () { define([], function () {
'use strict';
function getVideoQualityOptions(maxStreamingBitrate, videoWidth) { function getVideoQualityOptions(maxStreamingBitrate, videoWidth) {
@ -60,12 +61,12 @@
var option = options[i]; var option = options[i];
if (selectedIndex == -1 && option.bitrate <= maxStreamingBitrate) { if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i; selectedIndex = i;
} }
} }
if (selectedIndex == -1) { if (selectedIndex === -1) {
selectedIndex = options.length - 1; selectedIndex = options.length - 1;
} }
@ -74,7 +75,7 @@
} }
return options; return options;
}; }
return { return {
getVideoQualityOptions: getVideoQualityOptions getVideoQualityOptions: getVideoQualityOptions

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'datetime', 'imageLoader', 'recordingFields', 'events', 'emby-checkbox', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, datetime, imageLoader, recordingFields, events) { define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'datetime', 'imageLoader', 'recordingFields', 'events', 'emby-checkbox', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, datetime, imageLoader, recordingFields, events) {
'use strict';
var currentDialog; var currentDialog;
var closeAction; var closeAction;
@ -110,7 +111,7 @@
function executeCloseAction(action, programId, serverId) { function executeCloseAction(action, programId, serverId) {
if (action == 'play') { if (action === 'play') {
require(['playbackManager'], function (playbackManager) { require(['playbackManager'], function (playbackManager) {

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'scrollStyles', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader) { define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'scrollStyles', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader) {
'use strict';
var currentDialog; var currentDialog;
var recordingDeleted = false; var recordingDeleted = false;

View file

@ -1,4 +1,5 @@
define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'registrationServices', 'paper-icon-button-light', 'emby-button'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events, registrationServices) { define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'registrationServices', 'paper-icon-button-light', 'emby-button'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events, registrationServices) {
'use strict';
function getRegistration(apiClient, programId, feature) { function getRegistration(apiClient, programId, feature) {
@ -114,7 +115,7 @@
parent.querySelector('.seriesRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#RecordSeries'); parent.querySelector('.seriesRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#RecordSeries');
} }
if (program.TimerId && program.Status != 'Cancelled') { if (program.TimerId && program.Status !== 'Cancelled') {
parent.querySelector('.btnManageRecording').classList.remove('visibilityHide'); parent.querySelector('.btnManageRecording').classList.remove('visibilityHide');
parent.querySelector('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active'); parent.querySelector('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active');
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#DoNotRecord'); parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#DoNotRecord');
@ -142,7 +143,7 @@
}); });
} }
function recordingEditor(options) { function RecordingEditor(options) {
this.options = options; this.options = options;
this.embed(); this.embed();
} }
@ -155,7 +156,7 @@
var options = this.options; var options = this.options;
if (!this.TimerId || this.Status == 'Cancelled') { if (!this.TimerId || this.Status === 'Cancelled') {
return; return;
} }
@ -206,7 +207,7 @@
var button = dom.parentWithTag(e.target, 'BUTTON'); var button = dom.parentWithTag(e.target, 'BUTTON');
var isChecked = !button.querySelector('i').classList.contains('recordingIcon-active'); var isChecked = !button.querySelector('i').classList.contains('recordingIcon-active');
var hasEnabledTimer = this.TimerId && this.Status != 'Cancelled'; var hasEnabledTimer = this.TimerId && this.Status !== 'Cancelled';
if (isChecked) { if (isChecked) {
if (!hasEnabledTimer) { if (!hasEnabledTimer) {
@ -272,7 +273,7 @@
} }
} }
recordingEditor.prototype.embed = function () { RecordingEditor.prototype.embed = function () {
var self = this; var self = this;
@ -299,19 +300,19 @@
}); });
}; };
recordingEditor.prototype.hasChanged = function () { RecordingEditor.prototype.hasChanged = function () {
return this.changed; return this.changed;
}; };
recordingEditor.prototype.refresh = function () { RecordingEditor.prototype.refresh = function () {
fetchData(this); fetchData(this);
}; };
recordingEditor.prototype.destroy = function () { RecordingEditor.prototype.destroy = function () {
}; };
return recordingEditor; return RecordingEditor;
}); });

View file

@ -1,4 +1,5 @@
define(['globalize', 'loading'], function (globalize, loading) { define(['globalize', 'loading'], function (globalize, loading) {
'use strict';
function changeRecordingToSeries(apiClient, timerId, programId) { function changeRecordingToSeries(apiClient, timerId, programId) {
@ -129,7 +130,7 @@
var apiClient = connectionManager.getApiClient(serverId); var apiClient = connectionManager.getApiClient(serverId);
var hasTimer = timerId && timerStatus != 'Cancelled'; var hasTimer = timerId && timerStatus !== 'Cancelled';
if (seriesTimerId && hasTimer) { if (seriesTimerId && hasTimer) {

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'datetime', 'scrollStyles', 'emby-button', 'emby-checkbox', 'emby-input', 'emby-select', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader, datetime) { define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'datetime', 'scrollStyles', 'emby-button', 'emby-checkbox', 'emby-input', 'emby-select', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader, datetime) {
'use strict';
var currentDialog; var currentDialog;
var recordingUpdated = false; var recordingUpdated = false;
@ -60,9 +61,9 @@
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60; item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
item.PostPaddingSeconds = form.querySelector('#txtPostPaddingMinutes').value * 60; item.PostPaddingSeconds = form.querySelector('#txtPostPaddingMinutes').value * 60;
item.RecordAnyChannel = form.querySelector('.selectChannels').value == 'all'; item.RecordAnyChannel = form.querySelector('.selectChannels').value === 'all';
item.RecordAnyTime = form.querySelector('.selectAirTime').value == 'any'; item.RecordAnyTime = form.querySelector('.selectAirTime').value === 'any';
item.RecordNewOnly = form.querySelector('.selectShowType').value == 'new'; item.RecordNewOnly = form.querySelector('.selectShowType').value === 'new';
item.SkipEpisodesInLibrary = form.querySelector('.chkSkipEpisodesInLibrary').checked; item.SkipEpisodesInLibrary = form.querySelector('.chkSkipEpisodesInLibrary').checked;
item.KeepUpTo = form.querySelector('.selectKeepUpTo').value; item.KeepUpTo = form.querySelector('.selectKeepUpTo').value;
@ -116,9 +117,9 @@
var text; var text;
if (i == 0) { if (i === 0) {
text = globalize.translate('sharedcomponents#AsManyAsPossible'); text = globalize.translate('sharedcomponents#AsManyAsPossible');
} else if (i == 1) { } else if (i === 1) {
text = globalize.translate('sharedcomponents#ValueOneEpisode'); text = globalize.translate('sharedcomponents#ValueOneEpisode');
} else { } else {
text = globalize.translate('sharedcomponents#ValueEpisodeCount', i); text = globalize.translate('sharedcomponents#ValueEpisodeCount', i);

View file

@ -1,4 +1,5 @@
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'embyRouter', 'globalize', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, embyRouter, globalize) { define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'embyRouter', 'globalize', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, embyRouter, globalize) {
'use strict';
function parentWithClass(elem, className) { function parentWithClass(elem, className) {
@ -71,7 +72,7 @@
var apiClient = connectionManager.getApiClient(options.serverId); var apiClient = connectionManager.getApiClient(options.serverId);
var replaceAllImages = dlg.querySelector('.chkReplaceImages').checked; var replaceAllImages = dlg.querySelector('.chkReplaceImages').checked;
var replaceAllMetadata = dlg.querySelector('#selectMetadataRefreshMode').value == 'all'; var replaceAllMetadata = dlg.querySelector('#selectMetadataRefreshMode').value === 'all';
options.itemIds.forEach(function (itemId) { options.itemIds.forEach(function (itemId) {
apiClient.refreshItem(itemId, { apiClient.refreshItem(itemId, {

View file

@ -1,4 +1,5 @@
define(['appSettings', 'loading', 'apphost', 'iapManager', 'events', 'shell', 'globalize', 'dialogHelper', 'connectionManager', 'layoutManager', 'emby-button'], function (appSettings, loading, appHost, iapManager, events, shell, globalize, dialogHelper, connectionManager, layoutManager) { define(['appSettings', 'loading', 'apphost', 'iapManager', 'events', 'shell', 'globalize', 'dialogHelper', 'connectionManager', 'layoutManager', 'emby-button'], function (appSettings, loading, appHost, iapManager, events, shell, globalize, dialogHelper, connectionManager, layoutManager) {
'use strict';
var currentDisplayingProductInfos = []; var currentDisplayingProductInfos = [];
var currentDisplayingResolve = null; var currentDisplayingResolve = null;
@ -157,7 +158,7 @@
}, function () { }, function () {
var unlockableFeatureCacheKey = 'featurepurchased-' + feature; var unlockableFeatureCacheKey = 'featurepurchased-' + feature;
if (appSettings.get(unlockableFeatureCacheKey) == '1') { if (appSettings.get(unlockableFeatureCacheKey) === '1') {
return Promise.resolve(); return Promise.resolve();
} }
@ -173,7 +174,7 @@
return Promise.resolve(); return Promise.resolve();
} }
if (appSettings.get(unlockableCacheKey) == '1') { if (appSettings.get(unlockableCacheKey) === '1') {
return Promise.resolve(); return Promise.resolve();
} }
} }
@ -318,7 +319,7 @@
html += '</div>'; html += '</div>';
} }
if (dialogOptions.feature == 'playback') { if (dialogOptions.feature === 'playback') {
html += '<p>'; html += '<p>';
html += '<button is="emby-button" type="button" class="raised button-cancel block btnCloseDialog"><span>' + globalize.translate('sharedcomponents#ButtonPlayOneMinute') + '</span></button>'; html += '<button is="emby-button" type="button" class="raised button-cancel block btnCloseDialog"><span>' + globalize.translate('sharedcomponents#ButtonPlayOneMinute') + '</span></button>';
html += '</p>'; html += '</p>';
@ -356,7 +357,7 @@
dialogHelper.close(dlg); dialogHelper.close(dlg);
}; };
if (dialogOptions.feature == 'playback') { if (dialogOptions.feature === 'playback') {
alertText({ alertText({
text: globalize.translate('sharedcomponents#ThankYouForTryingEnjoyOneMinute'), text: globalize.translate('sharedcomponents#ThankYouForTryingEnjoyOneMinute'),
title: globalize.translate('sharedcomponents#HeaderTryPlayback') title: globalize.translate('sharedcomponents#HeaderTryPlayback')
@ -475,7 +476,7 @@
var featureId = this.getAttribute('data-featureid'); var featureId = this.getAttribute('data-featureid');
if (this.getAttribute('data-email') == 'true') { if (this.getAttribute('data-email') === 'true') {
getUserEmail().then(function (email) { getUserEmail().then(function (email) {
iapManager.beginPurchase(featureId, email); iapManager.beginPurchase(featureId, email);
}); });
@ -595,7 +596,7 @@
if (resolve && currentDisplayingProductInfos.filter(function (p) { if (resolve && currentDisplayingProductInfos.filter(function (p) {
return product.id == p.id; return product.id === p.id;
}).length) { }).length) {

View file

@ -1,17 +1,20 @@
define(function () { define(function () {
'use strict';
var requireCss = {}; var requireCss = {};
requireCss.normalize = function (name, normalize) { requireCss.normalize = function (name, normalize) {
if (name.substr(name.length - 4, 4) == '.css') if (name.substr(name.length - 4, 4) === '.css') {
name = name.substr(0, name.length - 4); name = name.substr(0, name.length - 4);
}
return normalize(name); return normalize(name);
} };
var importedCss = []; var importedCss = [];
function isLoaded(url) { function isLoaded(url) {
return importedCss.indexOf(url) != -1; return importedCss.indexOf(url) !== -1;
} }
function removeFromLoadHistory(url) { function removeFromLoadHistory(url) {
@ -19,7 +22,7 @@ define(function () {
url = url.toLowerCase(); url = url.toLowerCase();
importedCss = importedCss.filter(function (c) { importedCss = importedCss.filter(function (c) {
return url.indexOf(c.toLowerCase()) == -1; return url.indexOf(c.toLowerCase()) === -1;
}); });
} }
@ -29,13 +32,13 @@ define(function () {
var srch = '/emby-webcomponents/require/requirecss'; var srch = '/emby-webcomponents/require/requirecss';
var index = cssId.indexOf(srch); var index = cssId.indexOf(srch);
if (index != -1) { if (index !== -1) {
cssId = 'css' + cssId.substring(index + srch.length); cssId = 'css' + cssId.substring(index + srch.length);
} }
var url = cssId + '.css'; var url = cssId + '.css';
if (url.indexOf('://') == -1) { if (url.indexOf('://') === -1) {
url = config.baseUrl + url; url = config.baseUrl + url;
} }
@ -58,7 +61,7 @@ define(function () {
} else { } else {
load(); load();
} }
} };
window.requireCss = { window.requireCss = {
removeStylesheet: function (stylesheet) { removeStylesheet: function (stylesheet) {

View file

@ -1,4 +1,5 @@
define(function () { define(function () {
'use strict';
var importedFiles = []; var importedFiles = [];
@ -11,18 +12,18 @@ define(function () {
var url = cssId + '.html'; var url = cssId + '.html';
if (url.indexOf('://') == -1) { if (url.indexOf('://') === -1) {
url = config.baseUrl + url; url = config.baseUrl + url;
} }
if (importedFiles.indexOf(url) == -1) { if (importedFiles.indexOf(url) === -1) {
importedFiles.push(url); importedFiles.push(url);
var link = document.createElement('link'); var link = document.createElement('link');
link.rel = 'import'; link.rel = 'import';
if (config.urlArgs) { if (config.urlArgs) {
if (url.toLowerCase().indexOf('bower_') == -1 || url.toLowerCase().indexOf('emby-webcomponents') != -1) { if (url.toLowerCase().indexOf('bower_') === -1 || url.toLowerCase().indexOf('emby-webcomponents') !== -1) {
url = url + config.urlArgs(cssId, url); url = url + config.urlArgs(cssId, url);
} }
} }
@ -39,8 +40,9 @@ define(function () {
}, },
normalize: function (name, normalize) { normalize: function (name, normalize) {
if (name.substr(name.length - 5, 5) == '.html') if (name.substr(name.length - 5, 5) === '.html') {
name = name.substr(0, name.length - 5); name = name.substr(0, name.length - 5);
}
return normalize(name); return normalize(name);
} }

View file

@ -1,10 +1,11 @@
define(function () { define(function () {
'use strict';
return { return {
load: function (url, req, load, config) { load: function (url, req, load, config) {
if (url.indexOf('://') == -1) { if (url.indexOf('://') === -1) {
url = config.baseUrl + url; url = config.baseUrl + url;
} }

View file

@ -1,4 +1,5 @@
define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'browser', 'pageJs', 'appSettings', 'apphost'], function (loading, dom, viewManager, skinManager, pluginManager, backdrop, browser, page, appSettings, appHost) { define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'browser', 'pageJs', 'appSettings', 'apphost'], function (loading, dom, viewManager, skinManager, pluginManager, backdrop, browser, page, appSettings, appHost) {
'use strict';
var embyRouter = { var embyRouter = {
showLocalLogin: function (apiClient, serverId, manualLogin) { showLocalLogin: function (apiClient, serverId, manualLogin) {
@ -108,10 +109,10 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var url = route.contentPath || route.path; var url = route.contentPath || route.path;
if (url.indexOf('://') == -1) { if (url.indexOf('://') === -1) {
// Put a slash at the beginning but make sure to avoid a double slash // Put a slash at the beginning but make sure to avoid a double slash
if (url.indexOf('/') != 0) { if (url.indexOf('/') !== 0) {
url = '/' + url; url = '/' + url;
} }
@ -162,7 +163,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var currentViewLoadRequest; var currentViewLoadRequest;
function sendRouteToViewManager(ctx, next, route, controllerFactory) { function sendRouteToViewManager(ctx, next, route, controllerFactory) {
if (isDummyBackToHome && route.type == 'home') { if (isDummyBackToHome && route.type === 'home') {
isDummyBackToHome = false; isDummyBackToHome = false;
return; return;
} }
@ -198,7 +199,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
if (!isBackNav) { if (!isBackNav) {
// Don't force a new view for home due to the back menu // Don't force a new view for home due to the back menu
//if (route.type != 'home') { //if (route.type !== 'home') {
onNewViewNeeded(); onNewViewNeeded();
return; return;
//} //}
@ -269,7 +270,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
firstConnectionResult = null; firstConnectionResult = null;
if (firstResult.State != MediaBrowser.ConnectionState.SignedIn && !route.anonymous) { if (firstResult.State !== MediaBrowser.ConnectionState.SignedIn && !route.anonymous) {
handleConnectionResult(firstResult, loading); handleConnectionResult(firstResult, loading);
return; return;
@ -334,7 +335,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
function validateRole(apiClient, role) { function validateRole(apiClient, role) {
if (role == 'admin') { if (role === 'admin') {
return apiClient.getCurrentUser().then(function (user) { return apiClient.getCurrentUser().then(function (user) {
if (user.Policy.IsAdministrator) { if (user.Policy.IsAdministrator) {
@ -395,13 +396,13 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var path = window.location.pathname || ''; var path = window.location.pathname || '';
var index = path.lastIndexOf('/'); var index = path.lastIndexOf('/');
if (index != -1) { if (index !== -1) {
path = path.substring(index); path = path.substring(index);
} else { } else {
path = '/' + path; path = '/' + path;
} }
if (!path || path == '/') { if (!path || path === '/') {
path = '/index.html'; path = '/index.html';
} }
@ -411,7 +412,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var baseRoute = window.location.href.split('?')[0].replace(getRequestFile(), ''); var baseRoute = window.location.href.split('?')[0].replace(getRequestFile(), '');
// support hashbang // support hashbang
baseRoute = baseRoute.split('#')[0]; baseRoute = baseRoute.split('#')[0];
if (baseRoute.lastIndexOf('/') == baseRoute.length - 1) { if (baseRoute.lastIndexOf('/') === baseRoute.length - 1) {
baseRoute = baseRoute.substring(0, baseRoute.length - 1); baseRoute = baseRoute.substring(0, baseRoute.length - 1);
} }
function baseUrl() { function baseUrl() {
@ -431,7 +432,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var index = currentPath.indexOf('?'); var index = currentPath.indexOf('?');
var search = ''; var search = '';
if (index != -1) { if (index !== -1) {
search = currentPath.substring(index); search = currentPath.substring(index);
} }
@ -444,11 +445,12 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var regex = new RegExp(regexS, "i"); var regex = new RegExp(regexS, "i");
var results = regex.exec(url || getWindowLocationSearch()); var results = regex.exec(url || getWindowLocationSearch());
if (results == null) if (results == null) {
return ""; return "";
else } else {
return decodeURIComponent(results[1].replace(/\+/g, " ")); return decodeURIComponent(results[1].replace(/\+/g, " "));
} }
}
function back() { function back() {
@ -462,7 +464,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
return false; return false;
} }
if (curr.type == 'home') { if (curr.type === 'home') {
return false; return false;
} }
return page.canGoBack(); return page.canGoBack();
@ -472,10 +474,10 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var baseRoute = baseUrl(); var baseRoute = baseUrl();
path = path.replace(baseRoute, ''); path = path.replace(baseRoute, '');
if (currentRouteInfo && currentRouteInfo.path == path) { if (currentRouteInfo && currentRouteInfo.path === path) {
// can't use this with home right now due to the back menu // can't use this with home right now due to the back menu
if (currentRouteInfo.route.type != 'home') { if (currentRouteInfo.route.type !== 'home') {
loading.hide(); loading.hide();
return Promise.resolve(); return Promise.resolve();
} }
@ -511,7 +513,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var skin = skinManager.getCurrentSkin(); var skin = skinManager.getCurrentSkin();
var homeRoute = skin.getRoutes().filter(function (r) { var homeRoute = skin.getRoutes().filter(function (r) {
return r.type == 'home'; return r.type === 'home';
})[0]; })[0];
return show(pluginManager.mapRoute(skin, homeRoute)); return show(pluginManager.mapRoute(skin, homeRoute));
@ -528,7 +530,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
}); });
} else { } else {
if (arguments.length == 2) { if (arguments.length === 2) {
options = arguments[1]; options = arguments[1];
} }
skinManager.getCurrentSkin().showItem(item, options); skinManager.getCurrentSkin().showItem(item, options);
@ -543,7 +545,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
var skin = skinManager.getCurrentSkin(); var skin = skinManager.getCurrentSkin();
var homeRoute = skin.getRoutes().filter(function (r) { var homeRoute = skin.getRoutes().filter(function (r) {
return r.type == 'video-osd'; return r.type === 'video-osd';
})[0]; })[0];
return show(pluginManager.mapRoute(skin, homeRoute)); return show(pluginManager.mapRoute(skin, homeRoute));
@ -572,13 +574,13 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
backgroundContainer = document.querySelector('.backgroundContainer'); backgroundContainer = document.querySelector('.backgroundContainer');
} }
if (level == 'full' || level == 2) { if (level === 'full' || level === 2) {
backdrop.clear(true); backdrop.clear(true);
document.documentElement.classList.add('transparentDocument'); document.documentElement.classList.add('transparentDocument');
backgroundContainer.classList.add('backgroundContainer-transparent'); backgroundContainer.classList.add('backgroundContainer-transparent');
backdropContainer.classList.add('hide'); backdropContainer.classList.add('hide');
} }
else if (level == 'backdrop' || level == 1) { else if (level === 'backdrop' || level === 1) {
backdrop.externalBackdrop(true); backdrop.externalBackdrop(true);
document.documentElement.classList.add('transparentDocument'); document.documentElement.classList.add('transparentDocument');
backgroundContainer.classList.add('backgroundContainer-transparent'); backgroundContainer.classList.add('backgroundContainer-transparent');
@ -600,7 +602,7 @@ define(['loading', 'dom', 'viewManager', 'skinManager', 'pluginManager', 'backdr
function setBaseRoute() { function setBaseRoute() {
var baseRoute = window.location.pathname.replace(getRequestFile(), ''); var baseRoute = window.location.pathname.replace(getRequestFile(), '');
if (baseRoute.lastIndexOf('/') == baseRoute.length - 1) { if (baseRoute.lastIndexOf('/') === baseRoute.length - 1) {
baseRoute = baseRoute.substring(0, baseRoute.length - 1); baseRoute = baseRoute.substring(0, baseRoute.length - 1);
} }

View file

@ -1,4 +1,5 @@
define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], function (browser, layoutManager, dom, focusManager) { define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], function (browser, layoutManager, dom, focusManager) {
'use strict';
/** /**
* Return type of the value. * Return type of the value.
@ -65,7 +66,7 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
var scrollerFactory = function (frame, options) { var scrollerFactory = function (frame, options) {
// Extend options // Extend options
var o = extend({}, { var o = Object.assign({}, {
slidee: null, // Selector, DOM element, or jQuery object with DOM element representing SLIDEE. slidee: null, // Selector, DOM element, or jQuery object with DOM element representing SLIDEE.
horizontal: false, // Switch to horizontal mode. horizontal: false, // Switch to horizontal mode.
@ -483,7 +484,6 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
if (type(item) === 'boolean') { if (type(item) === 'boolean') {
immediate = item; immediate = item;
item = undefined; item = undefined;
v
} }
if (item === undefined) { if (item === undefined) {
@ -539,14 +539,6 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
to('center', item, immediate); to('center', item, immediate);
}; };
function extend() {
for (var i = 1; i < arguments.length; i++)
for (var key in arguments[i])
if (arguments[i].hasOwnProperty(key))
arguments[0][key] = arguments[i][key];
return arguments[0];
}
/** /**
* Initialize continuous movement. * Initialize continuous movement.
* *
@ -642,7 +634,9 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
dragging.path = sqrt(pow(dragging.pathX, 2) + pow(dragging.pathY, 2)); dragging.path = sqrt(pow(dragging.pathX, 2) + pow(dragging.pathY, 2));
dragging.delta = o.horizontal ? dragging.pathX : dragging.pathY; dragging.delta = o.horizontal ? dragging.pathX : dragging.pathY;
if (!dragging.released && dragging.path < 1) return; if (!dragging.released && dragging.path < 1) {
return;
}
// We haven't decided whether this is a drag or not... // We haven't decided whether this is a drag or not...
if (!dragging.init) { if (!dragging.init) {
@ -721,7 +715,7 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
while (element) { while (element) {
if (interactiveElements.indexOf(element.tagName) != -1) { if (interactiveElements.indexOf(element.tagName) !== -1) {
return true; return true;
} }
@ -832,9 +826,9 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
} }
function onFrameClick(e) { function onFrameClick(e) {
if (e.which == 1) { if (e.which === 1) {
var focusableParent = focusManager.focusableParent(e.target); var focusableParent = focusManager.focusableParent(e.target);
if (focusableParent && focusableParent != document.activeElement) { if (focusableParent && focusableParent !== document.activeElement) {
focusableParent.focus(); focusableParent.focus();
} }
} }
@ -851,7 +845,9 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
} }
// Disallow multiple instances on the same element // Disallow multiple instances on the same element
if (frame.sly) throw new Error('There is already a Sly instance on this element'); if (frame.sly) {
throw new Error('There is already a Sly instance on this element');
}
frame.sly = true; frame.sly = true;

View file

@ -1,4 +1,5 @@
define(['focusManager', 'dom', 'scrollStyles'], function (focusManager, dom) { define(['focusManager', 'dom', 'scrollStyles'], function (focusManager, dom) {
'use strict';
function getBoundingClientRect(elem) { function getBoundingClientRect(elem) {

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'events'], function (connectionManager, events) { define(['connectionManager', 'events'], function (connectionManager, events) {
'use strict';
var serverNotifications = {}; var serverNotifications = {};
@ -8,7 +9,7 @@ define(['connectionManager', 'events'], function (connectionManager, events) {
if (msg.MessageType === "UserDataChanged") { if (msg.MessageType === "UserDataChanged") {
if (msg.Data.UserId == apiClient.getCurrentUserId()) { if (msg.Data.UserId === apiClient.getCurrentUserId()) {
for (var i = 0, length = msg.Data.UserDataList.length; i < length; i++) { for (var i = 0, length = msg.Data.UserDataList.length; i < length; i++) {
events.trigger(serverNotifications, 'UserDataChanged', [apiClient, msg.Data.UserDataList[i]]); events.trigger(serverNotifications, 'UserDataChanged', [apiClient, msg.Data.UserDataList[i]]);

View file

@ -1,3 +1,6 @@
(function () {
'use strict';
var connectionManager; var connectionManager;
function getApiClient(serverId) { function getApiClient(serverId) {
@ -46,3 +49,4 @@ self.addEventListener('notificationclick', function (event) {
event.waitUntil(executeAction(action, data, serverId)); event.waitUntil(executeAction(action, data, serverId));
}, false); }, false);
})();

View file

@ -1,4 +1,6 @@
self.addEventListener('sync', function (event) { self.addEventListener('sync', function (event) {
if (event.tag == 'emby-sync') { 'use strict';
if (event.tag === 'emby-sync') {
} }
}); });

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'sharingMenu', 'loading'], function (connectionManager, sharingMenu, loading) { define(['connectionManager', 'sharingMenu', 'loading'], function (connectionManager, sharingMenu, loading) {
'use strict';
function onSharingCancel(options, apiClient) { function onSharingCancel(options, apiClient) {

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'layoutManager', 'globalize', './social-share-kit-1.0.10/dist/js/social-share-kit.min', 'css!./social-share-kit-1.0.10/dist/css/social-share-kit.css', 'emby-button'], function (dialogHelper, layoutManager, globalize) { define(['dialogHelper', 'layoutManager', 'globalize', './social-share-kit-1.0.10/dist/js/social-share-kit.min', 'css!./social-share-kit-1.0.10/dist/css/social-share-kit.css', 'emby-button'], function (dialogHelper, layoutManager, globalize) {
'use strict';
function showMenu(options) { function showMenu(options) {
@ -24,7 +25,7 @@
html += '<a href="#" class="ssk ssk-tumblr" style="color:#fff;"></a>'; html += '<a href="#" class="ssk ssk-tumblr" style="color:#fff;"></a>';
html += '</div>'; html += '</div>';
dlg.style['padding'] = '.5em 1.5em 1.5em'; dlg.style.padding = '.5em 1.5em 1.5em';
dlg.innerHTML = html; dlg.innerHTML = html;

View file

@ -1,4 +1,5 @@
define([], function () { define([], function () {
'use strict';
return { return {
openUrl: function (url) { openUrl: function (url) {

View file

@ -1,4 +1,5 @@
define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'globalize', 'loading', 'dom', 'recordingHelper'], function (playbackManager, inputManager, connectionManager, embyRouter, globalize, loading, dom, recordingHelper) { define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'globalize', 'loading', 'dom', 'recordingHelper'], function (playbackManager, inputManager, connectionManager, embyRouter, globalize, loading, dom, recordingHelper) {
'use strict';
function playAllFromHere(card, serverId, queue) { function playAllFromHere(card, serverId, queue) {
@ -10,7 +11,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var foundCard = false; var foundCard = false;
for (var i = 0, length = cards.length; i < length; i++) { for (var i = 0, length = cards.length; i < length; i++) {
if (cards[i] == card) { if (cards[i] === card) {
foundCard = true; foundCard = true;
} }
if (foundCard) { if (foundCard) {
@ -58,7 +59,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}).indexOf(startItemId); }).indexOf(startItemId);
if (index == -1) { if (index === -1) {
index = 0; index = 0;
} }
@ -82,7 +83,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
function showItem(item, options) { function showItem(item, options) {
if (item.Type == 'Photo') { if (item.Type === 'Photo') {
showSlideshow(item.Id, item.ServerId); showSlideshow(item.Id, item.ServerId);
return; return;
@ -108,10 +109,10 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var apiClient = connectionManager.getApiClient(serverId); var apiClient = connectionManager.getApiClient(serverId);
if (type == 'Timer') { if (type === 'Timer') {
return apiClient.getLiveTvTimer(id); return apiClient.getLiveTvTimer(id);
} }
if (type == 'SeriesTimer') { if (type === 'SeriesTimer') {
return apiClient.getLiveTvSeriesTimer(id); return apiClient.getLiveTvSeriesTimer(id);
} }
return apiClient.getItem(apiClient.getCurrentUserId(), id); return apiClient.getItem(apiClient.getCurrentUserId(), id);
@ -142,12 +143,14 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}, options || {})).then(function (result) { }, options || {})).then(function (result) {
if (result.command == 'playallfromhere' || result.command == 'queueallfromhere') { var itemsContainer;
if (result.command === 'playallfromhere' || result.command === 'queueallfromhere') {
executeAction(card, options.positionTo, result.command); executeAction(card, options.positionTo, result.command);
} }
else if (result.command == 'removefromplaylist' || result.command == 'removefromcollection') { else if (result.command === 'removefromplaylist' || result.command === 'removefromcollection') {
var itemsContainer = options.itemsContainer || dom.parentWithAttribute(card, 'is', 'emby-itemscontainer'); itemsContainer = options.itemsContainer || dom.parentWithAttribute(card, 'is', 'emby-itemscontainer');
if (itemsContainer) { if (itemsContainer) {
itemsContainer.dispatchEvent(new CustomEvent('needsrefresh', { itemsContainer.dispatchEvent(new CustomEvent('needsrefresh', {
@ -157,9 +160,9 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
})); }));
} }
} }
else if (result.command == 'canceltimer') { else if (result.command === 'canceltimer') {
var itemsContainer = options.itemsContainer || dom.parentWithAttribute(card, 'is', 'emby-itemscontainer'); itemsContainer = options.itemsContainer || dom.parentWithAttribute(card, 'is', 'emby-itemscontainer');
if (itemsContainer) { if (itemsContainer) {
itemsContainer.dispatchEvent(new CustomEvent('timercancelled', { itemsContainer.dispatchEvent(new CustomEvent('timercancelled', {
@ -185,7 +188,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
SeriesId: card.getAttribute('data-seriesid'), SeriesId: card.getAttribute('data-seriesid'),
ServerId: card.getAttribute('data-serverid'), ServerId: card.getAttribute('data-serverid'),
MediaType: card.getAttribute('data-mediatype'), MediaType: card.getAttribute('data-mediatype'),
IsFolder: card.getAttribute('data-isfolder') == 'true', IsFolder: card.getAttribute('data-isfolder') === 'true',
UserData: { UserData: {
PlaybackPositionTicks: parseInt(card.getAttribute('data-positionticks') || '0') PlaybackPositionTicks: parseInt(card.getAttribute('data-positionticks') || '0')
} }
@ -222,23 +225,23 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var serverId = item.ServerId; var serverId = item.ServerId;
var type = item.Type; var type = item.Type;
if (action == 'link') { if (action === 'link') {
showItem(item, { showItem(item, {
context: card.getAttribute('data-context') context: card.getAttribute('data-context')
}); });
} }
else if (action == 'programdialog') { else if (action === 'programdialog') {
showProgramDialog(item); showProgramDialog(item);
} }
else if (action == 'instantmix') { else if (action === 'instantmix') {
playbackManager.instantMix(id, serverId); playbackManager.instantMix(id, serverId);
} }
else if (action == 'play') { else if (action === 'play') {
var startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0'); var startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0');
@ -249,25 +252,25 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}); });
} }
else if (action == 'playallfromhere') { else if (action === 'playallfromhere') {
playAllFromHere(card, serverId); playAllFromHere(card, serverId);
} }
else if (action == 'queueallfromhere') { else if (action === 'queueallfromhere') {
playAllFromHere(card, serverId, true); playAllFromHere(card, serverId, true);
} }
else if (action == 'setplaylistindex') { else if (action === 'setplaylistindex') {
playbackManager.currentPlaylistIndex(parseInt(card.getAttribute('data-index'))); playbackManager.currentPlaylistIndex(parseInt(card.getAttribute('data-index')));
} }
else if (action == 'record') { else if (action === 'record') {
onRecordCommand(serverId, id, type, card.getAttribute('data-timerid'), card.getAttribute('data-seriestimerid')); onRecordCommand(serverId, id, type, card.getAttribute('data-timerid'), card.getAttribute('data-seriestimerid'));
} }
else if (action == 'menu') { else if (action === 'menu') {
var options = target.getAttribute('data-playoptions') == 'false' ? var options = target.getAttribute('data-playoptions') === 'false' ?
{ {
shuffle: false, shuffle: false,
instantMix: false, instantMix: false,
@ -283,17 +286,17 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
showContextMenu(card, options); showContextMenu(card, options);
} }
else if (action == 'playmenu') { else if (action === 'playmenu') {
showPlayMenu(card, target); showPlayMenu(card, target);
} }
else if (action == 'edit') { else if (action === 'edit') {
getItem(target).then(function (item) { getItem(target).then(function (item) {
editItem(item, serverId); editItem(item, serverId);
}); });
} }
else if (action == 'playtrailer') { else if (action === 'playtrailer') {
getItem(target).then(playTrailer); getItem(target).then(playTrailer);
} }
} }
@ -315,7 +318,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var serverId = apiClient.serverInfo().Id; var serverId = apiClient.serverInfo().Id;
if (item.Type == 'Timer') { if (item.Type === 'Timer') {
if (item.ProgramId) { if (item.ProgramId) {
require(['recordingCreator'], function (recordingCreator) { require(['recordingCreator'], function (recordingCreator) {
@ -338,9 +341,9 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
function onRecordCommand(serverId, id, type, timerId, seriesTimerId) { function onRecordCommand(serverId, id, type, timerId, seriesTimerId) {
if (type == 'Program' || timerId || seriesTimerId) { if (type === 'Program' || timerId || seriesTimerId) {
var programId = type == 'Program' ? id : null; var programId = type === 'Program' ? id : null;
recordingHelper.toggle(serverId, programId, timerId, seriesTimerId); recordingHelper.toggle(serverId, programId, timerId, seriesTimerId);
} }
} }
@ -373,7 +376,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var cmd = e.detail.command; var cmd = e.detail.command;
if (cmd == 'play' || cmd == 'record' || cmd == 'menu' || cmd == 'info') { if (cmd === 'play' || cmd === 'record' || cmd === 'menu' || cmd === 'info') {
var card = dom.parentWithClass(e.target, 'itemAction'); var card = dom.parentWithClass(e.target, 'itemAction');
if (card) { if (card) {

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'focusManager', 'apphost', 'loading', 'css!./style', 'material-icons', 'paper-icon-button-light'], function (dialogHelper, inputmanager, connectionManager, layoutManager, focusManager, appHost, loading) { define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'focusManager', 'apphost', 'loading', 'css!./style', 'material-icons', 'paper-icon-button-light'], function (dialogHelper, inputmanager, connectionManager, layoutManager, focusManager, appHost, loading) {
'use strict';
function getImageUrl(item, options, apiClient) { function getImageUrl(item, options, apiClient) {
@ -15,7 +16,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
return apiClient.getScaledImageUrl(item.Id, options); return apiClient.getScaledImageUrl(item.Id, options);
} }
if (options.type == 'Primary') { if (options.type === 'Primary') {
if (item.AlbumId && item.AlbumPrimaryImageTag) { if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag; options.tag = item.AlbumPrimaryImageTag;
@ -57,7 +58,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
return getBackdropImageUrl(item, imageOptions, apiClient); return getBackdropImageUrl(item, imageOptions, apiClient);
} else { } else {
if (item.MediaType == 'Photo' && original) { if (item.MediaType === 'Photo' && original) {
return apiClient.getUrl("Items/" + item.Id + "/Download", { return apiClient.getUrl("Items/" + item.Id + "/Download", {
api_key: apiClient.accessToken() api_key: apiClient.accessToken()
}); });
@ -351,7 +352,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
function playPause() { function playPause() {
var paused = dlg.querySelector('.btnSlideshowPause i').innerHTML != "pause"; var paused = dlg.querySelector('.btnSlideshowPause i').innerHTML !== "pause";
if (paused) { if (paused) {
play(); play();
} else { } else {
@ -387,6 +388,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
} }
var _osdOpen = false; var _osdOpen = false;
function isOsdOpen() { function isOsdOpen() {
return _osdOpen; return _osdOpen;
} }
@ -413,10 +415,12 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
} }
var hideTimeout; var hideTimeout;
function startHideTimer() { function startHideTimer() {
stopHideTimer(); stopHideTimer();
hideTimeout = setTimeout(hideOsd, 4000); hideTimeout = setTimeout(hideOsd, 4000);
} }
function stopHideTimer() { function stopHideTimer() {
if (hideTimeout) { if (hideTimeout) {
clearTimeout(hideTimeout); clearTimeout(hideTimeout);
@ -437,7 +441,8 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var keyframes = [ var keyframes = [
{ transform: 'translate3d(0,' + elem.offsetHeight + 'px,0)', opacity: '.3', offset: 0 }, { transform: 'translate3d(0,' + elem.offsetHeight + 'px,0)', opacity: '.3', offset: 0 },
{ transform: 'translate3d(0,0,0)', opacity: '1', offset: 1 }]; { transform: 'translate3d(0,0,0)', opacity: '1', offset: 1 }
];
var timing = { duration: 300, iterations: 1, easing: 'ease-out' }; var timing = { duration: 300, iterations: 1, easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function () { elem.animate(keyframes, timing).onfinish = function () {
focusManager.focus(elem.querySelector('.btnSlideshowPause')); focusManager.focus(elem.querySelector('.btnSlideshowPause'));
@ -455,7 +460,8 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var keyframes = [ var keyframes = [
{ transform: 'translate3d(0,0,0)', opacity: '1', offset: 0 }, { transform: 'translate3d(0,0,0)', opacity: '1', offset: 0 },
{ transform: 'translate3d(0,' + elem.offsetHeight + 'px,0)', opacity: '.3', offset: 1 }]; { transform: 'translate3d(0,' + elem.offsetHeight + 'px,0)', opacity: '.3', offset: 1 }
];
var timing = { duration: 300, iterations: 1, easing: 'ease-out' }; var timing = { duration: 300, iterations: 1, easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function () { elem.animate(keyframes, timing).onfinish = function () {
elem.classList.add('hide'); elem.classList.add('hide');
@ -465,6 +471,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
} }
var lastMouseMoveData; var lastMouseMoveData;
function onMouseMove(e) { function onMouseMove(e) {
var eventX = e.screenX || 0; var eventX = e.screenX || 0;
@ -573,7 +580,8 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var keyframes = [ var keyframes = [
{ opacity: '0', offset: 0 }, { opacity: '0', offset: 0 },
{ opacity: '1', offset: 1 }]; { opacity: '1', offset: 1 }
];
var timing = { duration: 1200, iterations: 1 }; var timing = { duration: 1200, iterations: 1 };
newCardImageContainer.animate(keyframes, timing).onfinish = onAnimationFinished; newCardImageContainer.animate(keyframes, timing).onfinish = onAnimationFinished;
} else { } else {
@ -615,5 +623,5 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
dialogHelper.close(dialog); dialogHelper.close(dialog);
} }
}; };
} };
}); });

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings', 'connectionManager', 'loading', 'focusManager', 'dom', 'apphost', 'emby-select', 'listViewStyle', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'css!./subtitleeditor', 'emby-button'], function (dialogHelper, require, layoutManager, globalize, userSettings, connectionManager, loading, focusManager, dom, appHost) { define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings', 'connectionManager', 'loading', 'focusManager', 'dom', 'apphost', 'emby-select', 'listViewStyle', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'css!./subtitleeditor', 'emby-button'], function (dialogHelper, require, layoutManager, globalize, userSettings, connectionManager, loading, focusManager, dom, appHost) {
'use strict';
var currentItem; var currentItem;
var hasChanges; var hasChanges;
@ -104,7 +105,7 @@
var subs = streams.filter(function (s) { var subs = streams.filter(function (s) {
return s.Type == 'Subtitle'; return s.Type === 'Subtitle';
}); });
var html = ''; var html = '';
@ -223,7 +224,7 @@
context.querySelector('.noSearchResults').classList.add('hide'); context.querySelector('.noSearchResults').classList.add('hide');
var moreIcon = appHost.moreIcon == 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;'; var moreIcon = appHost.moreIcon === 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
for (var i = 0, length = results.length; i < length; i++) { for (var i = 0, length = results.length; i < length; i++) {
@ -231,7 +232,7 @@
var provider = result.ProviderName; var provider = result.ProviderName;
if (provider != lastProvider) { if (provider !== lastProvider) {
if (i > 0) { if (i > 0) {
html += '</div>'; html += '</div>';
@ -336,7 +337,7 @@
loading.hide(); loading.hide();
} }
if (typeof itemId == 'string') { if (typeof itemId === 'string') {
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(onGetItem); apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(onGetItem);
} }
else { else {

View file

@ -1,4 +1,5 @@
define(['apphost', 'globalize', 'connectionManager', 'layoutManager', 'shell', 'focusManager', 'scrollHelper', 'appSettings', 'paper-icon-button-light', 'formDialogStyle'], function (appHost, globalize, connectionManager, layoutManager, shell, focusManager, scrollHelper, appSettings) { define(['apphost', 'globalize', 'connectionManager', 'layoutManager', 'shell', 'focusManager', 'scrollHelper', 'appSettings', 'paper-icon-button-light', 'formDialogStyle'], function (appHost, globalize, connectionManager, layoutManager, shell, focusManager, scrollHelper, appSettings) {
'use strict';
var currentDialogOptions; var currentDialogOptions;
@ -57,7 +58,7 @@
dialogHelper.close(dlg); dialogHelper.close(dlg);
require(['toast'], function (toast) { require(['toast'], function (toast) {
var msg = target == apiClient.deviceId() ? globalize.translate('sharedcomponents#DownloadScheduled') : globalize.translate('sharedcomponents#SyncJobCreated'); var msg = target === apiClient.deviceId() ? globalize.translate('sharedcomponents#DownloadScheduled') : globalize.translate('sharedcomponents#SyncJobCreated');
toast(msg); toast(msg);
}); });
@ -109,7 +110,7 @@
require(['toast'], function (toast) { require(['toast'], function (toast) {
var msg = targetId == apiClient.deviceId() ? globalize.translate('sharedcomponents#DownloadScheduled') : globalize.translate('sharedcomponents#SyncJobCreated'); var msg = targetId === apiClient.deviceId() ? globalize.translate('sharedcomponents#DownloadScheduled') : globalize.translate('sharedcomponents#SyncJobCreated');
toast(msg); toast(msg);
}); });
@ -189,7 +190,7 @@
var targetContainerClass = options.isLocalSync ? ' hide' : ''; var targetContainerClass = options.isLocalSync ? ' hide' : '';
if (options.showName || dialogOptions.Options.indexOf('Name') != -1) { if (options.showName || dialogOptions.Options.indexOf('Name') !== -1) {
html += '<div class="inputContainer' + targetContainerClass + '">'; html += '<div class="inputContainer' + targetContainerClass + '">';
html += '<input is="emby-input" type="text" id="txtSyncJobName" class="txtSyncJobName" required="required" label="' + globalize.translate('sharedcomponents#LabelSyncJobName') + '"/>'; html += '<input is="emby-input" type="text" id="txtSyncJobName" class="txtSyncJobName" required="required" label="' + globalize.translate('sharedcomponents#LabelSyncJobName') + '"/>';
@ -206,7 +207,7 @@
html += targets.map(function (t) { html += targets.map(function (t) {
var isSelected = t.Id == appInfo.deviceId; var isSelected = t.Id === appInfo.deviceId;
var selectedHtml = isSelected ? ' selected="selected"' : ''; var selectedHtml = isSelected ? ' selected="selected"' : '';
return '<option' + selectedHtml + ' value="' + t.Id + '">' + t.Name + '</option>'; return '<option' + selectedHtml + ' value="' + t.Id + '">' + t.Name + '</option>';
@ -235,7 +236,7 @@
html += '<input is="emby-input" type="number" step=".1" min=".1" id="txtBitrate" label="' + globalize.translate('sharedcomponents#LabelBitrateMbps') + '"/>'; html += '<input is="emby-input" type="number" step=".1" min=".1" id="txtBitrate" label="' + globalize.translate('sharedcomponents#LabelBitrateMbps') + '"/>';
html += '</div>'; html += '</div>';
if (dialogOptions.Options.indexOf('UnwatchedOnly') != -1) { if (dialogOptions.Options.indexOf('UnwatchedOnly') !== -1) {
html += '<div class="checkboxContainer checkboxContainer-withDescription">'; html += '<div class="checkboxContainer checkboxContainer-withDescription">';
html += '<label>'; html += '<label>';
html += '<input is="emby-checkbox" type="checkbox" id="chkUnwatchedOnly"/>'; html += '<input is="emby-checkbox" type="checkbox" id="chkUnwatchedOnly"/>';
@ -245,7 +246,7 @@
html += '</div>'; html += '</div>';
} }
if (dialogOptions.Options.indexOf('SyncNewContent') != -1) { if (dialogOptions.Options.indexOf('SyncNewContent') !== -1) {
html += '<div class="checkboxContainer checkboxContainer-withDescription">'; html += '<div class="checkboxContainer checkboxContainer-withDescription">';
html += '<label>'; html += '<label>';
html += '<input is="emby-checkbox" type="checkbox" id="chkSyncNewContent"/>'; html += '<input is="emby-checkbox" type="checkbox" id="chkSyncNewContent"/>';
@ -255,7 +256,7 @@
html += '</div>'; html += '</div>';
} }
if (dialogOptions.Options.indexOf('ItemLimit') != -1) { if (dialogOptions.Options.indexOf('ItemLimit') !== -1) {
html += '<div class="inputContainer">'; html += '<div class="inputContainer">';
html += '<input is="emby-input" type="number" step="1" min="1" id="txtItemLimit" label="' + globalize.translate('sharedcomponents#LabelItemLimit') + '"/>'; html += '<input is="emby-input" type="number" step="1" min="1" id="txtItemLimit" label="' + globalize.translate('sharedcomponents#LabelItemLimit') + '"/>';
html += '<div class="fieldDescription">' + globalize.translate('sharedcomponents#LabelItemLimitHelp') + '</div>'; html += '<div class="fieldDescription">' + globalize.translate('sharedcomponents#LabelItemLimitHelp') + '</div>';
@ -330,16 +331,16 @@
var firstItem = (options.items || [])[0] || {}; var firstItem = (options.items || [])[0] || {};
if (firstItem.Type == 'Audio') { if (firstItem.Type === 'Audio') {
return true; return true;
} }
if (firstItem.Type == 'MusicAlbum') { if (firstItem.Type === 'MusicAlbum') {
return true; return true;
} }
if (firstItem.Type == 'MusicArtist') { if (firstItem.Type === 'MusicArtist') {
return true; return true;
} }
if (firstItem.Type == 'MusicGenre') { if (firstItem.Type === 'MusicGenre') {
return true; return true;
} }
@ -492,17 +493,17 @@
var options = currentDialogOptions || {}; var options = currentDialogOptions || {};
var option = (options.ProfileOptions || []).filter(function (o) { var option = (options.ProfileOptions || []).filter(function (o) {
return o.Id == profileId; return o.Id === profileId;
})[0]; })[0];
var qualityOptions = options.QualityOptions || []; var qualityOptions = options.QualityOptions || [];
if (option) { if (option) {
form.querySelector('.profileDescription').innerHTML = option.Description || ''; form.querySelector('.profileDescription').innerHTML = option.Description || '';
setQualityFieldVisible(form, qualityOptions.length > 0 && option.EnableQualityOptions && options.Options.indexOf('Quality') != -1); setQualityFieldVisible(form, qualityOptions.length > 0 && option.EnableQualityOptions && options.Options.indexOf('Quality') !== -1);
} else { } else {
form.querySelector('.profileDescription').innerHTML = ''; form.querySelector('.profileDescription').innerHTML = '';
setQualityFieldVisible(form, qualityOptions.length > 0 && options.Options.indexOf('Quality') != -1); setQualityFieldVisible(form, qualityOptions.length > 0 && options.Options.indexOf('Quality') !== -1);
} }
} }
@ -510,7 +511,7 @@
var options = currentDialogOptions || {}; var options = currentDialogOptions || {};
var option = (options.QualityOptions || []).filter(function (o) { var option = (options.QualityOptions || []).filter(function (o) {
return o.Id == qualityId; return o.Id === qualityId;
})[0]; })[0];
var qualityDescription = form.querySelector('.qualityDescription'); var qualityDescription = form.querySelector('.qualityDescription');
@ -524,7 +525,7 @@
var fldBitrate = form.querySelector('.fldBitrate'); var fldBitrate = form.querySelector('.fldBitrate');
var txtBitrate = form.querySelector('#txtBitrate'); var txtBitrate = form.querySelector('#txtBitrate');
if (qualityId == 'custom') { if (qualityId === 'custom') {
if (fldBitrate) { if (fldBitrate) {
fldBitrate.classList.remove('hide'); fldBitrate.classList.remove('hide');
@ -549,7 +550,7 @@
var fldProfile = form.querySelector('.fldProfile'); var fldProfile = form.querySelector('.fldProfile');
var selectProfile = form.querySelector('#selectProfile'); var selectProfile = form.querySelector('#selectProfile');
if (options.ProfileOptions.length && options.Options.indexOf('Profile') != -1) { if (options.ProfileOptions.length && options.Options.indexOf('Profile') !== -1) {
if (fldProfile) { if (fldProfile) {
fldProfile.classList.remove('hide'); fldProfile.classList.remove('hide');
} }

View file

@ -1,4 +1,5 @@
define(['playbackManager', 'userSettings'], function (playbackManager, userSettings) { define(['playbackManager', 'userSettings'], function (playbackManager, userSettings) {
'use strict';
var currentOwnerId; var currentOwnerId;
var currentThemeIds = []; var currentThemeIds = [];
@ -39,7 +40,7 @@ define(['playbackManager', 'userSettings'], function (playbackManager, userSetti
function enabled(mediaType) { function enabled(mediaType) {
if (mediaType == 'Video') { if (mediaType === 'Video') {
return userSettings.enableThemeVideos(); return userSettings.enableThemeVideos();
} }
@ -55,7 +56,7 @@ define(['playbackManager', 'userSettings'], function (playbackManager, userSetti
var ownerId = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.OwnerId : themeMediaResult.ThemeSongsResult.OwnerId; var ownerId = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.OwnerId : themeMediaResult.ThemeSongsResult.OwnerId;
if (ownerId != currentOwnerId) { if (ownerId !== currentOwnerId) {
var items = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.Items : themeMediaResult.ThemeSongsResult.Items; var items = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.Items : themeMediaResult.ThemeSongsResult.Items;

View file

@ -1,4 +1,5 @@
define(['css!./toast'], function () { define(['css!./toast'], function () {
'use strict';
function remove(elem) { function remove(elem) {

View file

@ -1,4 +1,5 @@
define(['dom'], function (dom) { define(['dom'], function (dom) {
'use strict';
/** /**
* Copyright 2012, Digital Fusion * Copyright 2012, Digital Fusion

View file

@ -1,4 +1,5 @@
define(['playbackManager'], function (playbackManager) { define(['playbackManager'], function (playbackManager) {
'use strict';
function setActiveDevice(name) { function setActiveDevice(name) {
return function () { return function () {
@ -12,5 +13,5 @@
return setActiveDevice(result.properties.devicename); return setActiveDevice(result.properties.devicename);
} }
return; return;
} };
}); });

View file

@ -1,4 +1,5 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
'use strict';
function disableDisplayMirror() { function disableDisplayMirror() {
return function () { return function () {
@ -11,10 +12,9 @@
switch (result.item.deviceid) { switch (result.item.deviceid) {
case 'displaymirroring': case 'displaymirroring':
return disableDisplayMirror(); return disableDisplayMirror();
break;
default: default:
return; return;
} }
} };
}); });

View file

@ -1,4 +1,5 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
'use strict';
function enableDisplayMirror() { function enableDisplayMirror() {
return function () { return function () {
@ -11,10 +12,9 @@
switch (result.item.deviceid) { switch (result.item.deviceid) {
case 'displaymirroring': case 'displaymirroring':
return enableDisplayMirror(); return enableDisplayMirror();
break;
default: default:
return; return;
} }
} };
}); });

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'playbackManager', 'globalize'], function (connectionManager, playbackManager, globalize) { define(['connectionManager', 'playbackManager', 'globalize'], function (connectionManager, playbackManager, globalize) {
'use strict';
/// <summary> Play items. </summary> /// <summary> Play items. </summary>
/// <param name="items"> The items. </param> /// <param name="items"> The items. </param>
@ -54,7 +55,6 @@
return function () { return function () {
var query = { var query = {
Limit: result.item.limit || 100, Limit: result.item.limit || 100,
UserId: result.userId, UserId: result.userId,
ExcludeLocationTypes: "Virtual" ExcludeLocationTypes: "Virtual"
@ -98,5 +98,5 @@
playItems(queryResult.Items, result.item.shuffle); playItems(queryResult.Items, result.item.shuffle);
}); });
}; };
} };
}); });

View file

@ -1,10 +1,11 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
'use strict';
return function (result) { return function (result) {
switch (result.item.deviceid) { switch (result.item.deviceid) {
default: default:
return; return;
} }
} };
}); });

View file

@ -1,4 +1,5 @@
define(['inputManager', 'connectionManager', 'embyRouter'], function (inputManager, connectionManager, embyRouter) { define(['inputManager', 'connectionManager', 'embyRouter'], function (inputManager, connectionManager, embyRouter) {
'use strict';
function getMusicCommand(result) { function getMusicCommand(result) {
return function () { return function () {
@ -46,17 +47,17 @@
return function () { return function () {
var act = result.item.menuid; var act = result.item.menuid;
if (act) { if (act) {
if (act.indexOf('livetv') != -1) { if (act.indexOf('livetv') !== -1) {
inputManager.trigger('livetv'); inputManager.trigger('livetv');
} else if (act.indexOf('guide') != -1) { } else if (act.indexOf('guide') !== -1) {
inputManager.trigger('guide'); inputManager.trigger('guide');
} else if (act.indexOf('channels') != -1) { } else if (act.indexOf('channels') !== -1) {
inputManager.trigger('livetv'); inputManager.trigger('livetv');
} else if (act.indexOf('recordings') != -1) { } else if (act.indexOf('recordings') !== -1) {
inputManager.trigger('recordedtv'); inputManager.trigger('recordedtv');
} else if (act.indexOf('scheduled') != -1) { } else if (act.indexOf('scheduled') !== -1) {
inputManager.trigger('recordedtv'); inputManager.trigger('recordedtv');
} else if (act.indexOf('series') != -1) { } else if (act.indexOf('series') !== -1) {
inputManager.trigger('recordedtv'); inputManager.trigger('recordedtv');
} else { } else {
inputManager.trigger('livetv'); inputManager.trigger('livetv');
@ -83,18 +84,18 @@
return function () { return function () {
var act = result.item.menuid; var act = result.item.menuid;
if (act) { if (act) {
if (act.indexOf('home') != -1) { if (act.indexOf('home') !== -1) {
inputManager.trigger('home'); inputManager.trigger('home');
} }
else if (act.indexOf('nextup') != -1) { else if (act.indexOf('nextup') !== -1) {
inputManager.trigger('nextup'); inputManager.trigger('nextup');
} }
else if (act.indexOf('favorites') != -1) { else if (act.indexOf('favorites') !== -1) {
inputManager.trigger('favorites'); inputManager.trigger('favorites');
} else if (act.indexOf('upcoming') != -1) { } else if (act.indexOf('upcoming') !== -1) {
inputManager.trigger('upcomingtv'); inputManager.trigger('upcomingtv');
} }
else if (act.indexOf('nowplaying') != -1) { else if (act.indexOf('nowplaying') !== -1) {
inputManager.trigger('nowplaying'); inputManager.trigger('nowplaying');
} }
else { else {
@ -129,5 +130,5 @@
return; return;
} }
} };
}); });

View file

@ -1,4 +1,5 @@
define(['inputManager'], function (inputManager) { define(['inputManager'], function (inputManager) {
'use strict';
function toggleDisplayMirror() { function toggleDisplayMirror() {
return function () { return function () {
@ -11,10 +12,9 @@
switch (result.item.deviceid) { switch (result.item.deviceid) {
case 'displaymirroring': case 'displaymirroring':
return toggleDisplayMirror(); return toggleDisplayMirror();
break;
default: default:
return; return;
} }
} };
}); });

View file

@ -1,6 +1,7 @@
// <date>09.10.2015</date> // <date>09.10.2015</date>
// <summary>grammarprocessor class</summary> // <summary>grammarprocessor class</summary>
define([], function () { define([], function () {
'use strict';
/// <summary> The named register exponent. </summary> /// <summary> The named register exponent. </summary>
var NamedRegExp = function (pattern, string) { var NamedRegExp = function (pattern, string) {
@ -24,14 +25,15 @@ define([], function () {
for (var i = 0, len = regexp.length; i < len; i++) { for (var i = 0, len = regexp.length; i < len; i++) {
if (finalMatch[(i + 1)] !== false) { if (finalMatch[(i + 1)] !== false) {
var mth = finalMatch[(i + 1)]; var mth = finalMatch[(i + 1)];
if (mth) if (mth) {
mth = mth.trim().toLowerCase(); mth = mth.trim().toLowerCase();
}
regexp[i].value = mth; regexp[i].value = mth;
} }
} }
} } else {
else
regexp = null; regexp = null;
}
return regexp; return regexp;
}; };
@ -91,8 +93,9 @@ define([], function () {
var isvalid = false; var isvalid = false;
commandgroups.map(function (group) { commandgroups.map(function (group) {
if (isvalid) if (isvalid) {
return; return;
}
if (group.defaultValues && group.defaultValues.length > 0) { if (group.defaultValues && group.defaultValues.length > 0) {
group.defaultValues.map(function (item) { group.defaultValues.map(function (item) {
@ -105,14 +108,19 @@ define([], function () {
group.items.map(function (item) { group.items.map(function (item) {
var regex = NamedRegExp(item.command, text); var regex = NamedRegExp(item.command, text);
if (!regex && item.altcommand) if (!regex && item.altcommand) {
regex = NamedRegExp(item.altcommand, text) regex = NamedRegExp(item.altcommand, text);
}
if (regex && regex.length > 0) { if (regex && regex.length > 0) {
//Group data //Group data
if (group.groupid) result.groupid = group.groupid; if (group.groupid) {
if (group.name) result.name = group.name; result.groupid = group.groupid;
}
if (group.name) {
result.name = group.name;
}
if (group.defaultValues) { if (group.defaultValues) {
result.defaultValues.sourceid = group.defaultValues.sourceid || result.defaultValues.sourceid; result.defaultValues.sourceid = group.defaultValues.sourceid || result.defaultValues.sourceid;
result.defaultValues.deviceid = group.defaultValues.deviceid || result.defaultValues.deviceid; result.defaultValues.deviceid = group.defaultValues.deviceid || result.defaultValues.deviceid;
@ -128,7 +136,9 @@ define([], function () {
if (group.name) result.name = group.name; if (group.name) {
result.name = group.name;
}
//Item data //Item data
var usegroupDefault = checkItemProperty(item.usedefaultvalues, result.item.usedefaultvalues); var usegroupDefault = checkItemProperty(item.usedefaultvalues, result.item.usedefaultvalues);
@ -181,15 +191,17 @@ define([], function () {
break; break;
} }
if (result.text) if (result.text) {
result.text = result.text.replace(regresult.value, '').trim(); result.text = result.text.replace(regresult.value, '').trim();
}
}); });
isvalid = true; isvalid = true;
} }
if (isvalid) if (isvalid) {
return; return;
}
}); });
} }
}); });
@ -205,11 +217,13 @@ define([], function () {
var idx = -1; var idx = -1;
idx = actions.map(function (e) { return e.name; }).indexOf(name); idx = actions.map(function (e) { return e.name; }).indexOf(name);
if (idx > -1) if (idx > -1) {
return actions[idx]; return actions[idx];
else }
else {
return null; return null;
} }
}
/// <summary> Check item property. </summary> /// <summary> Check item property. </summary>
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
@ -218,23 +232,27 @@ define([], function () {
/// <param name="groupDefaultValue"> The group default value. </param> /// <param name="groupDefaultValue"> The group default value. </param>
/// <returns> . </returns> /// <returns> . </returns>
function checkItemProperty(property, itemDefaultValue, useGroupDefaultValue, groupDefaultValue) { function checkItemProperty(property, itemDefaultValue, useGroupDefaultValue, groupDefaultValue) {
if (property) if (property) {
return property; return property;
}
if (useGroupDefaultValue && groupDefaultValue) if (useGroupDefaultValue && groupDefaultValue) {
return groupDefaultValue; return groupDefaultValue;
}
return itemDefaultValue; return itemDefaultValue;
} }
return function (commandgroups, text) { return function (commandgroups, text) {
var result;
if (commandgroups) { if (commandgroups) {
var result = processcommands(text, commandgroups); result = processcommands(text, commandgroups);
console.log(text); console.log(text);
console.log(commandgroups); console.log(commandgroups);
} }
return result; return result;
} };
}); });

View file

@ -1,6 +1,7 @@
// <date>09.10.2015</date> // <date>09.10.2015</date>
// <summary>voicecommands class</summary> // <summary>voicecommands class</summary>
define(['require'], function (require) { define(['require'], function (require) {
'use strict';
/// <summary> Process the command. </summary> /// <summary> Process the command. </summary>
/// <param name="commandPath"> Full pathname of the command file. </param> /// <param name="commandPath"> Full pathname of the command file. </param>
@ -31,30 +32,22 @@ define(['require'], function (require) {
case 'show': case 'show':
return processCommand('./commands/showcommands.js', result); return processCommand('./commands/showcommands.js', result);
break;
case 'play': case 'play':
return processCommand('./commands/playcommands.js', result); return processCommand('./commands/playcommands.js', result);
break;
case 'shuffle': case 'shuffle':
return processCommand('./commands/playcommands.js', result); return processCommand('./commands/playcommands.js', result);
break;
case 'search': case 'search':
return processCommand('./commands/searchcommands.js', result); return processCommand('./commands/searchcommands.js', result);
break;
case 'control': case 'control':
return processCommand('./commands/controlcommands.js', result); return processCommand('./commands/controlcommands.js', result);
break;
case 'enable': case 'enable':
return processCommand('./commands/enablecommands.js', result); return processCommand('./commands/enablecommands.js', result);
break;
case 'disable': case 'disable':
return processCommand('./commands/disablecommands.js', result); return processCommand('./commands/disablecommands.js', result);
break;
case 'toggle': case 'toggle':
return processCommand('./commands/togglecommands.js', result); return processCommand('./commands/togglecommands.js', result);
break;
default: default:
return Promise.reject(); return Promise.reject();
} }
} };
}); });

View file

@ -1,4 +1,5 @@
define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-button', 'css!./voice.css', 'material-icons', 'css!./../formdialog'], function (dialogHelper, voicereceiver, voiceprocessor, globalize) { define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-button', 'css!./voice.css', 'material-icons', 'css!./../formdialog'], function (dialogHelper, voicereceiver, voiceprocessor, globalize) {
'use strict';
var lang = 'en-US'; var lang = 'en-US';
@ -33,7 +34,7 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
var commands = []; var commands = [];
commandGroups.map(function (group) { commandGroups.map(function (group) {
if ((group.items && group.items.length > 0) && (groupid == group.groupid || groupid == '')) { if ((group.items && group.items.length > 0) && (groupid !== group.groupid || groupid === '')) {
group.items.map(function (item) { group.items.map(function (item) {
@ -63,12 +64,15 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
idx = commandgroups.map(function (e) { return e.groupid; }).indexOf(groupid); idx = commandgroups.map(function (e) { return e.groupid; }).indexOf(groupid);
if (idx > -1) if (idx > -1) {
return commandgroups[idx]; return commandgroups[idx];
else }
else {
return null; return null;
} else }
} else {
return null; return null;
}
}); });
} }
@ -99,6 +103,10 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
var isNewDialog = false; var isNewDialog = false;
var dlg; var dlg;
function onCancelClick() {
dialogHelper.close(dlg);
}
if (!currentDialog) { if (!currentDialog) {
isNewDialog = true; isNewDialog = true;
@ -166,10 +174,6 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
currentDialog = null; currentDialog = null;
}); });
function onCancelClick() {
dialogHelper.close(dlg);
}
var closeButtons = dlg.querySelectorAll('.btnCancelVoiceInput'); var closeButtons = dlg.querySelectorAll('.btnCancelVoiceInput');
for (var i = 0, length = closeButtons.length; i < length; i++) { for (var i = 0, length = closeButtons.length; i < length; i++) {
closeButtons[i].addEventListener('click', onCancelClick); closeButtons[i].addEventListener('click', onCancelClick);
@ -214,8 +218,9 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
/// <returns> . </returns> /// <returns> . </returns>
function showUnrecognizedCommandHelp(command) { function showUnrecognizedCommandHelp(command) {
//speak("I don't understend this command"); //speak("I don't understend this command");
if (command) if (command) {
currentDialog.querySelector('.voiceInputText').innerText = command; currentDialog.querySelector('.voiceInputText').innerText = command;
}
currentDialog.querySelector('.unrecognizedCommand').classList.remove('hide'); currentDialog.querySelector('.unrecognizedCommand').classList.remove('hide');
currentDialog.querySelector('.defaultVoiceHelp').classList.add('hide'); currentDialog.querySelector('.defaultVoiceHelp').classList.add('hide');
} }
@ -225,11 +230,13 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
/// <returns> . </returns> /// <returns> . </returns>
function showCommands(result) { function showCommands(result) {
//speak('Hello, what can I do for you?'); //speak('Hello, what can I do for you?');
if (result) if (result) {
showVoiceHelp(result.groupid, result.name); showVoiceHelp(result.groupid, result.name);
else }
else {
showVoiceHelp(); showVoiceHelp();
} }
}
function resetDialog() { function resetDialog() {
if (currentDialog) { if (currentDialog) {
@ -257,7 +264,7 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
}, 1); }, 1);
}, function (result) { }, function (result) {
if (result.error == 'group') { if (result.error === 'group') {
showVoiceHelp(result.item.groupid, result.groupName); showVoiceHelp(result.item.groupid, result.groupName);
return; return;
} }

View file

@ -1,4 +1,5 @@
define(['./voicecommands.js', './grammarprocessor.js', 'require'], function (voicecommands, grammarprocessor, require) { define(['./voicecommands.js', './grammarprocessor.js', 'require'], function (voicecommands, grammarprocessor, require) {
'use strict';
var commandgroups; var commandgroups;

View file

@ -1,4 +1,5 @@
define(['events'], function (events) { define(['events'], function (events) {
'use strict';
var receiver = { var receiver = {
@ -13,7 +14,7 @@
var srch = 'jarvis'; var srch = 'jarvis';
var index = text.toLowerCase().indexOf(srch); var index = text.toLowerCase().indexOf(srch);
if (index != -1) { if (index !== -1) {
text = text.substring(index + srch.length); text = text.substring(index + srch.length);
} else { } else {
return null; return null;
@ -30,11 +31,13 @@
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
cancelListener(); cancelListener();
var recognition = new (window.SpeechRecognition || var recognitionObj = window.SpeechRecognition ||
window.webkitSpeechRecognition || window.webkitSpeechRecognition ||
window.mozSpeechRecognition || window.mozSpeechRecognition ||
window.oSpeechRecognition || window.oSpeechRecognition ||
window.msSpeechRecognition)(); window.msSpeechRecognition;
var recognition = new recognitionObj();
recognition.lang = options.lang; recognition.lang = options.lang;
recognition.continuous = options.continuous || false; recognition.continuous = options.continuous || false;