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": {},
"ignore": [],
"version": "1.1.90",
"_release": "1.1.90",
"version": "1.1.91",
"_release": "1.1.91",
"_resolution": {
"type": "version",
"tag": "1.1.90",
"commit": "eb52e55b0f856ac89abcea9a71f475595d718627"
"tag": "1.1.91",
"commit": "f94b80f14bce6922acf1dbd749a60ad54e4abfd8"
},
"_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
"_target": "^1.1.51",

View file

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

View file

@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.314",
"_release": "1.4.314",
"version": "1.4.320",
"_release": "1.4.320",
"_resolution": {
"type": "version",
"tag": "1.4.314",
"commit": "087a1aa017a98fe347ce4388a794b3de13468a4d"
"tag": "1.4.320",
"commit": "5b3dc54cf24d4f615a59e5954726231e446cfced"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_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
// safari is lying
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');
// 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) {
'use strict';
var currentServerId;

View file

@ -148,6 +148,7 @@
}
}
if (toLocaleTimeStringSupportsLocales) {
return toLocaleTimeString(date, {
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) {
var yesterday = new Date();
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) {
'use strict';
var ItemsContainerProtoType = Object.create(HTMLDivElement.prototype);

View file

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

View file

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

View file

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

View file

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

View file

@ -507,8 +507,12 @@
if (program.IsHD && options.showHdIcon) {
//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 += getTimerIndicator(program);

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focusManager', 'embyRouter'], function (connectionManager, playbackManager, events, inputManager, focusManager, embyRouter) {
'use strict';
function notifyApp() {
@ -149,10 +150,10 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
notifyApp();
var serverId = apiClient.serverInfo().Id;
if (msg.Data.PlayCommand == "PlayNext") {
if (msg.Data.PlayCommand === "PlayNext") {
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 });
}
else {

View file

@ -1,4 +1,5 @@
define(['playbackManager', 'focusManager', 'embyRouter', 'dom'], function (playbackManager, focusManager, embyRouter, dom) {
'use strict';
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) {
'use strict';
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({
name: globalize.translate('sharedcomponents#CancelRecording'),
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({
name: globalize.translate('sharedcomponents#CancelRecording'),
id: 'canceltimer'
});
}
if ((item.Type == 'SeriesTimer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) {
if ((item.Type === 'SeriesTimer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) {
commands.push({
name: globalize.translate('sharedcomponents#CancelSeries'),
id: 'cancelseriestimer'
@ -52,7 +53,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (item.CanDelete) {
if (item.Type == 'Playlist' || item.Type == 'BoxSet') {
if (item.Type === 'Playlist' || item.Type === 'BoxSet') {
commands.push({
name: globalize.translate('sharedcomponents#Delete'),
id: 'delete'
@ -67,9 +68,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
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({
name: text,
@ -90,7 +91,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
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) {
commands.push({
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) {
commands.push({
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({
name: globalize.translate('sharedcomponents#PlayAllFromHere'),
id: 'playallfromhere'
@ -173,7 +174,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
}
}
if (item.Type == 'Program') {
if (item.Type === 'Program') {
commands.push({
name: Globalize.translate('sharedcomponents#Record'),
@ -183,7 +184,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
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({
name: globalize.translate('sharedcomponents#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) {
commands.push({
name: globalize.translate('sharedcomponents#Shuffle'),
@ -534,7 +535,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
startPosition = item.UserData.PlaybackPositionTicks;
}
if (item.Type == 'Program') {
if (item.Type === 'Program') {
playbackManager[method]({
ids: [item.ChannelId],
startPositionTicks: startPosition
@ -553,12 +554,12 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
var serverId = apiClient.serverInfo().Id;
if (item.Type == 'Timer') {
if (item.Type === 'Timer') {
require(['recordingEditor'], function (recordingEditor) {
recordingEditor.show(item.Id, serverId).then(resolve, reject);
});
} else if (item.Type == 'SeriesTimer') {
} else if (item.Type === 'SeriesTimer') {
require(['seriesRecordingEditor'], function (recordingEditor) {
recordingEditor.show(item.Id, serverId).then(resolve, reject);

View file

@ -1,4 +1,5 @@
define(['apphost'], function (appHost) {
'use strict';
function getDisplayName(item, options) {
@ -8,24 +9,24 @@ define(['apphost'], function (appHost) {
options = options || {};
if (item.Type == 'Timer') {
if (item.Type === 'Timer') {
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) {
return item.Number + ' ' + 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);
} 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;
@ -50,56 +51,56 @@ define(['apphost'], function (appHost) {
function supportsAddingToCollection(item) {
if (item.Type == 'Timer' || item.Type == 'SeriesTimer') {
if (item.Type === 'Timer' || item.Type === 'SeriesTimer') {
return false;
}
var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'TvChannel', 'Program', 'MusicAlbum', 'Timer'];
if (item.Type == 'Recording') {
if (item.Status != 'Completed') {
if (item.Type === 'Recording') {
if (item.Status !== 'Completed') {
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) {
if (item.Type == 'Program') {
if (item.Type === 'Program') {
return false;
}
if (item.Type == 'Timer') {
if (item.Type === 'Timer') {
return false;
}
if (item.Type == 'SeriesTimer') {
if (item.Type === 'SeriesTimer') {
return false;
}
if (item.Type == 'Recording') {
if (item.Status != 'Completed') {
if (item.Type === 'Recording') {
if (item.Status !== 'Completed') {
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) {
var itemType = item.Type;
if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView") {
if (itemType === "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType === "UserView") {
return false;
}
if (itemType == 'Program') {
if (itemType === 'Program') {
return false;
}
if (item.Type == 'Recording') {
if (item.Status != 'Completed') {
if (item.Type === 'Recording') {
if (item.Status !== 'Completed') {
return false;
}
}
@ -114,15 +115,15 @@ define(['apphost'], function (appHost) {
canIdentify: function (user, itemType) {
if (itemType == "Movie" ||
itemType == "Trailer" ||
itemType == "Series" ||
itemType == "Game" ||
itemType == "BoxSet" ||
itemType == "Person" ||
itemType == "Book" ||
itemType == "MusicAlbum" ||
itemType == "MusicArtist") {
if (itemType === "Movie" ||
itemType === "Trailer" ||
itemType === "Series" ||
itemType === "Game" ||
itemType === "BoxSet" ||
itemType === "Person" ||
itemType === "Book" ||
itemType === "MusicAlbum" ||
itemType === "MusicArtist") {
if (user.Policy.IsAdministrator) {
@ -139,7 +140,7 @@ define(['apphost'], function (appHost) {
var itemType = item.Type;
if (itemType == 'UserView') {
if (itemType === 'UserView') {
if (user.Policy.IsAdministrator) {
return true;
@ -148,13 +149,13 @@ define(['apphost'], function (appHost) {
return false;
}
if (item.Type == 'Recording') {
if (item.Status != 'Completed') {
if (item.Type === 'Recording') {
if (item.Status !== 'Completed') {
return false;
}
}
return itemType != 'Timer' && itemType != 'SeriesTimer' && canEdit(user, item);
return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item);
},
canSync: function (user, item) {
@ -168,14 +169,14 @@ define(['apphost'], function (appHost) {
canShare: function (user, item) {
if (item.Type == 'Timer') {
if (item.Type === 'Timer') {
return false;
}
if (item.Type == 'SeriesTimer') {
if (item.Type === 'SeriesTimer') {
return false;
}
if (item.Type == 'Recording') {
if (item.Status != 'Completed') {
if (item.Type === 'Recording') {
if (item.Status !== 'Completed') {
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) {
'use strict';
var preventHover = false;
var showOverlayTimeout;
@ -72,9 +73,9 @@
var className = card.className.toLowerCase();
var isMiniItem = className.indexOf('mini') != -1;
var isSmallItem = isMiniItem || className.indexOf('small') != -1;
var isPortrait = className.indexOf('portrait') != -1;
var isMiniItem = className.indexOf('mini') !== -1;
var isSmallItem = isMiniItem || className.indexOf('small') !== -1;
var isPortrait = className.indexOf('portrait') !== -1;
var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName;
var name = item.EpisodeTitle ? item.Name : itemHelper.getDisplayName(item);
@ -136,7 +137,7 @@
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>';
buttonCount++;
@ -191,7 +192,7 @@
var id = dataElement.getAttribute('data-id');
var type = dataElement.getAttribute('data-type');
if (type == 'Timer' || type == 'SeriesTimer') {
if (type === 'Timer' || type === 'SeriesTimer') {
return;
}
@ -265,7 +266,6 @@
}
ItemHoverMenu.prototype = {
constructor: ItemHoverMenu,
destroy: function () {
@ -276,7 +276,7 @@
passive: true
});
}
}
};
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) {
'use strict';
var currentItem;
var currentItemType;
@ -20,13 +21,14 @@
var i, length;
var identifyField = page.querySelectorAll('.identifyField');
var value;
for (i = 0, length = identifyField.length; i < length; i++) {
var value = identifyField[i].value;
value = identifyField[i].value;
if (value) {
if (identifyField[i].type == 'number') {
if (identifyField[i].type === 'number') {
value = parseInt(value);
}
@ -39,7 +41,7 @@
var txtLookupId = page.querySelectorAll('.txtLookupId');
for (i = 0, length = txtLookupId.length; i < length; i++) {
var value = txtLookupId[i].value;
value = txtLookupId[i].value;
if (value) {
hasId = true;
@ -177,11 +179,11 @@
var cardBoxCssClass = 'cardBox visualCardBox';
var padderClass;
if (currentItemType == "Episode") {
if (currentItemType === "Episode") {
cssClass += " backdropCard backdropCard-scalable";
padderClass = 'cardPadder-backdrop';
}
else if (currentItemType == "MusicAlbum" || currentItemType == "MusicArtist") {
else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") {
cssClass += " squareCard squareCard-scalable";
padderClass = 'cardPadder-square';
}
@ -297,7 +299,7 @@
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('#txtLookupYear').value = '';
@ -455,7 +457,7 @@
dlg.querySelector('#txtLookupName').value = itemName;
if (itemType == "Person" || itemType == "BoxSet") {
if (itemType === "Person" || itemType === "BoxSet") {
dlg.querySelector('.fldLookupYear').classList.add('hide');
dlg.querySelector('#txtLookupYear').value = '';

View file

@ -3,7 +3,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
function setLayout(self, layout, selectedLayout) {
if (layout == selectedLayout) {
if (layout === selectedLayout) {
self[layout] = true;
document.documentElement.classList.add('layout-' + layout);
} else {
@ -12,7 +12,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
}
}
function layoutManager() {
function LayoutManager() {
var self = this;
@ -62,7 +62,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
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) {
'use strict';
function getIndex(item, options) {
if (options.index == 'disc') {
if (options.index === 'disc') {
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 code, name;
if (sortBy.indexOf('sortname') == 0) {
if (sortBy.indexOf('sortname') === 0) {
if (item.Type == 'Episode') return '';
if (item.Type === 'Episode') {
return '';
}
// SortName
name = (item.SortName || item.Name || '?')[0].toUpperCase();
@ -24,11 +27,11 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return name.toUpperCase();
}
if (sortBy.indexOf('officialrating') == 0) {
if (sortBy.indexOf('officialrating') === 0) {
return item.OfficialRating || globalize.translate('sharedcomponents#Unrated');
}
if (sortBy.indexOf('communityrating') == 0) {
if (sortBy.indexOf('communityrating') === 0) {
if (item.CommunityRating == null) {
return globalize.translate('sharedcomponents#Unrated');
@ -36,7 +39,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return Math.floor(item.CommunityRating);
}
if (sortBy.indexOf('criticrating') == 0) {
if (sortBy.indexOf('criticrating') === 0) {
if (item.CriticRating == null) {
return globalize.translate('sharedcomponents#Unrated');
@ -44,7 +47,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return Math.floor(item.CriticRating);
}
if (sortBy.indexOf('metascore') == 0) {
if (sortBy.indexOf('metascore') === 0) {
if (item.Metascore == null) {
return globalize.translate('sharedcomponents#Unrated');
@ -52,10 +55,12 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return Math.floor(item.Metascore);
}
if (sortBy.indexOf('albumartist') == 0) {
if (sortBy.indexOf('albumartist') === 0) {
// SortName
if (!item.AlbumArtist) return '';
if (!item.AlbumArtist) {
return '';
}
name = item.AlbumArtist[0].toUpperCase();
@ -78,9 +83,9 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
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);
}
@ -144,7 +149,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var groupTitle = '';
var action = options.action || 'link';
var isLargeStyle = options.imageSize == 'large';
var isLargeStyle = options.imageSize === 'large';
var enableOverview = options.enableOverview;
var clickEntireItem = layoutManager.tv ? true : false;
@ -163,13 +168,13 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var itemGroupTitle = getIndex(item, options);
if (itemGroupTitle != groupTitle) {
if (itemGroupTitle !== groupTitle) {
if (html) {
html += '</div>';
}
if (i == 0) {
if (i === 0) {
html += '<h1 class="listGroupHeader listGroupHeader-first">';
}
else {
@ -187,7 +192,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var cssClass = "listItem";
if (options.highlight !== false) {
if (i % 2 == 1) {
if (i % 2 === 1) {
cssClass += ' listItem-odd';
}
}
@ -270,7 +275,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var parentTitle = null;
if (options.showParentTitle) {
if (item.Type == 'Episode') {
if (item.Type === 'Episode') {
parentTitle = item.SeriesName;
}
@ -306,23 +311,23 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
}
if (options.artist !== false) {
if (item.ArtistItems && item.Type != 'MusicAlbum') {
if (item.ArtistItems && item.Type !== 'MusicAlbum') {
textlines.push(item.ArtistItems.map(function (a) {
return a.Name;
}).join(', '));
}
if (item.AlbumArtist && item.Type == 'MusicAlbum') {
if (item.AlbumArtist && item.Type === 'MusicAlbum') {
textlines.push(item.AlbumArtist);
}
}
if (item.Type == 'Game') {
if (item.Type === 'Game') {
textlines.push(item.GameSystem);
}
if (item.Type == 'TvChannel') {
if (item.Type === 'TvChannel') {
if (item.CurrentProgram) {
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
@ -340,7 +345,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
html += '<div class="' + cssClass + '">';
var moreIcon = appHost.moreIcon == 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
var moreIcon = appHost.moreIcon === 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
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');
}

View file

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

View file

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

View file

@ -1,17 +1,18 @@
define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', 'css!./mediainfo.css', 'programStyles'], function (datetime, globalize, embyRouter, itemHelper) {
'use strict';
function getTimerIndicator(item) {
var status;
if (item.Type == 'SeriesTimer') {
if (item.Type === 'SeriesTimer') {
return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon">&#xE062;</i>';
}
else if (item.TimerId || item.SeriesTimerId) {
status = item.Status || 'Cancelled';
}
else if (item.Type == 'Timer') {
else if (item.Type === 'Timer') {
status = item.Status;
}
@ -21,7 +22,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
if (item.SeriesTimerId) {
if (status != 'Cancelled') {
if (status !== 'Cancelled') {
return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon">&#xE062;</i>';
}
@ -93,12 +94,13 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
var miscInfo = [];
options = options || {};
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) {
var count = item.SongCount || item.ChildCount;
count = item.SongCount || item.ChildCount;
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) {
@ -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) {
@ -136,7 +138,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
}
}
if (item.StartDate && item.Type != 'Program') {
if (item.StartDate && item.Type !== 'Program') {
try {
date = datetime.parseISO8601Date(item.StartDate);
@ -144,7 +146,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
text = datetime.toLocaleDateString(date);
miscInfo.push(text);
if (item.Type != "Recording") {
if (item.Type !== "Recording") {
text = datetime.getDisplayTime(date);
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));
}
@ -170,7 +172,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
if (endYear != item.ProductionYear) {
if (endYear !== item.ProductionYear) {
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) {
miscInfo.push({
@ -228,7 +230,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
}
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) {
@ -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));
@ -273,11 +275,11 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
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);
}
if (options.container !== false && item.Type == 'Audio' && item.Container) {
if (options.container !== false && item.Type === 'Audio' && item.Container) {
miscInfo.push(item.Container);
}
@ -313,7 +315,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
function getEndsAt(item) {
if (item.MediaType == 'Video' && item.RunTimeTicks) {
if (item.MediaType === 'Video' && item.RunTimeTicks) {
if (!item.StartDate) {
var endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
@ -444,7 +446,7 @@ define(['datetime', 'globalize', 'embyRouter', 'itemHelper', 'material-icons', '
if (options.interactive == null) {
options.interactive = false;
}
if (item.Type == 'Program') {
if (item.Type === 'Program') {
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 metadataEditorInfo;
@ -33,7 +34,7 @@
var newContentType = form.querySelector('#selectContentType').value || '';
if ((metadataEditorInfo.ContentType || '') != newContentType) {
if ((metadataEditorInfo.ContentType || '') !== newContentType) {
apiClient.ajax({
@ -104,7 +105,7 @@
var parts = date.toISOString().split('T');
// 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];
@ -189,14 +190,14 @@
item.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
item.PreferredMetadataCountryCode = form.querySelector('#selectCountry').value;
if (currentItem.Type == "Person") {
if (currentItem.Type === "Person") {
var placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
}
if (currentItem.Type == "Series") {
if (currentItem.Type === "Series") {
// 600000000
var seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
@ -248,7 +249,7 @@
personEditor.show(person).then(function (updatedPerson) {
var isNew = index == -1;
var isNew = index === -1;
if (isNew) {
currentItem.People.push(updatedPerson);
@ -308,7 +309,7 @@
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');
reload(currentContext, currentItem.Id, currentItem.ServerId);
@ -400,16 +401,17 @@
context.querySelector('#peopleList').addEventListener('click', function (e) {
var index;
var btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
if (btnDeletePerson) {
var index = parseInt(btnDeletePerson.getAttribute('data-index'));
index = parseInt(btnDeletePerson.getAttribute('data-index'));
currentItem.People.splice(index, 1);
populatePeople(context, currentItem.People);
}
var btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson');
if (btnEditPerson) {
var index = parseInt(btnEditPerson.getAttribute('data-index'));
index = parseInt(btnEditPerson.getAttribute('data-index'));
editPerson(context, currentItem.People[index], index);
}
});
@ -535,7 +537,7 @@
// Context is optional and restricts the querySelector to the context
function hideElement(selector, context, multiple) {
context = context || document;
if (typeof selector == 'string') {
if (typeof selector === 'string') {
var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
@ -554,7 +556,7 @@
// Context is optional and restricts the querySelector to the context
function showElement(selector, context, multiple) {
context = context || document;
if (typeof selector == 'string') {
if (typeof selector === 'string') {
var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
@ -569,31 +571,31 @@
}
function setFieldVisibilities(context, item) {
if (item.Path && item.LocationType != 'Remote') {
if (item.Path && item.LocationType !== 'Remote') {
showElement('#fldPath', context);
} else {
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);
} else {
hideElement('#fldOriginalName', context);
}
if (item.Type == "Series") {
if (item.Type === "Series") {
showElement('#fldSeriesRuntime', context);
} else {
hideElement('#fldSeriesRuntime', context);
}
if (item.Type == "Series" || item.Type == "Person") {
if (item.Type === "Series" || item.Type === "Person") {
showElement('#fldEndDate', context);
} else {
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('#fldRevenue', context);
} else {
@ -601,19 +603,19 @@
hideElement('#fldRevenue', context);
}
if (item.Type == "MusicAlbum") {
if (item.Type === "MusicAlbum") {
showElement('#albumAssociationMessage', context);
} else {
hideElement('#albumAssociationMessage', context)
hideElement('#albumAssociationMessage', context);
}
if (item.MediaType == "Game") {
if (item.MediaType === "Game") {
showElement('#fldPlayers', context);
} else {
hideElement('#fldPlayers', context);
}
if (item.Type == "Movie" || item.Type == "Trailer") {
if (item.Type === "Movie" || item.Type === "Trailer") {
showElement('#fldCriticRating', context);
showElement('#fldCriticRatingSummary', context);
} else {
@ -621,19 +623,19 @@
hideElement('#fldCriticRatingSummary', context);
}
if (item.Type == "Movie") {
if (item.Type === "Movie") {
showElement('#fldAwardSummary', context);
} else {
hideElement('#fldAwardSummary', context);
}
if (item.Type == "Movie" || item.Type == "Trailer") {
if (item.Type === "Movie" || item.Type === "Trailer") {
showElement('#fldMetascore', context);
} else {
hideElement('#fldMetascore', context);
}
if (item.Type == "Series") {
if (item.Type === "Series") {
showElement('#fldStatus', context);
showElement('#fldAirDays', context);
showElement('#fldAirTime', context);
@ -643,19 +645,19 @@
hideElement('#fldAirTime', context);
}
if (item.MediaType == "Video" && item.Type != "TvChannel") {
if (item.MediaType === "Video" && item.Type !== "TvChannel") {
showElement('#fld3dFormat', context);
} else {
hideElement('#fld3dFormat', context);
}
if (item.Type == "Audio") {
if (item.Type === "Audio") {
showElement('#fldAlbumArtist', context);
} else {
hideElement('#fldAlbumArtist', context);
}
if (item.Type == "Audio" || item.Type == "MusicVideo") {
if (item.Type === "Audio" || item.Type === "MusicVideo") {
showElement('#fldArtist', context);
showElement('#fldAlbum', context);
} else {
@ -663,26 +665,26 @@
hideElement('#fldAlbum', context);
}
if (item.Type == "Episode") {
if (item.Type === "Episode") {
showElement('#collapsibleDvdEpisodeInfo', context);
} else {
hideElement('#collapsibleDvdEpisodeInfo', context);
}
if (item.Type == "Episode" && item.ParentIndexNumber == 0) {
if (item.Type === "Episode" && item.ParentIndexNumber === 0) {
showElement('#collapsibleSpecialEpisodeInfo', context);
} else {
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('#fldCommunityVoteCount', context);
hideElement('#genresCollapsible', context);
hideElement('#peopleCollapsible', context);
hideElement('#studiosCollapsible', context);
if (item.Type == "TvChannel") {
if (item.Type === "TvChannel") {
showElement('#fldOfficialRating', context);
} else {
hideElement('#fldOfficialRating', context);
@ -698,7 +700,7 @@
showElement('#fldCustomRating', context);
}
if (item.Type == "TvChannel") {
if (item.Type === "TvChannel") {
hideElement('#tagsCollapsible', context);
hideElement('#metadataSettingsCollapsible', context);
hideElement('#fldPremiereDate', context);
@ -712,19 +714,19 @@
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);
} else {
hideElement('#keywordsCollapsible', context);
}
if (item.MediaType == "Video" && item.Type != "TvChannel") {
if (item.MediaType === "Video" && item.Type !== "TvChannel") {
showElement('#fldSourceType', context);
} else {
hideElement('#fldSourceType', context);
}
if (item.Type == "Person") {
if (item.Type === "Person") {
//todo
context.querySelector('#txtProductionYear').label(globalize.translate('sharedcomponents#LabelBirthYear'));
context.querySelector("#txtPremiereDate").label(globalize.translate('sharedcomponents#LabelBirthDate'));
@ -737,20 +739,20 @@
hideElement('#fldPlaceOfBirth');
}
if (item.MediaType == "Video" && item.Type != "TvChannel") {
if (item.MediaType === "Video" && item.Type !== "TvChannel") {
showElement('#fldOriginalAspectRatio');
} else {
hideElement('#fldOriginalAspectRatio');
}
if (item.Type == "Audio" || item.Type == "Episode" || item.Type == "Season") {
if (item.Type === "Audio" || item.Type === "Episode" || item.Type === "Season") {
showElement('#fldIndexNumber');
if (item.Type == "Episode") {
if (item.Type === "Episode") {
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'));
} else if (item.Type == "Audio") {
} else if (item.Type === "Audio") {
context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelTrackNumber'));
} else {
context.querySelector('#txtIndexNumber').label(globalize.translate('sharedcomponents#LabelNumber'));
@ -759,12 +761,12 @@
hideElement('#fldIndexNumber');
}
if (item.Type == "Audio" || item.Type == "Episode") {
if (item.Type === "Audio" || item.Type === "Episode") {
showElement('#fldParentIndexNumber');
if (item.Type == "Episode") {
if (item.Type === "Episode") {
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelSeasonNumber'));
} else if (item.Type == "Audio") {
} else if (item.Type === "Audio") {
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelDiscNumber'));
} else {
context.querySelector('#txtParentIndexNumber').label(globalize.translate('LabelParentNumber'));
@ -773,7 +775,7 @@
hideElement('#fldParentIndexNumber', context);
}
if (item.Type == "BoxSet") {
if (item.Type === "BoxSet") {
showElement('#fldDisplayOrder', context);
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 hiddenDisplaySettingFields = Array.prototype.filter.call(displaySettingFields, function (field) {
return field.style.display != 'none';
return field.style.display !== 'none';
});
if (hiddenDisplaySettingFields.length) {
@ -815,7 +817,7 @@
context.querySelector('#select3dFormat', context).value = item.Video3DFormat || "";
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);
@ -830,9 +832,9 @@
var chkLockData = context.querySelector("#chkLockData");
chkLockData.checked = lockData;
if (chkLockData.checked) {
hideElement('.providerSettingsContainer', context)
hideElement('.providerSettingsContainer', context);
} else {
showElement('.providerSettingsContainer', context)
showElement('.providerSettingsContainer', context);
}
populateInternetProviderSettings(context, item, item.LockedFields);
@ -957,7 +959,7 @@
ratings.push({ Name: rating.Name, Value: rating.Name });
if (rating.Name == currentValue) {
if (rating.Name === currentValue) {
currentValueFound = true;
}
}
@ -1037,7 +1039,7 @@
html += (person.Name || '');
html += '</div>';
if (person.Role && person.Role != lastType) {
if (person.Role && person.Role !== lastType) {
html += '<div class="secondary">' + (person.Role) + '</div>';
}
@ -1060,7 +1062,7 @@
var field = fields[i];
var name = 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 += '<input type="checkbox" is="emby-checkbox" class="selectLockedField" data-value="' + value + '"' + checkedHtml + '/>';
html += '<span>' + name + '</span>';
@ -1071,7 +1073,7 @@
function populateInternetProviderSettings(context, item, lockedFields) {
var container = context.querySelector('.providerSettingsContainer');
lockedFields = lockedFields || new Array();
lockedFields = lockedFields || [];
var metadatafields = [
{ name: globalize.translate('sharedcomponents#Name'), value: "Name" },
@ -1081,13 +1083,13 @@
{ name: globalize.translate('sharedcomponents#People'), value: "Cast" }
];
if (item.Type == "Person") {
if (item.Type === "Person") {
metadatafields.push({ name: globalize.translate('sharedcomponents#BirthLocation'), value: "ProductionLocations" });
} else {
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" });
}
@ -1097,7 +1099,7 @@
metadatafields.push({ name: globalize.translate('sharedcomponents#Images'), value: "Images" });
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" });
}
@ -1133,13 +1135,13 @@
setFieldVisibilities(context, item);
fillItemInfo(context, item, metadataEditorInfo.ParentalRatingOptions);
if (item.MediaType == "Video" && item.Type != "Episode") {
if (item.MediaType === "Video" && item.Type !== "Episode") {
showElement('#fldShortOverview', context);
} else {
hideElement('#fldShortOverview', context);
}
if (item.MediaType == "Video" && item.Type != "Episode") {
if (item.MediaType === "Video" && item.Type !== "Episode") {
showElement('#fldTagline', context);
} else {
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) {
'use strict';
function centerFocus(elem, horiz, on) {
require(['scrollHelper'], function (scrollHelper) {
@ -59,7 +60,7 @@
dlg.querySelector('.selectPersonType').addEventListener('change', function (e) {
if (this.value == 'Actor') {
if (this.value === 'Actor') {
dlg.querySelector('.fldRole').classList.remove('hide');
} else {
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';
function fallback(urls) {
@ -48,7 +48,7 @@ function download(url) {
a.dispatchEvent(new MouseEvent('click'));
}
module.exports = function (urls) {
return function (urls) {
if (!urls) {
throw new Error('`urls` required');
}
@ -67,7 +67,5 @@ module.exports = function (urls) {
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) {
'use strict';
var selectedItems = [];
var selectedElements = [];
@ -54,7 +55,7 @@
if (selected) {
var current = selectedItems.filter(function (i) {
return i == id;
return i === id;
});
if (!current.length) {
@ -64,10 +65,10 @@
} else {
selectedItems = selectedItems.filter(function (i) {
return i != id;
return i !== id;
});
selectedElements = selectedElements.filter(function (i) {
return i != chkItemSelect;
return i !== chkItemSelect;
});
}
@ -130,7 +131,7 @@
html += '<span class="itemSelectionCount"></span>';
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>';
selectionCommandsPanel.innerHTML = html;
@ -354,7 +355,7 @@
var container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer');
if (container && elems.indexOf(container) == -1) {
if (container && elems.indexOf(container) === -1) {
elems.push(container);
}
});
@ -400,7 +401,7 @@
require(['emby-checkbox'], function () {
var cards = document.querySelectorAll('.card');
for (var i = 0, length = cards.length; i < length; i++) {
showSelection(cards[i], initialCard == cards[i]);
showSelection(cards[i], initialCard === cards[i]);
}
showSelectionCommands();

View file

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

View file

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

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) {
'use strict';
var currentServerId;

View file

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

View file

@ -1,4 +1,5 @@
define([], function () {
'use strict';
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) {
'use strict';
function setInputProperties(dlg, options) {
var txtInput = dlg.querySelector('#txtInput');

View file

@ -1,4 +1,5 @@
define([], function () {
'use strict';
function getVideoQualityOptions(maxStreamingBitrate, videoWidth) {
@ -60,12 +61,12 @@
var option = options[i];
if (selectedIndex == -1 && option.bitrate <= maxStreamingBitrate) {
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i;
}
}
if (selectedIndex == -1) {
if (selectedIndex === -1) {
selectedIndex = options.length - 1;
}
@ -74,7 +75,7 @@
}
return options;
};
}
return {
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) {
'use strict';
var currentDialog;
var closeAction;
@ -110,7 +111,7 @@
function executeCloseAction(action, programId, serverId) {
if (action == 'play') {
if (action === 'play') {
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) {
'use strict';
var currentDialog;
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) {
'use strict';
function getRegistration(apiClient, programId, feature) {
@ -114,7 +115,7 @@
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('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active');
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('sharedcomponents#DoNotRecord');
@ -142,7 +143,7 @@
});
}
function recordingEditor(options) {
function RecordingEditor(options) {
this.options = options;
this.embed();
}
@ -155,7 +156,7 @@
var options = this.options;
if (!this.TimerId || this.Status == 'Cancelled') {
if (!this.TimerId || this.Status === 'Cancelled') {
return;
}
@ -206,7 +207,7 @@
var button = dom.parentWithTag(e.target, 'BUTTON');
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 (!hasEnabledTimer) {
@ -272,7 +273,7 @@
}
}
recordingEditor.prototype.embed = function () {
RecordingEditor.prototype.embed = function () {
var self = this;
@ -299,19 +300,19 @@
});
};
recordingEditor.prototype.hasChanged = function () {
RecordingEditor.prototype.hasChanged = function () {
return this.changed;
};
recordingEditor.prototype.refresh = function () {
RecordingEditor.prototype.refresh = function () {
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) {
'use strict';
function changeRecordingToSeries(apiClient, timerId, programId) {
@ -129,7 +130,7 @@
var apiClient = connectionManager.getApiClient(serverId);
var hasTimer = timerId && timerStatus != 'Cancelled';
var hasTimer = timerId && timerStatus !== 'Cancelled';
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) {
'use strict';
var currentDialog;
var recordingUpdated = false;
@ -60,9 +61,9 @@
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
item.PostPaddingSeconds = form.querySelector('#txtPostPaddingMinutes').value * 60;
item.RecordAnyChannel = form.querySelector('.selectChannels').value == 'all';
item.RecordAnyTime = form.querySelector('.selectAirTime').value == 'any';
item.RecordNewOnly = form.querySelector('.selectShowType').value == 'new';
item.RecordAnyChannel = form.querySelector('.selectChannels').value === 'all';
item.RecordAnyTime = form.querySelector('.selectAirTime').value === 'any';
item.RecordNewOnly = form.querySelector('.selectShowType').value === 'new';
item.SkipEpisodesInLibrary = form.querySelector('.chkSkipEpisodesInLibrary').checked;
item.KeepUpTo = form.querySelector('.selectKeepUpTo').value;
@ -116,9 +117,9 @@
var text;
if (i == 0) {
if (i === 0) {
text = globalize.translate('sharedcomponents#AsManyAsPossible');
} else if (i == 1) {
} else if (i === 1) {
text = globalize.translate('sharedcomponents#ValueOneEpisode');
} else {
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) {
'use strict';
function parentWithClass(elem, className) {
@ -71,7 +72,7 @@
var apiClient = connectionManager.getApiClient(options.serverId);
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) {
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) {
'use strict';
var currentDisplayingProductInfos = [];
var currentDisplayingResolve = null;
@ -157,7 +158,7 @@
}, function () {
var unlockableFeatureCacheKey = 'featurepurchased-' + feature;
if (appSettings.get(unlockableFeatureCacheKey) == '1') {
if (appSettings.get(unlockableFeatureCacheKey) === '1') {
return Promise.resolve();
}
@ -173,7 +174,7 @@
return Promise.resolve();
}
if (appSettings.get(unlockableCacheKey) == '1') {
if (appSettings.get(unlockableCacheKey) === '1') {
return Promise.resolve();
}
}
@ -318,7 +319,7 @@
html += '</div>';
}
if (dialogOptions.feature == 'playback') {
if (dialogOptions.feature === 'playback') {
html += '<p>';
html += '<button is="emby-button" type="button" class="raised button-cancel block btnCloseDialog"><span>' + globalize.translate('sharedcomponents#ButtonPlayOneMinute') + '</span></button>';
html += '</p>';
@ -356,7 +357,7 @@
dialogHelper.close(dlg);
};
if (dialogOptions.feature == 'playback') {
if (dialogOptions.feature === 'playback') {
alertText({
text: globalize.translate('sharedcomponents#ThankYouForTryingEnjoyOneMinute'),
title: globalize.translate('sharedcomponents#HeaderTryPlayback')
@ -475,7 +476,7 @@
var featureId = this.getAttribute('data-featureid');
if (this.getAttribute('data-email') == 'true') {
if (this.getAttribute('data-email') === 'true') {
getUserEmail().then(function (email) {
iapManager.beginPurchase(featureId, email);
});
@ -595,7 +596,7 @@
if (resolve && currentDisplayingProductInfos.filter(function (p) {
return product.id == p.id;
return product.id === p.id;
}).length) {

View file

@ -1,17 +1,20 @@
define(function () {
'use strict';
var requireCss = {};
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);
}
return normalize(name);
}
};
var importedCss = [];
function isLoaded(url) {
return importedCss.indexOf(url) != -1;
return importedCss.indexOf(url) !== -1;
}
function removeFromLoadHistory(url) {
@ -19,7 +22,7 @@ define(function () {
url = url.toLowerCase();
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 index = cssId.indexOf(srch);
if (index != -1) {
if (index !== -1) {
cssId = 'css' + cssId.substring(index + srch.length);
}
var url = cssId + '.css';
if (url.indexOf('://') == -1) {
if (url.indexOf('://') === -1) {
url = config.baseUrl + url;
}
@ -58,7 +61,7 @@ define(function () {
} else {
load();
}
}
};
window.requireCss = {
removeStylesheet: function (stylesheet) {

View file

@ -1,4 +1,5 @@
define(function () {
'use strict';
var importedFiles = [];
@ -11,18 +12,18 @@ define(function () {
var url = cssId + '.html';
if (url.indexOf('://') == -1) {
if (url.indexOf('://') === -1) {
url = config.baseUrl + url;
}
if (importedFiles.indexOf(url) == -1) {
if (importedFiles.indexOf(url) === -1) {
importedFiles.push(url);
var link = document.createElement('link');
link.rel = 'import';
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);
}
}
@ -39,8 +40,9 @@ define(function () {
},
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);
}
return normalize(name);
}

View file

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

View file

@ -1,4 +1,5 @@
define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], function (browser, layoutManager, dom, focusManager) {
'use strict';
/**
* Return type of the value.
@ -65,7 +66,7 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
var scrollerFactory = function (frame, options) {
// Extend options
var o = extend({}, {
var o = Object.assign({}, {
slidee: null, // Selector, DOM element, or jQuery object with DOM element representing SLIDEE.
horizontal: false, // Switch to horizontal mode.
@ -483,7 +484,6 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
if (type(item) === 'boolean') {
immediate = item;
item = undefined;
v
}
if (item === undefined) {
@ -539,14 +539,6 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
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.
*
@ -642,7 +634,9 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
dragging.path = sqrt(pow(dragging.pathX, 2) + pow(dragging.pathY, 2));
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...
if (!dragging.init) {
@ -721,7 +715,7 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
while (element) {
if (interactiveElements.indexOf(element.tagName) != -1) {
if (interactiveElements.indexOf(element.tagName) !== -1) {
return true;
}
@ -832,9 +826,9 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
}
function onFrameClick(e) {
if (e.which == 1) {
if (e.which === 1) {
var focusableParent = focusManager.focusableParent(e.target);
if (focusableParent && focusableParent != document.activeElement) {
if (focusableParent && focusableParent !== document.activeElement) {
focusableParent.focus();
}
}
@ -851,7 +845,9 @@ define(['browser', 'layoutManager', 'dom', 'focusManager', 'scrollStyles'], func
}
// 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;

View file

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

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'events'], function (connectionManager, events) {
'use strict';
var serverNotifications = {};
@ -8,7 +9,7 @@ define(['connectionManager', 'events'], function (connectionManager, events) {
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++) {
events.trigger(serverNotifications, 'UserDataChanged', [apiClient, msg.Data.UserDataList[i]]);

View file

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

View file

@ -1,4 +1,6 @@
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) {
'use strict';
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) {
'use strict';
function showMenu(options) {
@ -24,7 +25,7 @@
html += '<a href="#" class="ssk ssk-tumblr" style="color:#fff;"></a>';
html += '</div>';
dlg.style['padding'] = '.5em 1.5em 1.5em';
dlg.style.padding = '.5em 1.5em 1.5em';
dlg.innerHTML = html;

View file

@ -1,4 +1,5 @@
define([], function () {
'use strict';
return {
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) {
'use strict';
function playAllFromHere(card, serverId, queue) {
@ -10,7 +11,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var foundCard = false;
for (var i = 0, length = cards.length; i < length; i++) {
if (cards[i] == card) {
if (cards[i] === card) {
foundCard = true;
}
if (foundCard) {
@ -58,7 +59,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}).indexOf(startItemId);
if (index == -1) {
if (index === -1) {
index = 0;
}
@ -82,7 +83,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
function showItem(item, options) {
if (item.Type == 'Photo') {
if (item.Type === 'Photo') {
showSlideshow(item.Id, item.ServerId);
return;
@ -108,10 +109,10 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var apiClient = connectionManager.getApiClient(serverId);
if (type == 'Timer') {
if (type === 'Timer') {
return apiClient.getLiveTvTimer(id);
}
if (type == 'SeriesTimer') {
if (type === 'SeriesTimer') {
return apiClient.getLiveTvSeriesTimer(id);
}
return apiClient.getItem(apiClient.getCurrentUserId(), id);
@ -142,12 +143,14 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}, 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);
}
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) {
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) {
itemsContainer.dispatchEvent(new CustomEvent('timercancelled', {
@ -185,7 +188,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
SeriesId: card.getAttribute('data-seriesid'),
ServerId: card.getAttribute('data-serverid'),
MediaType: card.getAttribute('data-mediatype'),
IsFolder: card.getAttribute('data-isfolder') == 'true',
IsFolder: card.getAttribute('data-isfolder') === 'true',
UserData: {
PlaybackPositionTicks: parseInt(card.getAttribute('data-positionticks') || '0')
}
@ -222,23 +225,23 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var serverId = item.ServerId;
var type = item.Type;
if (action == 'link') {
if (action === 'link') {
showItem(item, {
context: card.getAttribute('data-context')
});
}
else if (action == 'programdialog') {
else if (action === 'programdialog') {
showProgramDialog(item);
}
else if (action == 'instantmix') {
else if (action === 'instantmix') {
playbackManager.instantMix(id, serverId);
}
else if (action == 'play') {
else if (action === 'play') {
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);
}
else if (action == 'queueallfromhere') {
else if (action === 'queueallfromhere') {
playAllFromHere(card, serverId, true);
}
else if (action == 'setplaylistindex') {
else if (action === 'setplaylistindex') {
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'));
}
else if (action == 'menu') {
else if (action === 'menu') {
var options = target.getAttribute('data-playoptions') == 'false' ?
var options = target.getAttribute('data-playoptions') === 'false' ?
{
shuffle: false,
instantMix: false,
@ -283,17 +286,17 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
showContextMenu(card, options);
}
else if (action == 'playmenu') {
else if (action === 'playmenu') {
showPlayMenu(card, target);
}
else if (action == 'edit') {
else if (action === 'edit') {
getItem(target).then(function (item) {
editItem(item, serverId);
});
}
else if (action == 'playtrailer') {
else if (action === 'playtrailer') {
getItem(target).then(playTrailer);
}
}
@ -315,7 +318,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var serverId = apiClient.serverInfo().Id;
if (item.Type == 'Timer') {
if (item.Type === 'Timer') {
if (item.ProgramId) {
require(['recordingCreator'], function (recordingCreator) {
@ -338,9 +341,9 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
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);
}
}
@ -373,7 +376,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
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');
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) {
'use strict';
function getImageUrl(item, options, apiClient) {
@ -15,7 +16,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
return apiClient.getScaledImageUrl(item.Id, options);
}
if (options.type == 'Primary') {
if (options.type === 'Primary') {
if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag;
@ -57,7 +58,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
return getBackdropImageUrl(item, imageOptions, apiClient);
} else {
if (item.MediaType == 'Photo' && original) {
if (item.MediaType === 'Photo' && original) {
return apiClient.getUrl("Items/" + item.Id + "/Download", {
api_key: apiClient.accessToken()
});
@ -351,7 +352,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
function playPause() {
var paused = dlg.querySelector('.btnSlideshowPause i').innerHTML != "pause";
var paused = dlg.querySelector('.btnSlideshowPause i').innerHTML !== "pause";
if (paused) {
play();
} else {
@ -387,6 +388,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
}
var _osdOpen = false;
function isOsdOpen() {
return _osdOpen;
}
@ -413,10 +415,12 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
}
var hideTimeout;
function startHideTimer() {
stopHideTimer();
hideTimeout = setTimeout(hideOsd, 4000);
}
function stopHideTimer() {
if (hideTimeout) {
clearTimeout(hideTimeout);
@ -437,7 +441,8 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var keyframes = [
{ 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' };
elem.animate(keyframes, timing).onfinish = function () {
focusManager.focus(elem.querySelector('.btnSlideshowPause'));
@ -455,7 +460,8 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var keyframes = [
{ 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' };
elem.animate(keyframes, timing).onfinish = function () {
elem.classList.add('hide');
@ -465,6 +471,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
}
var lastMouseMoveData;
function onMouseMove(e) {
var eventX = e.screenX || 0;
@ -573,7 +580,8 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var keyframes = [
{ opacity: '0', offset: 0 },
{ opacity: '1', offset: 1 }];
{ opacity: '1', offset: 1 }
];
var timing = { duration: 1200, iterations: 1 };
newCardImageContainer.animate(keyframes, timing).onfinish = onAnimationFinished;
} else {
@ -615,5 +623,5 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
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) {
'use strict';
var currentItem;
var hasChanges;
@ -104,7 +105,7 @@
var subs = streams.filter(function (s) {
return s.Type == 'Subtitle';
return s.Type === 'Subtitle';
});
var html = '';
@ -223,7 +224,7 @@
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++) {
@ -231,7 +232,7 @@
var provider = result.ProviderName;
if (provider != lastProvider) {
if (provider !== lastProvider) {
if (i > 0) {
html += '</div>';
@ -336,7 +337,7 @@
loading.hide();
}
if (typeof itemId == 'string') {
if (typeof itemId === 'string') {
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(onGetItem);
}
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) {
'use strict';
var currentDialogOptions;
@ -57,7 +58,7 @@
dialogHelper.close(dlg);
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);
});
@ -109,7 +110,7 @@
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);
});
@ -189,7 +190,7 @@
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 += '<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) {
var isSelected = t.Id == appInfo.deviceId;
var isSelected = t.Id === appInfo.deviceId;
var selectedHtml = isSelected ? ' selected="selected"' : '';
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 += '</div>';
if (dialogOptions.Options.indexOf('UnwatchedOnly') != -1) {
if (dialogOptions.Options.indexOf('UnwatchedOnly') !== -1) {
html += '<div class="checkboxContainer checkboxContainer-withDescription">';
html += '<label>';
html += '<input is="emby-checkbox" type="checkbox" id="chkUnwatchedOnly"/>';
@ -245,7 +246,7 @@
html += '</div>';
}
if (dialogOptions.Options.indexOf('SyncNewContent') != -1) {
if (dialogOptions.Options.indexOf('SyncNewContent') !== -1) {
html += '<div class="checkboxContainer checkboxContainer-withDescription">';
html += '<label>';
html += '<input is="emby-checkbox" type="checkbox" id="chkSyncNewContent"/>';
@ -255,7 +256,7 @@
html += '</div>';
}
if (dialogOptions.Options.indexOf('ItemLimit') != -1) {
if (dialogOptions.Options.indexOf('ItemLimit') !== -1) {
html += '<div class="inputContainer">';
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>';
@ -330,16 +331,16 @@
var firstItem = (options.items || [])[0] || {};
if (firstItem.Type == 'Audio') {
if (firstItem.Type === 'Audio') {
return true;
}
if (firstItem.Type == 'MusicAlbum') {
if (firstItem.Type === 'MusicAlbum') {
return true;
}
if (firstItem.Type == 'MusicArtist') {
if (firstItem.Type === 'MusicArtist') {
return true;
}
if (firstItem.Type == 'MusicGenre') {
if (firstItem.Type === 'MusicGenre') {
return true;
}
@ -492,17 +493,17 @@
var options = currentDialogOptions || {};
var option = (options.ProfileOptions || []).filter(function (o) {
return o.Id == profileId;
return o.Id === profileId;
})[0];
var qualityOptions = options.QualityOptions || [];
if (option) {
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 {
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 option = (options.QualityOptions || []).filter(function (o) {
return o.Id == qualityId;
return o.Id === qualityId;
})[0];
var qualityDescription = form.querySelector('.qualityDescription');
@ -524,7 +525,7 @@
var fldBitrate = form.querySelector('.fldBitrate');
var txtBitrate = form.querySelector('#txtBitrate');
if (qualityId == 'custom') {
if (qualityId === 'custom') {
if (fldBitrate) {
fldBitrate.classList.remove('hide');
@ -549,7 +550,7 @@
var fldProfile = form.querySelector('.fldProfile');
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) {
fldProfile.classList.remove('hide');
}

View file

@ -1,4 +1,5 @@
define(['playbackManager', 'userSettings'], function (playbackManager, userSettings) {
'use strict';
var currentOwnerId;
var currentThemeIds = [];
@ -39,7 +40,7 @@ define(['playbackManager', 'userSettings'], function (playbackManager, userSetti
function enabled(mediaType) {
if (mediaType == 'Video') {
if (mediaType === 'Video') {
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;
if (ownerId != currentOwnerId) {
if (ownerId !== currentOwnerId) {
var items = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.Items : themeMediaResult.ThemeSongsResult.Items;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
// <date>09.10.2015</date>
// <summary>voicecommands class</summary>
define(['require'], function (require) {
'use strict';
/// <summary> Process the command. </summary>
/// <param name="commandPath"> Full pathname of the command file. </param>
@ -31,30 +32,22 @@ define(['require'], function (require) {
case 'show':
return processCommand('./commands/showcommands.js', result);
break;
case 'play':
return processCommand('./commands/playcommands.js', result);
break;
case 'shuffle':
return processCommand('./commands/playcommands.js', result);
break;
case 'search':
return processCommand('./commands/searchcommands.js', result);
break;
case 'control':
return processCommand('./commands/controlcommands.js', result);
break;
case 'enable':
return processCommand('./commands/enablecommands.js', result);
break;
case 'disable':
return processCommand('./commands/disablecommands.js', result);
break;
case 'toggle':
return processCommand('./commands/togglecommands.js', result);
break;
default:
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) {
'use strict';
var lang = 'en-US';
@ -33,7 +34,7 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
var commands = [];
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) {
@ -63,12 +64,15 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
idx = commandgroups.map(function (e) { return e.groupid; }).indexOf(groupid);
if (idx > -1)
if (idx > -1) {
return commandgroups[idx];
else
}
else {
return null;
} else
}
} else {
return null;
}
});
}
@ -99,6 +103,10 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
var isNewDialog = false;
var dlg;
function onCancelClick() {
dialogHelper.close(dlg);
}
if (!currentDialog) {
isNewDialog = true;
@ -166,10 +174,6 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
currentDialog = null;
});
function onCancelClick() {
dialogHelper.close(dlg);
}
var closeButtons = dlg.querySelectorAll('.btnCancelVoiceInput');
for (var i = 0, length = closeButtons.length; i < length; i++) {
closeButtons[i].addEventListener('click', onCancelClick);
@ -214,8 +218,9 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
/// <returns> . </returns>
function showUnrecognizedCommandHelp(command) {
//speak("I don't understend this command");
if (command)
if (command) {
currentDialog.querySelector('.voiceInputText').innerText = command;
}
currentDialog.querySelector('.unrecognizedCommand').classList.remove('hide');
currentDialog.querySelector('.defaultVoiceHelp').classList.add('hide');
}
@ -225,11 +230,13 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
/// <returns> . </returns>
function showCommands(result) {
//speak('Hello, what can I do for you?');
if (result)
if (result) {
showVoiceHelp(result.groupid, result.name);
else
}
else {
showVoiceHelp();
}
}
function resetDialog() {
if (currentDialog) {
@ -257,7 +264,7 @@ define(['dialogHelper', 'voiceReceiver', 'voiceProcessor', 'globalize', 'emby-bu
}, 1);
}, function (result) {
if (result.error == 'group') {
if (result.error === 'group') {
showVoiceHelp(result.item.groupid, result.groupName);
return;
}

View file

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

View file

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