Apply ESLint autofix for no-yoda rule

This commit is contained in:
MrTimscampi 2020-07-30 16:07:13 +02:00
parent 642e2624e5
commit 22a46ecea6
49 changed files with 440 additions and 440 deletions

View File

@ -16,7 +16,7 @@ import 'listViewStyle';
let color = '#00a4dc'; let color = '#00a4dc';
let icon = 'notifications'; let icon = 'notifications';
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) { if (entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn') {
color = '#cc0000'; color = '#cc0000';
icon = 'notification_important'; icon = 'notification_important';
} }
@ -60,13 +60,13 @@ import 'listViewStyle';
} }
function reloadData(instance, elem, apiClient, startIndex, limit) { function reloadData(instance, elem, apiClient, startIndex, limit) {
if (null == startIndex) { if (startIndex == null) {
startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0'); startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0');
} }
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7'); limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
const minDate = new Date(); const minDate = new Date();
const hasUserId = 'false' !== elem.getAttribute('data-useractivity'); const hasUserId = elem.getAttribute('data-useractivity') !== 'false';
// TODO: Use date-fns // TODO: Use date-fns
if (hasUserId) { if (hasUserId) {

View File

@ -47,7 +47,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder); profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
} else { } else {
var builderOpts = getBaseProfileOptions(item); var builderOpts = getBaseProfileOptions(item);
builderOpts.enableSsaRender = (item && !options.isRetry && 'allcomplexformats' !== appSettings.get('subtitleburnin')); builderOpts.enableSsaRender = (item && !options.isRetry && appSettings.get('subtitleburnin') !== 'allcomplexformats');
profile = profileBuilder(builderOpts); profile = profileBuilder(builderOpts);
} }
@ -370,7 +370,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
return window.NativeShell.AppHost.supports(command); return window.NativeShell.AppHost.supports(command);
} }
return -1 !== supportedFeatures.indexOf(command.toLowerCase()); return supportedFeatures.indexOf(command.toLowerCase()) !== -1;
}, },
preferVisualCards: browser.android || browser.chrome, preferVisualCards: browser.android || browser.chrome,
getSyncProfile: getSyncProfile, getSyncProfile: getSyncProfile,

View File

@ -120,7 +120,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
var promise; var promise;
if ('MusicArtist' === section.types) { if (section.types === 'MusicArtist') {
promise = ApiClient.getArtists(userId, options); promise = ApiClient.getArtists(userId, options);
} else { } else {
options.IncludeItemTypes = section.types; options.IncludeItemTypes = section.types;
@ -160,7 +160,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
preferThumb: section.preferThumb, preferThumb: section.preferThumb,
shape: section.shape, shape: section.shape,
centerText: section.centerText && !cardLayout, centerText: section.centerText && !cardLayout,
overlayText: false !== section.overlayText, overlayText: section.overlayText !== false,
showTitle: section.showTitle, showTitle: section.showTitle,
showParentTitle: section.showParentTitle, showParentTitle: section.showParentTitle,
scalable: true, scalable: true,
@ -192,7 +192,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
if (types) { if (types) {
sections = sections.filter(function (s) { sections = sections.filter(function (s) {
return -1 !== types.indexOf(s.id); return types.indexOf(s.id) !== -1;
}); });
} }
@ -215,7 +215,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
for (i = 0, length = sections.length; i < length; i++) { for (i = 0, length = sections.length; i < length; i++) {
var section = sections[i]; var section = sections[i];
elem = page.querySelector('.section' + section.id); elem = page.querySelector('.section' + section.id);
promises.push(loadSection(elem, userId, topParentId, section, 1 === sections.length)); promises.push(loadSection(elem, userId, topParentId, section, sections.length === 1));
} }
Promise.all(promises).then(function () { Promise.all(promises).then(function () {

View File

@ -21,7 +21,7 @@ import connectionManager from 'connectionManager';
if (!actionableParent || actionableParent.classList.contains('cardContent')) { if (!actionableParent || actionableParent.classList.contains('cardContent')) {
apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) { apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
if (1 === items.length) { if (items.length === 1) {
return void appRouter.showItem(items[0]); return void appRouter.showItem(items[0]);
} }

View File

@ -16,7 +16,7 @@ import 'emby-input';
return { return {
Type: type, Type: type,
MinWidth: 0, MinWidth: 0,
Limit: 'Primary' === type ? 1 : 0 Limit: type === 'Primary' ? 1 : 0
}; };
} }

View File

@ -219,7 +219,7 @@ import 'emby-input';
html += '<div class="flex align-items-center" style="margin:1.5em 0 .5em;">'; html += '<div class="flex align-items-center" style="margin:1.5em 0 .5em;">';
html += '<h3 class="checkboxListLabel" style="margin:0;">' + globalize.translate('HeaderTypeImageFetchers', availableTypeOptions.Type) + '</h3>'; html += '<h3 class="checkboxListLabel" style="margin:0;">' + globalize.translate('HeaderTypeImageFetchers', availableTypeOptions.Type) + '</h3>';
const supportedImageTypes = availableTypeOptions.SupportedImageTypes || []; const supportedImageTypes = availableTypeOptions.SupportedImageTypes || [];
if (supportedImageTypes.length > 1 || 1 === supportedImageTypes.length && 'Primary' !== supportedImageTypes[0]) { if (supportedImageTypes.length > 1 || supportedImageTypes.length === 1 && supportedImageTypes[0] !== 'Primary') {
html += '<button is="emby-button" class="raised btnImageOptionsForType" type="button" style="margin-left:1.5em;font-size:90%;"><span>' + globalize.translate('HeaderFetcherSettings') + '</span></button>'; html += '<button is="emby-button" class="raised btnImageOptionsForType" type="button" style="margin-left:1.5em;font-size:90%;"><span>' + globalize.translate('HeaderFetcherSettings') + '</span></button>';
} }
html += '</div>'; html += '</div>';
@ -362,7 +362,7 @@ import 'emby-input';
TypeOptions: [] TypeOptions: []
}; };
currentAvailableOptions = null; currentAvailableOptions = null;
const isNewLibrary = null === libraryOptions; const isNewLibrary = libraryOptions === null;
isNewLibrary && parent.classList.add('newlibrary'); isNewLibrary && parent.classList.add('newlibrary');
const response = await fetch('components/libraryoptionseditor/libraryoptionseditor.template.html'); const response = await fetch('components/libraryoptionseditor/libraryoptionseditor.template.html');
const template = await response.text(); const template = await response.text();
@ -578,7 +578,7 @@ import 'emby-input';
parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches; parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;
parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch; parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch;
Array.prototype.forEach.call(parent.querySelectorAll('.chkMetadataSaver'), elem => { Array.prototype.forEach.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
elem.checked = options.MetadataSavers ? options.MetadataSavers.includes(elem.getAttribute('data-pluginname')) : 'true' === elem.getAttribute('data-defaultenabled'); elem.checked = options.MetadataSavers ? options.MetadataSavers.includes(elem.getAttribute('data-pluginname')) : elem.getAttribute('data-defaultenabled') === 'true';
}); });
Array.prototype.forEach.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => { Array.prototype.forEach.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => {
elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang')); elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang'));

View File

@ -98,8 +98,8 @@ import 'flexStyles';
if (listItem) { if (listItem) {
const index = parseInt(listItem.getAttribute('data-index')); const index = parseInt(listItem.getAttribute('data-index'));
const pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || []; const pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || [];
const pathInfo = null == index ? {} : pathInfos[index] || {}; const pathInfo = index == null ? {} : pathInfos[index] || {};
const originalPath = pathInfo.Path || (null == index ? null : currentOptions.library.Locations[index]); const originalPath = pathInfo.Path || (index == null ? null : currentOptions.library.Locations[index]);
const btnRemovePath = dom.parentWithClass(e.target, 'btnRemovePath'); const btnRemovePath = dom.parentWithClass(e.target, 'btnRemovePath');
if (btnRemovePath) { if (btnRemovePath) {
@ -171,7 +171,7 @@ import 'flexStyles';
const picker = new directoryBrowser(); const picker = new directoryBrowser();
picker.show({ picker.show({
enableNetworkSharePath: true, enableNetworkSharePath: true,
pathReadOnly: null != originalPath, pathReadOnly: originalPath != null,
path: originalPath, path: originalPath,
networkSharePath: networkPath, networkSharePath: networkPath,
callback: function (path, networkSharePath) { callback: function (path, networkSharePath) {

View File

@ -48,7 +48,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
menuItems.unshift({ menuItems.unshift({
id: -1, id: -1,
name: globalize.translate('ButtonOff'), name: globalize.translate('ButtonOff'),
selected: null == currentIndex selected: currentIndex == null
}); });
require(['actionsheet'], function (actionsheet) { require(['actionsheet'], function (actionsheet) {
@ -69,18 +69,18 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
} }
function seriesImageUrl(item, options) { function seriesImageUrl(item, options) {
if ('Episode' !== item.Type) { if (item.Type !== 'Episode') {
return null; return null;
} }
options = options || {}; options = options || {};
options.type = options.type || 'Primary'; options.type = options.type || 'Primary';
if ('Primary' === options.type && item.SeriesPrimaryImageTag) { if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag; options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
if ('Thumb' === options.type) { if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) { if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag; options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
@ -210,7 +210,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
backdrop.setBackdrops([item]); backdrop.setBackdrops([item]);
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) { apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
var userData = fullItem.UserData || {}; var userData = fullItem.UserData || {};
var likes = null == userData.Likes ? '' : userData.Likes; var likes = userData.Likes == null ? '' : userData.Likes;
context.querySelector('.nowPlayingPageUserDataButtonsTitle').innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><span class="material-icons favorite"></span></button>'; context.querySelector('.nowPlayingPageUserDataButtonsTitle').innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><span class="material-icons favorite"></span></button>';
context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><span class="material-icons favorite"></span></button>'; context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><span class="material-icons favorite"></span></button>';
}); });
@ -251,7 +251,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
var all = context.querySelectorAll('.btnCommand'); var all = context.querySelectorAll('.btnCommand');
for (var i = 0, length = all.length; i < length; i++) { for (var i = 0, length = all.length; i < length; i++) {
var enableButton = -1 !== commands.indexOf(all[i].getAttribute('data-command')); var enableButton = commands.indexOf(all[i].getAttribute('data-command')) !== -1;
all[i].disabled = !enableButton; all[i].disabled = !enableButton;
} }
} }
@ -278,7 +278,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
currentPlayerSupportedCommands = supportedCommands; currentPlayerSupportedCommands = supportedCommands;
var playState = state.PlayState || {}; var playState = state.PlayState || {};
var isSupportedCommands = supportedCommands.includes('DisplayMessage') || supportedCommands.includes('SendString') || supportedCommands.includes('Select'); var isSupportedCommands = supportedCommands.includes('DisplayMessage') || supportedCommands.includes('SendString') || supportedCommands.includes('Select');
buttonVisible(context.querySelector('.btnToggleFullscreen'), item && 'Video' == item.MediaType && supportedCommands.includes('ToggleFullscreen')); buttonVisible(context.querySelector('.btnToggleFullscreen'), item && item.MediaType == 'Video' && supportedCommands.includes('ToggleFullscreen'));
updateAudioTracksDisplay(player, context); updateAudioTracksDisplay(player, context);
updateSubtitleTracksDisplay(player, context); updateSubtitleTracksDisplay(player, context);
@ -306,15 +306,15 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
context.querySelector('.remoteControlSection').classList.add('hide'); context.querySelector('.remoteControlSection').classList.add('hide');
} }
buttonVisible(context.querySelector('.btnStop'), null != item); buttonVisible(context.querySelector('.btnStop'), item != null);
buttonVisible(context.querySelector('.btnNextTrack'), null != item); buttonVisible(context.querySelector('.btnNextTrack'), item != null);
buttonVisible(context.querySelector('.btnPreviousTrack'), null != item); buttonVisible(context.querySelector('.btnPreviousTrack'), item != null);
if (layoutManager.mobile) { if (layoutManager.mobile) {
buttonVisible(context.querySelector('.btnRewind'), false); buttonVisible(context.querySelector('.btnRewind'), false);
buttonVisible(context.querySelector('.btnFastForward'), false); buttonVisible(context.querySelector('.btnFastForward'), false);
} else { } else {
buttonVisible(context.querySelector('.btnRewind'), null != item); buttonVisible(context.querySelector('.btnRewind'), item != null);
buttonVisible(context.querySelector('.btnFastForward'), null != item); buttonVisible(context.querySelector('.btnFastForward'), item != null);
} }
var positionSlider = context.querySelector('.nowPlayingPositionSlider'); var positionSlider = context.querySelector('.nowPlayingPositionSlider');
@ -325,15 +325,15 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
if (positionSlider && !positionSlider.dragging) { if (positionSlider && !positionSlider.dragging) {
positionSlider.disabled = !playState.CanSeek; positionSlider.disabled = !playState.CanSeek;
var isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks; var isProgressClear = state.MediaSource && state.MediaSource.RunTimeTicks == null;
positionSlider.setIsClear(isProgressClear); positionSlider.setIsClear(isProgressClear);
} }
updatePlayPauseState(playState.IsPaused, null != item); updatePlayPauseState(playState.IsPaused, item != null);
updateTimeDisplay(playState.PositionTicks, item ? item.RunTimeTicks : null); updateTimeDisplay(playState.PositionTicks, item ? item.RunTimeTicks : null);
updatePlayerVolumeState(context, playState.IsMuted, playState.VolumeLevel); updatePlayerVolumeState(context, playState.IsMuted, playState.VolumeLevel);
if (item && 'Video' == item.MediaType) { if (item && item.MediaType == 'Video') {
context.classList.remove('hideVideoButtons'); context.classList.remove('hideVideoButtons');
} else { } else {
context.classList.add('hideVideoButtons'); context.classList.add('hideVideoButtons');
@ -346,12 +346,12 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
function updateAudioTracksDisplay(player, context) { function updateAudioTracksDisplay(player, context) {
var supportedCommands = currentPlayerSupportedCommands; var supportedCommands = currentPlayerSupportedCommands;
buttonVisible(context.querySelector('.btnAudioTracks'), playbackManager.audioTracks(player).length > 1 && -1 != supportedCommands.indexOf('SetAudioStreamIndex')); buttonVisible(context.querySelector('.btnAudioTracks'), playbackManager.audioTracks(player).length > 1 && supportedCommands.indexOf('SetAudioStreamIndex') != -1);
} }
function updateSubtitleTracksDisplay(player, context) { function updateSubtitleTracksDisplay(player, context) {
var supportedCommands = currentPlayerSupportedCommands; var supportedCommands = currentPlayerSupportedCommands;
buttonVisible(context.querySelector('.btnSubtitles'), playbackManager.subtitleTracks(player).length && -1 != supportedCommands.indexOf('SetSubtitleStreamIndex')); buttonVisible(context.querySelector('.btnSubtitles'), playbackManager.subtitleTracks(player).length && supportedCommands.indexOf('SetSubtitleStreamIndex') != -1);
} }
function updateRepeatModeDisplay(repeatMode) { function updateRepeatModeDisplay(repeatMode) {
@ -383,11 +383,11 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
var view = context; var view = context;
var supportedCommands = currentPlayerSupportedCommands; var supportedCommands = currentPlayerSupportedCommands;
if (-1 === supportedCommands.indexOf('Mute')) { if (supportedCommands.indexOf('Mute') === -1) {
showMuteButton = false; showMuteButton = false;
} }
if (-1 === supportedCommands.indexOf('SetVolume')) { if (supportedCommands.indexOf('SetVolume') === -1) {
showVolumeSlider = false; showVolumeSlider = false;
} }
@ -452,8 +452,8 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
} }
} }
context.querySelector('.positionTime').innerHTML = null == positionTicks ? '--:--' : datetime.getDisplayRunningTime(positionTicks); context.querySelector('.positionTime').innerHTML = positionTicks == null ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
context.querySelector('.runtime').innerHTML = null != runtimeTicks ? datetime.getDisplayRunningTime(runtimeTicks) : '--:--'; context.querySelector('.runtime').innerHTML = runtimeTicks != null ? datetime.getDisplayRunningTime(runtimeTicks) : '--:--';
} }
function getPlaylistItems(player) { function getPlaylistItems(player) {

View File

@ -42,7 +42,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'listViewStyle', 'emb
for (var region in result) { for (var region in result) {
var countries = result[region]; var countries = result[region];
if (countries.length && 'ZZZ' !== region) { if (countries.length && region !== 'ZZZ') {
for (i = 0, length = countries.length; i < length; i++) { for (i = 0, length = countries.length; i < length; i++) {
countryList.push({ countryList.push({
name: countries[i].fullName, name: countries[i].fullName,
@ -237,7 +237,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'listViewStyle', 'emb
var device = devices[i]; var device = devices[i];
html += '<div class="listItem">'; html += '<div class="listItem">';
var enabledTuners = providerInfo.EnabledTuners || []; var enabledTuners = providerInfo.EnabledTuners || [];
var isChecked = providerInfo.EnableAllTuners || -1 !== enabledTuners.indexOf(device.Id); var isChecked = providerInfo.EnableAllTuners || enabledTuners.indexOf(device.Id) !== -1;
var checkedAttribute = isChecked ? ' checked' : ''; var checkedAttribute = isChecked ? ' checked' : '';
html += '<label class="checkboxContainer listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" data-id="' + device.Id + '" class="chkTuner" ' + checkedAttribute + '/><span></span></label>'; html += '<label class="checkboxContainer listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" data-id="' + device.Id + '" class="chkTuner" ' + checkedAttribute + '/><span></span></label>';
html += '<div class="listItemBody two-line">'; html += '<div class="listItemBody two-line">';

View File

@ -84,7 +84,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-input', 'listVi
}).then(function (result) { }).then(function (result) {
loading.hide(); loading.hide();
if (false !== options.showConfirmation) { if (options.showConfirmation !== false) {
Dashboard.processServerConfigurationUpdateResult(); Dashboard.processServerConfigurationUpdateResult();
} }
@ -118,7 +118,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-input', 'listVi
var device = devices[i]; var device = devices[i];
html += '<div class="listItem">'; html += '<div class="listItem">';
var enabledTuners = providerInfo.EnabledTuners || []; var enabledTuners = providerInfo.EnabledTuners || [];
var isChecked = providerInfo.EnableAllTuners || -1 !== enabledTuners.indexOf(device.Id); var isChecked = providerInfo.EnableAllTuners || enabledTuners.indexOf(device.Id) !== -1;
var checkedAttribute = isChecked ? ' checked' : ''; var checkedAttribute = isChecked ? ' checked' : '';
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkTuner" data-id="' + device.Id + '" ' + checkedAttribute + '><span></span></label>'; html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkTuner" data-id="' + device.Id + '" ' + checkedAttribute + '><span></span></label>';
html += '<div class="listItemBody two-line">'; html += '<div class="listItemBody two-line">';

View File

@ -9,7 +9,7 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
var controllerUrl = view.getAttribute('data-controller'); var controllerUrl = view.getAttribute('data-controller');
if (controllerUrl) { if (controllerUrl) {
if (0 === controllerUrl.indexOf('__plugin/')) { if (controllerUrl.indexOf('__plugin/') === 0) {
controllerUrl = controllerUrl.substring('__plugin/'.length); controllerUrl = controllerUrl.substring('__plugin/'.length);
} }
@ -31,14 +31,14 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
function loadView(options) { function loadView(options) {
if (!options.cancel) { if (!options.cancel) {
var selected = selectedPageIndex; var selected = selectedPageIndex;
var previousAnimatable = -1 === selected ? null : allPages[selected]; var previousAnimatable = selected === -1 ? null : allPages[selected];
var pageIndex = selected + 1; var pageIndex = selected + 1;
if (pageIndex >= pageContainerCount) { if (pageIndex >= pageContainerCount) {
pageIndex = 0; pageIndex = 0;
} }
var isPluginpage = -1 !== options.url.toLowerCase().indexOf('/configurationpage'); var isPluginpage = options.url.toLowerCase().indexOf('/configurationpage') !== -1;
var newViewInfo = normalizeNewView(options, isPluginpage); var newViewInfo = normalizeNewView(options, isPluginpage);
var newView = newViewInfo.elem; var newView = newViewInfo.elem;
var modulesToLoad = []; var modulesToLoad = [];
@ -53,7 +53,7 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
var view = newView; var view = newView;
if ('string' == typeof view) { if (typeof view == 'string') {
view = document.createElement('div'); view = document.createElement('div');
view.innerHTML = newView; view.innerHTML = newView;
} }
@ -133,15 +133,15 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
function normalizeNewView(options, isPluginpage) { function normalizeNewView(options, isPluginpage) {
var viewHtml = options.view; var viewHtml = options.view;
if (-1 === viewHtml.indexOf('data-role="page"')) { if (viewHtml.indexOf('data-role="page"') === -1) {
return viewHtml; return viewHtml;
} }
var hasScript = -1 !== viewHtml.indexOf('<script'); var hasScript = viewHtml.indexOf('<script') !== -1;
var elem = parseHtml(viewHtml, hasScript); var elem = parseHtml(viewHtml, hasScript);
if (hasScript) { if (hasScript) {
hasScript = null != elem.querySelector('script'); hasScript = elem.querySelector('script') != null;
} }
var hasjQuery = false; var hasjQuery = false;
@ -149,9 +149,9 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
var hasjQueryChecked = false; var hasjQueryChecked = false;
if (isPluginpage) { if (isPluginpage) {
hasjQuery = -1 != viewHtml.indexOf('jQuery') || -1 != viewHtml.indexOf('$(') || -1 != viewHtml.indexOf('$.'); hasjQuery = viewHtml.indexOf('jQuery') != -1 || viewHtml.indexOf('$(') != -1 || viewHtml.indexOf('$.') != -1;
hasjQueryChecked = -1 != viewHtml.indexOf('.checked('); hasjQueryChecked = viewHtml.indexOf('.checked(') != -1;
hasjQuerySelect = -1 != viewHtml.indexOf('.selectmenu('); hasjQuerySelect = viewHtml.indexOf('.selectmenu(') != -1;
} }
return { return {
@ -187,7 +187,7 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
var url = options.url; var url = options.url;
var index = currentUrls.indexOf(url); var index = currentUrls.indexOf(url);
if (-1 !== index) { if (index !== -1) {
var animatable = allPages[index]; var animatable = allPages[index];
var view = animatable; var view = animatable;
@ -197,7 +197,7 @@ define(['browser', 'dom', 'layoutManager', 'css!components/viewManager/viewConta
} }
var selected = selectedPageIndex; var selected = selectedPageIndex;
var previousAnimatable = -1 === selected ? null : allPages[selected]; var previousAnimatable = selected === -1 ? null : allPages[selected];
return setControllerClass(view, options).then(function () { return setControllerClass(view, options).then(function () {
if (onBeforeChange) { if (onBeforeChange) {
onBeforeChange(view, true, options); onBeforeChange(view, true, options);

View File

@ -313,7 +313,7 @@ import 'emby-itemscontainer';
btnCssClass = session.TranscodingInfo && session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length ? '' : ' hide'; btnCssClass = session.TranscodingInfo && session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length ? '' : ' hide';
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionInfo paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('ViewPlaybackInfo') + '"><span class="material-icons info"></span></button>'; html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionInfo paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('ViewPlaybackInfo') + '"><span class="material-icons info"></span></button>';
btnCssClass = session.ServerId && -1 !== session.SupportedCommands.indexOf('DisplayMessage') && session.DeviceId !== connectionManager.deviceId() ? '' : ' hide'; btnCssClass = session.ServerId && session.SupportedCommands.indexOf('DisplayMessage') !== -1 && session.DeviceId !== connectionManager.deviceId() ? '' : ' hide';
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionSendMessage paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('SendMessage') + '"><span class="material-icons message"></span></button>'; html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionSendMessage paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('SendMessage') + '"><span class="material-icons message"></span></button>';
html += '</div>'; html += '</div>';
@ -346,7 +346,7 @@ import 'emby-itemscontainer';
function renderRunningTasks(view, tasks) { function renderRunningTasks(view, tasks) {
let html = ''; let html = '';
tasks = tasks.filter(function (task) { tasks = tasks.filter(function (task) {
if ('Idle' != task.State) { if (task.State != 'Idle') {
return !task.IsHidden; return !task.IsHidden;
} }
@ -551,7 +551,7 @@ import 'emby-itemscontainer';
row.classList.remove('playingSession'); row.classList.remove('playingSession');
} }
if (session.ServerId && -1 !== session.SupportedCommands.indexOf('DisplayMessage') && session.DeviceId !== connectionManager.deviceId()) { if (session.ServerId && session.SupportedCommands.indexOf('DisplayMessage') !== -1 && session.DeviceId !== connectionManager.deviceId()) {
row.querySelector('.btnSessionSendMessage').classList.remove('hide'); row.querySelector('.btnSessionSendMessage').classList.remove('hide');
} else { } else {
row.querySelector('.btnSessionSendMessage').classList.add('hide'); row.querySelector('.btnSessionSendMessage').classList.add('hide');

View File

@ -29,7 +29,7 @@ import 'listViewStyle';
function renderProfile(page, profile, users) { function renderProfile(page, profile, users) {
$('#txtName', page).val(profile.Name); $('#txtName', page).val(profile.Name);
$('.chkMediaType', page).each(function () { $('.chkMediaType', page).each(function () {
this.checked = -1 != (profile.SupportedMediaTypes || '').split(',').indexOf(this.getAttribute('data-value')); this.checked = (profile.SupportedMediaTypes || '').split(',').indexOf(this.getAttribute('data-value')) != -1;
}); });
$('#chkEnableAlbumArtInDidl', page).prop('checked', profile.EnableAlbumArtInDidl); $('#chkEnableAlbumArtInDidl', page).prop('checked', profile.EnableAlbumArtInDidl);
$('#chkEnableSingleImageLimit', page).prop('checked', profile.EnableSingleAlbumArtLimit); $('#chkEnableSingleImageLimit', page).prop('checked', profile.EnableSingleAlbumArtLimit);
@ -111,7 +111,7 @@ import 'listViewStyle';
} }
function editIdentificationHeader(page, header) { function editIdentificationHeader(page, header) {
isSubProfileNew = null == header; isSubProfileNew = header == null;
header = header || {}; header = header || {};
currentSubProfile = header; currentSubProfile = header;
const popup = $('#identificationHeaderPopup', page); const popup = $('#identificationHeaderPopup', page);
@ -156,7 +156,7 @@ import 'listViewStyle';
} }
function editXmlDocumentAttribute(page, attribute) { function editXmlDocumentAttribute(page, attribute) {
isSubProfileNew = null == attribute; isSubProfileNew = attribute == null;
attribute = attribute || {}; attribute = attribute || {};
currentSubProfile = attribute; currentSubProfile = attribute;
const popup = $('#xmlAttributePopup', page); const popup = $('#xmlAttributePopup', page);
@ -204,7 +204,7 @@ import 'listViewStyle';
} }
function editSubtitleProfile(page, profile) { function editSubtitleProfile(page, profile) {
isSubProfileNew = null == profile; isSubProfileNew = profile == null;
profile = profile || {}; profile = profile || {};
currentSubProfile = profile; currentSubProfile = profile;
const popup = $('#subtitleProfilePopup', page); const popup = $('#subtitleProfilePopup', page);
@ -266,11 +266,11 @@ import 'listViewStyle';
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + index + '">'; html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + index + '">';
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>'; html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
if ('Video' == profile.Type) { if (profile.Type == 'Video') {
html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>';
html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>';
} else { } else {
if ('Audio' == profile.Type) { if (profile.Type == 'Audio') {
html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>';
} }
} }
@ -298,7 +298,7 @@ import 'listViewStyle';
} }
function editDirectPlayProfile(page, directPlayProfile) { function editDirectPlayProfile(page, directPlayProfile) {
isSubProfileNew = null == directPlayProfile; isSubProfileNew = directPlayProfile == null;
directPlayProfile = directPlayProfile || {}; directPlayProfile = directPlayProfile || {};
currentSubProfile = directPlayProfile; currentSubProfile = directPlayProfile;
const popup = $('#popupEditDirectPlayProfile', page); const popup = $('#popupEditDirectPlayProfile', page);
@ -327,11 +327,11 @@ import 'listViewStyle';
html += '<p>Protocol: ' + (profile.Protocol || 'Http') + '</p>'; html += '<p>Protocol: ' + (profile.Protocol || 'Http') + '</p>';
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>'; html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
if ('Video' == profile.Type) { if (profile.Type == 'Video') {
html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>';
html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>';
} else { } else {
if ('Audio' == profile.Type) { if (profile.Type == 'Audio') {
html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>';
} }
} }
@ -354,7 +354,7 @@ import 'listViewStyle';
} }
function editTranscodingProfile(page, transcodingProfile) { function editTranscodingProfile(page, transcodingProfile) {
isSubProfileNew = null == transcodingProfile; isSubProfileNew = transcodingProfile == null;
transcodingProfile = transcodingProfile || {}; transcodingProfile = transcodingProfile || {};
currentSubProfile = transcodingProfile; currentSubProfile = transcodingProfile;
const popup = $('#transcodingProfilePopup', page); const popup = $('#transcodingProfilePopup', page);
@ -365,7 +365,7 @@ import 'listViewStyle';
$('#selectTranscodingProtocol', popup).val(transcodingProfile.Protocol || 'Http'); $('#selectTranscodingProtocol', popup).val(transcodingProfile.Protocol || 'Http');
$('#chkEnableMpegtsM2TsMode', popup).prop('checked', transcodingProfile.EnableMpegtsM2TsMode || false); $('#chkEnableMpegtsM2TsMode', popup).prop('checked', transcodingProfile.EnableMpegtsM2TsMode || false);
$('#chkEstimateContentLength', popup).prop('checked', transcodingProfile.EstimateContentLength || false); $('#chkEstimateContentLength', popup).prop('checked', transcodingProfile.EstimateContentLength || false);
$('#chkReportByteRangeRequests', popup).prop('checked', 'Bytes' == transcodingProfile.TranscodeSeekInfo); $('#chkReportByteRangeRequests', popup).prop('checked', transcodingProfile.TranscodeSeekInfo == 'Bytes');
$('.radioTabButton:first', popup).trigger('click'); $('.radioTabButton:first', popup).trigger('click');
openPopup(popup[0]); openPopup(popup[0]);
} }
@ -443,7 +443,7 @@ import 'listViewStyle';
} }
function editContainerProfile(page, containerProfile) { function editContainerProfile(page, containerProfile) {
isSubProfileNew = null == containerProfile; isSubProfileNew = containerProfile == null;
containerProfile = containerProfile || {}; containerProfile = containerProfile || {};
currentSubProfile = containerProfile; currentSubProfile = containerProfile;
const popup = $('#containerProfilePopup', page); const popup = $('#containerProfilePopup', page);
@ -515,7 +515,7 @@ import 'listViewStyle';
} }
function editCodecProfile(page, codecProfile) { function editCodecProfile(page, codecProfile) {
isSubProfileNew = null == codecProfile; isSubProfileNew = codecProfile == null;
codecProfile = codecProfile || {}; codecProfile = codecProfile || {};
currentSubProfile = codecProfile; currentSubProfile = codecProfile;
const popup = $('#codecProfilePopup', page); const popup = $('#codecProfilePopup', page);
@ -555,11 +555,11 @@ import 'listViewStyle';
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">'; html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>'; html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
if ('Video' == profile.Type) { if (profile.Type == 'Video') {
html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>';
html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>';
} else { } else {
if ('Audio' == profile.Type) { if (profile.Type == 'Audio') {
html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>'; html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>';
} }
} }
@ -595,7 +595,7 @@ import 'listViewStyle';
} }
function editResponseProfile(page, responseProfile) { function editResponseProfile(page, responseProfile) {
isSubProfileNew = null == responseProfile; isSubProfileNew = responseProfile == null;
responseProfile = responseProfile || {}; responseProfile = responseProfile || {};
currentSubProfile = responseProfile; currentSubProfile = responseProfile;
const popup = $('#responseProfilePopup', page); const popup = $('#responseProfilePopup', page);
@ -703,26 +703,26 @@ import 'listViewStyle';
$('.radioTabButton', page).on('click', function () { $('.radioTabButton', page).on('click', function () {
$(this).siblings().removeClass('ui-btn-active'); $(this).siblings().removeClass('ui-btn-active');
$(this).addClass('ui-btn-active'); $(this).addClass('ui-btn-active');
const value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value; const value = this.tagName == 'A' ? this.getAttribute('data-value') : this.value;
const elem = $('.' + value, page); const elem = $('.' + value, page);
elem.siblings('.tabContent').hide(); elem.siblings('.tabContent').hide();
elem.show(); elem.show();
}); });
$('#selectDirectPlayProfileType', page).on('change', function () { $('#selectDirectPlayProfileType', page).on('change', function () {
if ('Video' == this.value) { if (this.value == 'Video') {
$('#fldDirectPlayVideoCodec', page).show(); $('#fldDirectPlayVideoCodec', page).show();
} else { } else {
$('#fldDirectPlayVideoCodec', page).hide(); $('#fldDirectPlayVideoCodec', page).hide();
} }
if ('Photo' == this.value) { if (this.value == 'Photo') {
$('#fldDirectPlayAudioCodec', page).hide(); $('#fldDirectPlayAudioCodec', page).hide();
} else { } else {
$('#fldDirectPlayAudioCodec', page).show(); $('#fldDirectPlayAudioCodec', page).show();
} }
}); });
$('#selectTranscodingProfileType', page).on('change', function () { $('#selectTranscodingProfileType', page).on('change', function () {
if ('Video' == this.value) { if (this.value == 'Video') {
$('#fldTranscodingVideoCodec', page).show(); $('#fldTranscodingVideoCodec', page).show();
$('#fldTranscodingProtocol', page).show(); $('#fldTranscodingProtocol', page).show();
$('#fldEnableMpegtsM2TsMode', page).show(); $('#fldEnableMpegtsM2TsMode', page).show();
@ -732,7 +732,7 @@ import 'listViewStyle';
$('#fldEnableMpegtsM2TsMode', page).hide(); $('#fldEnableMpegtsM2TsMode', page).hide();
} }
if ('Photo' == this.value) { if (this.value == 'Photo') {
$('#fldTranscodingAudioCodec', page).hide(); $('#fldTranscodingAudioCodec', page).hide();
$('#fldEstimateContentLength', page).hide(); $('#fldEstimateContentLength', page).hide();
$('#fldReportByteRangeRequests', page).hide(); $('#fldReportByteRangeRequests', page).hide();
@ -743,13 +743,13 @@ import 'listViewStyle';
} }
}); });
$('#selectResponseProfileType', page).on('change', function () { $('#selectResponseProfileType', page).on('change', function () {
if ('Video' == this.value) { if (this.value == 'Video') {
$('#fldResponseProfileVideoCodec', page).show(); $('#fldResponseProfileVideoCodec', page).show();
} else { } else {
$('#fldResponseProfileVideoCodec', page).hide(); $('#fldResponseProfileVideoCodec', page).hide();
} }
if ('Photo' == this.value) { if (this.value == 'Photo') {
$('#fldResponseProfileAudioCodec', page).hide(); $('#fldResponseProfileAudioCodec', page).hide();
} else { } else {
$('#fldResponseProfileAudioCodec', page).show(); $('#fldResponseProfileAudioCodec', page).show();

View File

@ -18,13 +18,13 @@ import 'emby-button';
function renderUserProfiles(page, profiles) { function renderUserProfiles(page, profiles) {
renderProfiles(page, page.querySelector('.customProfiles'), profiles.filter(function (p) { renderProfiles(page, page.querySelector('.customProfiles'), profiles.filter(function (p) {
return 'User' == p.Type; return p.Type == 'User';
})); }));
} }
function renderSystemProfiles(page, profiles) { function renderSystemProfiles(page, profiles) {
renderProfiles(page, page.querySelector('.systemProfiles'), profiles.filter(function (p) { renderProfiles(page, page.querySelector('.systemProfiles'), profiles.filter(function (p) {
return 'System' == p.Type; return p.Type == 'System';
})); }));
} }
@ -45,7 +45,7 @@ import 'emby-button';
html += '</a>'; html += '</a>';
html += '</div>'; html += '</div>';
if ('User' == profile.Type) { if (profile.Type == 'User') {
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile" data-profileid="' + profile.Id + '" title="' + globalize.translate('ButtonDelete') + '"><span class="material-icons delete"></span></button>'; html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile" data-profileid="' + profile.Id + '" title="' + globalize.translate('ButtonDelete') + '"><span class="material-icons delete"></span></button>';
} }

View File

@ -8,7 +8,7 @@ import libraryMenu from 'libraryMenu';
function loadPage(page, config, systemInfo) { function loadPage(page, config, systemInfo) {
Array.prototype.forEach.call(page.querySelectorAll('.chkDecodeCodec'), function (c) { Array.prototype.forEach.call(page.querySelectorAll('.chkDecodeCodec'), function (c) {
c.checked = -1 !== (config.HardwareDecodingCodecs || []).indexOf(c.getAttribute('data-codec')); c.checked = (config.HardwareDecodingCodecs || []).indexOf(c.getAttribute('data-codec')) !== -1;
}); });
page.querySelector('#chkDecodingColorDepth10Hevc').checked = config.EnableDecodingColorDepth10Hevc; page.querySelector('#chkDecodingColorDepth10Hevc').checked = config.EnableDecodingColorDepth10Hevc;
page.querySelector('#chkDecodingColorDepth10Vp9').checked = config.EnableDecodingColorDepth10Vp9; page.querySelector('#chkDecodingColorDepth10Vp9').checked = config.EnableDecodingColorDepth10Vp9;
@ -107,7 +107,7 @@ import libraryMenu from 'libraryMenu';
value = value || ''; value = value || '';
let any; let any;
Array.prototype.forEach.call(context.querySelectorAll('.chkDecodeCodec'), function (c) { Array.prototype.forEach.call(context.querySelectorAll('.chkDecodeCodec'), function (c) {
if (-1 === c.getAttribute('data-types').split(',').indexOf(value)) { if (c.getAttribute('data-types').split(',').indexOf(value) === -1) {
dom.parentWithTag(c, 'LABEL').classList.add('hide'); dom.parentWithTag(c, 'LABEL').classList.add('hide');
} else { } else {
dom.parentWithTag(c, 'LABEL').classList.remove('hide'); dom.parentWithTag(c, 'LABEL').classList.remove('hide');
@ -138,7 +138,7 @@ import libraryMenu from 'libraryMenu';
$(document).on('pageinit', '#encodingSettingsPage', function () { $(document).on('pageinit', '#encodingSettingsPage', function () {
const page = this; const page = this;
page.querySelector('#selectVideoDecoder').addEventListener('change', function () { page.querySelector('#selectVideoDecoder').addEventListener('change', function () {
if ('vaapi' == this.value) { if (this.value == 'vaapi') {
page.querySelector('.fldVaapiDevice').classList.remove('hide'); page.querySelector('.fldVaapiDevice').classList.remove('hide');
page.querySelector('#txtVaapiDevice').setAttribute('required', 'required'); page.querySelector('#txtVaapiDevice').setAttribute('required', 'required');
} else { } else {

View File

@ -48,7 +48,7 @@ import 'emby-button';
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult); ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
}); });
ApiClient.getNamedConfiguration('metadata').then(function(config) { ApiClient.getNamedConfiguration('metadata').then(function(config) {
config.UseFileCreationTimeForDateAdded = '1' === $('#selectDateAdded', form).val(); config.UseFileCreationTimeForDateAdded = $('#selectDateAdded', form).val() === '1';
ApiClient.updateNamedConfiguration('metadata', config); ApiClient.updateNamedConfiguration('metadata', config);
}); });
@ -61,7 +61,7 @@ import 'emby-button';
libraryMenu.setTabs('librarysetup', 1, getTabs); libraryMenu.setTabs('librarysetup', 1, getTabs);
loadData(); loadData();
ApiClient.getSystemInfo().then(function(info) { ApiClient.getSystemInfo().then(function(info) {
if ('Windows' === info.OperatingSystem) { if (info.OperatingSystem === 'Windows') {
view.querySelector('.fldSaveMetadataHidden').classList.remove('hide'); view.querySelector('.fldSaveMetadataHidden').classList.remove('hide');
} else { } else {
view.querySelector('.fldSaveMetadataHidden').classList.add('hide'); view.querySelector('.fldSaveMetadataHidden').classList.add('hide');

View File

@ -156,7 +156,7 @@ import 'emby-itemrefreshindicator';
} }
function shouldRefreshLibraryAfterChanges(page) { function shouldRefreshLibraryAfterChanges(page) {
return 'mediaLibraryPage' === page.id; return page.id === 'mediaLibraryPage';
} }
function reloadVirtualFolders(page, virtualFolders) { function reloadVirtualFolders(page, virtualFolders) {
@ -286,7 +286,7 @@ import 'emby-itemrefreshindicator';
if (hasCardImageContainer) { if (hasCardImageContainer) {
html += '<div class="cardIndicators backdropCardIndicators">'; html += '<div class="cardIndicators backdropCardIndicators">';
html += '<div is="emby-itemrefreshindicator"' + (virtualFolder.RefreshProgress || virtualFolder.RefreshStatus && 'Idle' !== virtualFolder.RefreshStatus ? '' : ' class="hide"') + ' data-progress="' + (virtualFolder.RefreshProgress || 0) + '" data-status="' + virtualFolder.RefreshStatus + '"></div>'; html += '<div is="emby-itemrefreshindicator"' + (virtualFolder.RefreshProgress || virtualFolder.RefreshStatus && virtualFolder.RefreshStatus !== 'Idle' ? '' : ' class="hide"') + ' data-progress="' + (virtualFolder.RefreshProgress || 0) + '" data-status="' + virtualFolder.RefreshStatus + '"></div>';
html += '</div>'; html += '</div>';
html += '</div>'; html += '</div>';
} }

View File

@ -30,7 +30,7 @@ import 'emby-select';
}).filter(function (s) { }).filter(function (s) {
return s.length > 0; return s.length > 0;
}); });
config.IsRemoteIPFilterBlacklist = 'blacklist' === form.querySelector('#selectExternalAddressFilterMode').value; config.IsRemoteIPFilterBlacklist = form.querySelector('#selectExternalAddressFilterMode').value === 'blacklist';
config.PublicPort = form.querySelector('#txtPublicPort').value; config.PublicPort = form.querySelector('#txtPublicPort').value;
config.PublicHttpsPort = form.querySelector('#txtPublicHttpsPort').value; config.PublicHttpsPort = form.querySelector('#txtPublicHttpsPort').value;
config.HttpServerPortNumber = form.querySelector('#txtPortNumber').value; config.HttpServerPortNumber = form.querySelector('#txtPortNumber').value;
@ -110,7 +110,7 @@ import 'emby-select';
page.querySelector('#txtLanNetworks').value = (config.LocalNetworkSubnets || []).join(', '); page.querySelector('#txtLanNetworks').value = (config.LocalNetworkSubnets || []).join(', ');
page.querySelector('#txtExternalAddressFilter').value = (config.RemoteIPFilter || []).join(', '); page.querySelector('#txtExternalAddressFilter').value = (config.RemoteIPFilter || []).join(', ');
page.querySelector('#selectExternalAddressFilterMode').value = config.IsRemoteIPFilterBlacklist ? 'blacklist' : 'whitelist'; page.querySelector('#selectExternalAddressFilterMode').value = config.IsRemoteIPFilterBlacklist ? 'blacklist' : 'whitelist';
page.querySelector('#chkRemoteAccess').checked = null == config.EnableRemoteAccess || config.EnableRemoteAccess; page.querySelector('#chkRemoteAccess').checked = config.EnableRemoteAccess == null || config.EnableRemoteAccess;
page.querySelector('#txtHttpsPort').value = config.HttpsPortNumber; page.querySelector('#txtHttpsPort').value = config.HttpsPortNumber;
page.querySelector('#chkEnableHttps').checked = config.EnableHttps; page.querySelector('#chkEnableHttps').checked = config.EnableHttps;
page.querySelector('#chkRequireHttps').checked = config.RequireHttps; page.querySelector('#chkRequireHttps').checked = config.RequireHttps;

View File

@ -106,7 +106,7 @@ define(['jQuery', 'emby-checkbox'], function ($) {
$(document).on('pageinit', '#notificationSettingPage', function () { $(document).on('pageinit', '#notificationSettingPage', function () {
var page = this; var page = this;
$('#selectUsers', page).on('change', function () { $('#selectUsers', page).on('change', function () {
if ('Custom' == this.value) { if (this.value == 'Custom') {
$('.selectCustomUsers', page).show(); $('.selectCustomUsers', page).show();
} else { } else {
$('.selectCustomUsers', page).hide(); $('.selectCustomUsers', page).hide();

View File

@ -17,13 +17,13 @@ define(['loading', 'libraryMenu', 'globalize', 'cardStyle', 'emby-button', 'emby
function getHeaderText(category) { function getHeaderText(category) {
category = category.replace(' ', ''); category = category.replace(' ', '');
if ('Channel' === category) { if (category === 'Channel') {
category = 'Channels'; category = 'Channels';
} else if ('Theme' === category) { } else if (category === 'Theme') {
category = 'Themes'; category = 'Themes';
} else if ('LiveTV' === category) { } else if (category === 'LiveTV') {
category = 'HeaderLiveTV'; category = 'HeaderLiveTV';
} else if ('ScreenSaver' === category) { } else if (category === 'ScreenSaver') {
category = 'HeaderScreenSavers'; category = 'HeaderScreenSavers';
} }

View File

@ -84,16 +84,16 @@ import 'emby-select';
}, },
// TODO: Replace this mess with date-fns and remove datetime completely // TODO: Replace this mess with date-fns and remove datetime completely
getTriggerFriendlyName: function (trigger) { getTriggerFriendlyName: function (trigger) {
if ('DailyTrigger' == trigger.Type) { if (trigger.Type == 'DailyTrigger') {
return globalize.translate('DailyAt', ScheduledTaskPage.getDisplayTime(trigger.TimeOfDayTicks)); return globalize.translate('DailyAt', ScheduledTaskPage.getDisplayTime(trigger.TimeOfDayTicks));
} }
if ('WeeklyTrigger' == trigger.Type) { if (trigger.Type == 'WeeklyTrigger') {
// TODO: The day of week isn't localised as well // TODO: The day of week isn't localised as well
return globalize.translate('WeeklyAt', trigger.DayOfWeek, ScheduledTaskPage.getDisplayTime(trigger.TimeOfDayTicks)); return globalize.translate('WeeklyAt', trigger.DayOfWeek, ScheduledTaskPage.getDisplayTime(trigger.TimeOfDayTicks));
} }
if ('SystemEventTrigger' == trigger.Type && 'WakeFromSleep' == trigger.SystemEvent) { if (trigger.Type == 'SystemEventTrigger' && trigger.SystemEvent == 'WakeFromSleep') {
return globalize.translate('OnWakeFromSleep'); return globalize.translate('OnWakeFromSleep');
} }

View File

@ -14,13 +14,13 @@ import globalize from 'globalize';
let html = ''; let html = '';
for (const folder of mediaFolders) { for (const folder of mediaFolders) {
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id); isChecked = user.Policy.EnableContentDeletion || user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id) != -1;
checkedAttribute = isChecked ? ' checked="checked"' : ''; checkedAttribute = isChecked ? ' checked="checked"' : '';
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
} }
for (const folder of channelsResult.Items) { for (const folder of channelsResult.Items) {
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id); isChecked = user.Policy.EnableContentDeletion || user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id) != -1;
checkedAttribute = isChecked ? ' checked="checked"' : ''; checkedAttribute = isChecked ? ' checked="checked"' : '';
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
} }
@ -96,7 +96,7 @@ import globalize from 'globalize';
$('#chkEnableVideoPlaybackTranscoding', page).prop('checked', user.Policy.EnableVideoPlaybackTranscoding); $('#chkEnableVideoPlaybackTranscoding', page).prop('checked', user.Policy.EnableVideoPlaybackTranscoding);
$('#chkEnableVideoPlaybackRemuxing', page).prop('checked', user.Policy.EnablePlaybackRemuxing); $('#chkEnableVideoPlaybackRemuxing', page).prop('checked', user.Policy.EnablePlaybackRemuxing);
$('#chkForceRemoteSourceTranscoding', page).prop('checked', user.Policy.ForceRemoteSourceTranscoding); $('#chkForceRemoteSourceTranscoding', page).prop('checked', user.Policy.ForceRemoteSourceTranscoding);
$('#chkRemoteAccess', page).prop('checked', null == user.Policy.EnableRemoteAccess || user.Policy.EnableRemoteAccess); $('#chkRemoteAccess', page).prop('checked', user.Policy.EnableRemoteAccess == null || user.Policy.EnableRemoteAccess);
$('#chkEnableSyncTranscoding', page).prop('checked', user.Policy.EnableSyncTranscoding); $('#chkEnableSyncTranscoding', page).prop('checked', user.Policy.EnableSyncTranscoding);
$('#chkEnableConversion', page).prop('checked', user.Policy.EnableMediaConversion || false); $('#chkEnableConversion', page).prop('checked', user.Policy.EnableMediaConversion || false);
$('#chkEnableSharing', page).prop('checked', user.Policy.EnablePublicSharing); $('#chkEnableSharing', page).prop('checked', user.Policy.EnablePublicSharing);

View File

@ -18,7 +18,7 @@ import globalize from 'globalize';
for (let i = 0, length = mediaFolders.length; i < length; i++) { for (let i = 0, length = mediaFolders.length; i < length; i++) {
const folder = mediaFolders[i]; const folder = mediaFolders[i];
const isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id); const isChecked = user.Policy.EnableAllFolders || user.Policy.EnabledFolders.indexOf(folder.Id) != -1;
const checkedAttribute = isChecked ? ' checked="checked"' : ''; const checkedAttribute = isChecked ? ' checked="checked"' : '';
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
} }
@ -37,7 +37,7 @@ import globalize from 'globalize';
for (let i = 0, length = channels.length; i < length; i++) { for (let i = 0, length = channels.length; i < length; i++) {
const folder = channels[i]; const folder = channels[i];
const isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id); const isChecked = user.Policy.EnableAllChannels || user.Policy.EnabledChannels.indexOf(folder.Id) != -1;
const checkedAttribute = isChecked ? ' checked="checked"' : ''; const checkedAttribute = isChecked ? ' checked="checked"' : '';
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
} }
@ -61,7 +61,7 @@ import globalize from 'globalize';
for (let i = 0, length = devices.length; i < length; i++) { for (let i = 0, length = devices.length; i < length; i++) {
const device = devices[i]; const device = devices[i];
const checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : ''; const checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
} }

View File

@ -67,7 +67,7 @@ import 'paper-icon-button-light';
for (let i = 0, length = items.length; i < length; i++) { for (let i = 0, length = items.length; i < length; i++) {
const item = items[i]; const item = items[i];
const checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : ''; const checkedAttribute = user.Policy.BlockUnratedItems.indexOf(item.value) != -1 ? ' checked="checked"' : '';
html += '<label><input type="checkbox" is="emby-checkbox" class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox"' + checkedAttribute + '><span>' + item.name + '</span></label>'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox"' + checkedAttribute + '><span>' + item.name + '</span></label>';
} }
@ -201,7 +201,7 @@ import 'paper-icon-button-light';
}).then(function (updatedSchedule) { }).then(function (updatedSchedule) {
const schedules = getSchedulesFromPage(page); const schedules = getSchedulesFromPage(page);
if (-1 == index) { if (index == -1) {
index = schedules.length; index = schedules.length;
} }
@ -234,7 +234,7 @@ import 'paper-icon-button-light';
}).then(function (value) { }).then(function (value) {
const tags = getBlockedTagsFromPage(page); const tags = getBlockedTagsFromPage(page);
if (-1 == tags.indexOf(value)) { if (tags.indexOf(value) == -1) {
tags.push(value); tags.push(value);
loadBlockedTags(page, tags); loadBlockedTags(page, tags);
} }

View File

@ -14,7 +14,7 @@ import 'emby-button';
let showPasswordSection = true; let showPasswordSection = true;
let showLocalAccessSection = false; let showLocalAccessSection = false;
if ('Guest' == user.ConnectLinkType) { if (user.ConnectLinkType == 'Guest') {
page.querySelector('.localAccessSection').classList.add('hide'); page.querySelector('.localAccessSection').classList.add('hide');
showPasswordSection = false; showPasswordSection = false;
} else if (user.HasConfiguredPassword) { } else if (user.HasConfiguredPassword) {

View File

@ -129,7 +129,7 @@ import 'flexStyles';
html += '</div>'; html += '</div>';
html += '<div class="cardText cardText-secondary">'; html += '<div class="cardText cardText-secondary">';
const lastSeen = getLastSeenText(user.LastActivityDate); const lastSeen = getLastSeenText(user.LastActivityDate);
html += '' != lastSeen ? lastSeen : '&nbsp;'; html += lastSeen != '' ? lastSeen : '&nbsp;';
html += '</div>'; html += '</div>';
html += '</div>'; html += '</div>';
html += '</div>'; html += '</div>';

View File

@ -147,11 +147,11 @@ define(['appRouter', 'cardBuilder', 'dom', 'globalize', 'connectionManager', 'ap
options.Limit = 20; options.Limit = 20;
var userId = apiClient.getCurrentUserId(); var userId = apiClient.getCurrentUserId();
if ('MusicArtist' === section.types) { if (section.types === 'MusicArtist') {
return apiClient.getArtists(userId, options); return apiClient.getArtists(userId, options);
} }
if ('Person' === section.types) { if (section.types === 'Person') {
return apiClient.getPeople(userId, options); return apiClient.getPeople(userId, options);
} }
@ -198,7 +198,7 @@ define(['appRouter', 'cardBuilder', 'dom', 'globalize', 'connectionManager', 'ap
preferThumb: section.preferThumb, preferThumb: section.preferThumb,
shape: section.shape, shape: section.shape,
centerText: section.centerText && !cardLayout, centerText: section.centerText && !cardLayout,
overlayText: false !== section.overlayText, overlayText: section.overlayText !== false,
showTitle: section.showTitle, showTitle: section.showTitle,
showYear: section.showYear, showYear: section.showYear,
showParentTitle: section.showParentTitle, showParentTitle: section.showParentTitle,

View File

@ -20,7 +20,7 @@ define(['tabbedView', 'globalize', 'require', 'emby-tabs', 'emby-button', 'emby-
} }
function getTabController(index) { function getTabController(index) {
if (null == index) { if (index == null) {
throw new Error('index cannot be null'); throw new Error('index cannot be null');
} }

View File

@ -100,7 +100,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function renderTimerEditor(page, item, apiClient, user) { function renderTimerEditor(page, item, apiClient, user) {
if ('Recording' !== item.Type || !user.Policy.EnableLiveTvManagement || !item.TimerId || 'InProgress' !== item.Status) { if (item.Type !== 'Recording' || !user.Policy.EnableLiveTvManagement || !item.TimerId || item.Status !== 'InProgress') {
return void hideAll(page, 'btnCancelTimer'); return void hideAll(page, 'btnCancelTimer');
} }
@ -108,7 +108,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function renderSeriesTimerEditor(page, item, apiClient, user) { function renderSeriesTimerEditor(page, item, apiClient, user) {
if ('SeriesTimer' !== item.Type) { if (item.Type !== 'SeriesTimer') {
return void hideAll(page, 'btnCancelSeriesTimer'); return void hideAll(page, 'btnCancelSeriesTimer');
} }
@ -131,7 +131,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function renderTrackSelections(page, instance, item, forceReload) { function renderTrackSelections(page, instance, item, forceReload) {
var select = page.querySelector('.selectSource'); var select = page.querySelector('.selectSource');
if (!item.MediaSources || !itemHelper.supportsMediaSourceSelection(item) || -1 === playbackManager.getSupportedCommands().indexOf('PlayMediaSource') || !playbackManager.canPlay(item)) { if (!item.MediaSources || !itemHelper.supportsMediaSourceSelection(item) || playbackManager.getSupportedCommands().indexOf('PlayMediaSource') === -1 || !playbackManager.canPlay(item)) {
page.querySelector('.trackSelections').classList.add('hide'); page.querySelector('.trackSelections').classList.add('hide');
select.innerHTML = ''; select.innerHTML = '';
page.querySelector('.selectVideo').innerHTML = ''; page.querySelector('.selectVideo').innerHTML = '';
@ -210,7 +210,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
return m.Id === mediaSourceId; return m.Id === mediaSourceId;
})[0]; })[0];
var tracks = mediaSource.MediaStreams.filter(function (m) { var tracks = mediaSource.MediaStreams.filter(function (m) {
return 'Audio' === m.Type; return m.Type === 'Audio';
}); });
var select = page.querySelector('.selectAudio'); var select = page.querySelector('.selectAudio');
select.setLabel(globalize.translate('LabelAudio')); select.setLabel(globalize.translate('LabelAudio'));
@ -239,19 +239,19 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
return m.Id === mediaSourceId; return m.Id === mediaSourceId;
})[0]; })[0];
var tracks = mediaSource.MediaStreams.filter(function (m) { var tracks = mediaSource.MediaStreams.filter(function (m) {
return 'Subtitle' === m.Type; return m.Type === 'Subtitle';
}); });
var select = page.querySelector('.selectSubtitles'); var select = page.querySelector('.selectSubtitles');
select.setLabel(globalize.translate('LabelSubtitles')); select.setLabel(globalize.translate('LabelSubtitles'));
var selectedId = null == mediaSource.DefaultSubtitleStreamIndex ? -1 : mediaSource.DefaultSubtitleStreamIndex; var selectedId = mediaSource.DefaultSubtitleStreamIndex == null ? -1 : mediaSource.DefaultSubtitleStreamIndex;
var videoTracks = mediaSource.MediaStreams.filter(function (m) { var videoTracks = mediaSource.MediaStreams.filter(function (m) {
return 'Video' === m.Type; return m.Type === 'Video';
}); });
// This only makes sense on Video items // This only makes sense on Video items
if (videoTracks.length) { if (videoTracks.length) {
var selected = -1 === selectedId ? ' selected' : ''; var selected = selectedId === -1 ? ' selected' : '';
select.innerHTML = '<option value="-1">' + globalize.translate('Off') + '</option>' + tracks.map(function (v) { select.innerHTML = '<option value="-1">' + globalize.translate('Off') + '</option>' + tracks.map(function (v) {
selected = v.Index === selectedId ? ' selected' : ''; selected = v.Index === selectedId ? ' selected' : '';
return '<option value="' + v.Index + '" ' + selected + '>' + v.DisplayTitle + '</option>'; return '<option value="' + v.Index + '" ' + selected + '>' + v.DisplayTitle + '</option>';
@ -273,7 +273,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function reloadPlayButtons(page, item) { function reloadPlayButtons(page, item) {
var canPlay = false; var canPlay = false;
if ('Program' == item.Type) { if (item.Type == 'Program') {
var now = new Date(); var now = new Date();
if (now >= datetime.parseISO8601Date(item.StartDate, true) && now < datetime.parseISO8601Date(item.EndDate, true)) { if (now >= datetime.parseISO8601Date(item.StartDate, true) && now < datetime.parseISO8601Date(item.EndDate, true)) {
@ -288,9 +288,9 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
hideAll(page, 'btnShuffle'); hideAll(page, 'btnShuffle');
} else if (playbackManager.canPlay(item)) { } else if (playbackManager.canPlay(item)) {
hideAll(page, 'btnPlay', true); hideAll(page, 'btnPlay', true);
var enableInstantMix = -1 !== ['Audio', 'MusicAlbum', 'MusicGenre', 'MusicArtist'].indexOf(item.Type); var enableInstantMix = ['Audio', 'MusicAlbum', 'MusicGenre', 'MusicArtist'].indexOf(item.Type) !== -1;
hideAll(page, 'btnInstantMix', enableInstantMix); hideAll(page, 'btnInstantMix', enableInstantMix);
var enableShuffle = item.IsFolder || -1 !== ['MusicAlbum', 'MusicGenre', 'MusicArtist'].indexOf(item.Type); var enableShuffle = item.IsFolder || ['MusicAlbum', 'MusicGenre', 'MusicArtist'].indexOf(item.Type) !== -1;
hideAll(page, 'btnShuffle', enableShuffle); hideAll(page, 'btnShuffle', enableShuffle);
canPlay = true; canPlay = true;
@ -373,10 +373,10 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
if (item.AlbumArtists) { if (item.AlbumArtists) {
parentNameHtml.push(getArtistLinksHtml(item.AlbumArtists, item.ServerId, context)); parentNameHtml.push(getArtistLinksHtml(item.AlbumArtists, item.ServerId, context));
parentNameLast = true; parentNameLast = true;
} else if (item.ArtistItems && item.ArtistItems.length && 'MusicVideo' === item.Type) { } else if (item.ArtistItems && item.ArtistItems.length && item.Type === 'MusicVideo') {
parentNameHtml.push(getArtistLinksHtml(item.ArtistItems, item.ServerId, context)); parentNameHtml.push(getArtistLinksHtml(item.ArtistItems, item.ServerId, context));
parentNameLast = true; parentNameLast = true;
} else if (item.SeriesName && 'Episode' === item.Type) { } else if (item.SeriesName && item.Type === 'Episode') {
parentRoute = appRouter.getRouteUrl({ parentRoute = appRouter.getRouteUrl({
Id: item.SeriesId, Id: item.SeriesId,
Name: item.SeriesName, Name: item.SeriesName,
@ -391,7 +391,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
parentNameHtml.push(item.Name); parentNameHtml.push(item.Name);
} }
if (item.SeriesName && 'Season' === item.Type) { if (item.SeriesName && item.Type === 'Season') {
parentRoute = appRouter.getRouteUrl({ parentRoute = appRouter.getRouteUrl({
Id: item.SeriesId, Id: item.SeriesId,
Name: item.SeriesName, Name: item.SeriesName,
@ -402,7 +402,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
context: context context: context
}); });
parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeriesName + '</a>'); parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeriesName + '</a>');
} else if (null != item.ParentIndexNumber && 'Episode' === item.Type) { } else if (item.ParentIndexNumber != null && item.Type === 'Episode') {
parentRoute = appRouter.getRouteUrl({ parentRoute = appRouter.getRouteUrl({
Id: item.SeasonId, Id: item.SeasonId,
Name: item.SeasonName, Name: item.SeasonName,
@ -413,9 +413,9 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
context: context context: context
}); });
parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeasonName + '</a>'); parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeasonName + '</a>');
} else if (null != item.ParentIndexNumber && item.IsSeries) { } else if (item.ParentIndexNumber != null && item.IsSeries) {
parentNameHtml.push(item.SeasonName || 'S' + item.ParentIndexNumber); parentNameHtml.push(item.SeasonName || 'S' + item.ParentIndexNumber);
} else if (item.Album && item.AlbumId && ('MusicVideo' === item.Type || 'Audio' === item.Type)) { } else if (item.Album && item.AlbumId && (item.Type === 'MusicVideo' || item.Type === 'Audio')) {
parentRoute = appRouter.getRouteUrl({ parentRoute = appRouter.getRouteUrl({
Id: item.AlbumId, Id: item.AlbumId,
Name: item.Album, Name: item.Album,
@ -478,7 +478,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function setTrailerButtonVisibility(page, item) { function setTrailerButtonVisibility(page, item) {
if ((item.LocalTrailerCount || item.RemoteTrailers && item.RemoteTrailers.length) && -1 !== playbackManager.getSupportedCommands().indexOf('PlayTrailers')) { if ((item.LocalTrailerCount || item.RemoteTrailers && item.RemoteTrailers.length) && playbackManager.getSupportedCommands().indexOf('PlayTrailers') !== -1) {
hideAll(page, 'btnPlayTrailer', true); hideAll(page, 'btnPlayTrailer', true);
} else { } else {
hideAll(page, 'btnPlayTrailer'); hideAll(page, 'btnPlayTrailer');
@ -557,7 +557,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
setInitialCollapsibleState(page, item, apiClient, params.context, user); setInitialCollapsibleState(page, item, apiClient, params.context, user);
var canPlay = reloadPlayButtons(page, item); var canPlay = reloadPlayButtons(page, item);
if ((item.LocalTrailerCount || item.RemoteTrailers && item.RemoteTrailers.length) && -1 !== playbackManager.getSupportedCommands().indexOf('PlayTrailers')) { if ((item.LocalTrailerCount || item.RemoteTrailers && item.RemoteTrailers.length) && playbackManager.getSupportedCommands().indexOf('PlayTrailers') !== -1) {
hideAll(page, 'btnPlayTrailer', true); hideAll(page, 'btnPlayTrailer', true);
} else { } else {
hideAll(page, 'btnPlayTrailer'); hideAll(page, 'btnPlayTrailer');
@ -565,7 +565,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
setTrailerButtonVisibility(page, item); setTrailerButtonVisibility(page, item);
if ('Program' !== item.Type || canPlay) { if (item.Type !== 'Program' || canPlay) {
hideAll(page, 'mainDetailButtons', true); hideAll(page, 'mainDetailButtons', true);
} else { } else {
hideAll(page, 'mainDetailButtons'); hideAll(page, 'mainDetailButtons');
@ -573,7 +573,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
showRecordingFields(instance, page, item, user); showRecordingFields(instance, page, item, user);
var groupedVersions = (item.MediaSources || []).filter(function (g) { var groupedVersions = (item.MediaSources || []).filter(function (g) {
return 'Grouping' == g.Type; return g.Type == 'Grouping';
}); });
if (user.Policy.IsAdministrator && groupedVersions.length) { if (user.Policy.IsAdministrator && groupedVersions.length) {
@ -590,7 +590,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var itemBirthday = page.querySelector('#itemBirthday'); var itemBirthday = page.querySelector('#itemBirthday');
if ('Person' == item.Type && item.PremiereDate) { if (item.Type == 'Person' && item.PremiereDate) {
try { try {
var birthday = datetime.parseISO8601Date(item.PremiereDate, true).toDateString(); var birthday = datetime.parseISO8601Date(item.PremiereDate, true).toDateString();
itemBirthday.classList.remove('hide'); itemBirthday.classList.remove('hide');
@ -604,7 +604,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var itemDeathDate = page.querySelector('#itemDeathDate'); var itemDeathDate = page.querySelector('#itemDeathDate');
if ('Person' == item.Type && item.EndDate) { if (item.Type == 'Person' && item.EndDate) {
try { try {
var deathday = datetime.parseISO8601Date(item.EndDate, true).toDateString(); var deathday = datetime.parseISO8601Date(item.EndDate, true).toDateString();
itemDeathDate.classList.remove('hide'); itemDeathDate.classList.remove('hide');
@ -618,7 +618,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var itemBirthLocation = page.querySelector('#itemBirthLocation'); var itemBirthLocation = page.querySelector('#itemBirthLocation');
if ('Person' == item.Type && item.ProductionLocations && item.ProductionLocations.length) { if (item.Type == 'Person' && item.ProductionLocations && item.ProductionLocations.length) {
var gmap = '<a is="emby-linkbutton" class="button-link textlink" target="_blank" href="https://maps.google.com/maps?q=' + item.ProductionLocations[0] + '">' + item.ProductionLocations[0] + '</a>'; var gmap = '<a is="emby-linkbutton" class="button-link textlink" target="_blank" href="https://maps.google.com/maps?q=' + item.ProductionLocations[0] + '">' + item.ProductionLocations[0] + '</a>';
itemBirthLocation.classList.remove('hide'); itemBirthLocation.classList.remove('hide');
itemBirthLocation.innerHTML = globalize.translate('BirthPlaceValue', gmap); itemBirthLocation.innerHTML = globalize.translate('BirthPlaceValue', gmap);
@ -674,7 +674,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
if (!instance.currentRecordingFields) { if (!instance.currentRecordingFields) {
var recordingFieldsElement = page.querySelector('.recordingFields'); var recordingFieldsElement = page.querySelector('.recordingFields');
if ('Program' == item.Type && user.Policy.EnableLiveTvManagement) { if (item.Type == 'Program' && user.Policy.EnableLiveTvManagement) {
require(['recordingFields'], function (recordingFields) { require(['recordingFields'], function (recordingFields) {
instance.currentRecordingFields = new recordingFields({ instance.currentRecordingFields = new recordingFields({
parent: recordingFieldsElement, parent: recordingFieldsElement,
@ -755,7 +755,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function setPeopleHeader(page, item) { function setPeopleHeader(page, item) {
if ('Audio' == item.MediaType || 'MusicAlbum' == item.Type || 'Book' == item.MediaType || 'Photo' == item.MediaType) { if (item.MediaType == 'Audio' || item.Type == 'MusicAlbum' || item.MediaType == 'Book' || item.MediaType == 'Photo') {
page.querySelector('#peopleHeader').innerHTML = globalize.translate('HeaderPeople'); page.querySelector('#peopleHeader').innerHTML = globalize.translate('HeaderPeople');
} else { } else {
page.querySelector('#peopleHeader').innerHTML = globalize.translate('HeaderCastAndCrew'); page.querySelector('#peopleHeader').innerHTML = globalize.translate('HeaderCastAndCrew');
@ -765,7 +765,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function renderNextUp(page, item, user) { function renderNextUp(page, item, user) {
var section = page.querySelector('.nextUpSection'); var section = page.querySelector('.nextUpSection');
if ('Series' != item.Type) { if (item.Type != 'Series') {
return void section.classList.add('hide'); return void section.classList.add('hide');
} }
@ -783,7 +783,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
items: result.Items, items: result.Items,
shape: 'overflowBackdrop', shape: 'overflowBackdrop',
showTitle: true, showTitle: true,
displayAsSpecial: 'Season' == item.Type && item.IndexNumber, displayAsSpecial: item.Type == 'Season' && item.IndexNumber,
overlayText: false, overlayText: false,
centerText: true, centerText: true,
overlayPlayButton: true overlayPlayButton: true
@ -797,14 +797,14 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function setInitialCollapsibleState(page, item, apiClient, context, user) { function setInitialCollapsibleState(page, item, apiClient, context, user) {
page.querySelector('.collectionItems').innerHTML = ''; page.querySelector('.collectionItems').innerHTML = '';
if ('Playlist' == item.Type) { if (item.Type == 'Playlist') {
page.querySelector('#childrenCollapsible').classList.remove('hide'); page.querySelector('#childrenCollapsible').classList.remove('hide');
renderPlaylistItems(page, item); renderPlaylistItems(page, item);
} else if ('Studio' == item.Type || 'Person' == item.Type || 'Genre' == item.Type || 'MusicGenre' == item.Type || 'MusicArtist' == item.Type) { } else if (item.Type == 'Studio' || item.Type == 'Person' || item.Type == 'Genre' || item.Type == 'MusicGenre' || item.Type == 'MusicArtist') {
page.querySelector('#childrenCollapsible').classList.remove('hide'); page.querySelector('#childrenCollapsible').classList.remove('hide');
renderItemsByName(page, item); renderItemsByName(page, item);
} else if (item.IsFolder) { } else if (item.IsFolder) {
if ('BoxSet' == item.Type) { if (item.Type == 'BoxSet') {
page.querySelector('#childrenCollapsible').classList.add('hide'); page.querySelector('#childrenCollapsible').classList.add('hide');
} }
@ -813,7 +813,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
page.querySelector('#childrenCollapsible').classList.add('hide'); page.querySelector('#childrenCollapsible').classList.add('hide');
} }
if ('Series' == item.Type) { if (item.Type == 'Series') {
renderSeriesSchedule(page, item); renderSeriesSchedule(page, item);
renderNextUp(page, item, user); renderNextUp(page, item, user);
} else { } else {
@ -822,7 +822,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
renderScenes(page, item); renderScenes(page, item);
if (item.SpecialFeatureCount && 0 != item.SpecialFeatureCount && 'Series' != item.Type) { if (item.SpecialFeatureCount && item.SpecialFeatureCount != 0 && item.Type != 'Series') {
page.querySelector('#specialsCollapsible').classList.remove('hide'); page.querySelector('#specialsCollapsible').classList.remove('hide');
renderSpecials(page, item, user); renderSpecials(page, item, user);
} else { } else {
@ -838,7 +838,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
page.querySelector('#additionalPartsCollapsible').classList.add('hide'); page.querySelector('#additionalPartsCollapsible').classList.add('hide');
} }
if ('MusicAlbum' == item.Type) { if (item.Type == 'MusicAlbum') {
renderMusicVideos(page, item, user); renderMusicVideos(page, item, user);
} else { } else {
page.querySelector('#musicVideosCollapsible').classList.add('hide'); page.querySelector('#musicVideosCollapsible').classList.add('hide');
@ -986,7 +986,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
subtitles: false subtitles: false
}); });
if (miscInfo.innerHTML && 'SeriesTimer' !== item.Type) { if (miscInfo.innerHTML && item.Type !== 'SeriesTimer') {
miscInfo.classList.remove('hide'); miscInfo.classList.remove('hide');
} else { } else {
miscInfo.classList.add('hide'); miscInfo.classList.add('hide');
@ -1000,7 +1000,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
interactive: true interactive: true
}); });
if (miscInfo.innerHTML && 'SeriesTimer' !== item.Type) { if (miscInfo.innerHTML && item.Type !== 'SeriesTimer') {
miscInfo.classList.remove('hide'); miscInfo.classList.remove('hide');
} else { } else {
miscInfo.classList.add('hide'); miscInfo.classList.add('hide');
@ -1041,7 +1041,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function getPortraitShape(scrollX) { function getPortraitShape(scrollX) {
if (null == scrollX) { if (scrollX == null) {
scrollX = enableScrollX(); scrollX = enableScrollX();
} }
@ -1049,7 +1049,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function getSquareShape(scrollX) { function getSquareShape(scrollX) {
if (null == scrollX) { if (scrollX == null) {
scrollX = enableScrollX(); scrollX = enableScrollX();
} }
@ -1060,7 +1060,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var section = view.querySelector('.moreFromSeasonSection'); var section = view.querySelector('.moreFromSeasonSection');
if (section) { if (section) {
if ('Episode' !== item.Type || !item.SeasonId || !item.SeriesId) { if (item.Type !== 'Episode' || !item.SeasonId || !item.SeriesId) {
return void section.classList.add('hide'); return void section.classList.add('hide');
} }
@ -1104,11 +1104,11 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var section = view.querySelector('.moreFromArtistSection'); var section = view.querySelector('.moreFromArtistSection');
if (section) { if (section) {
if ('MusicArtist' === item.Type) { if (item.Type === 'MusicArtist') {
if (!apiClient.isMinServerVersion('3.4.1.19')) { if (!apiClient.isMinServerVersion('3.4.1.19')) {
return void section.classList.add('hide'); return void section.classList.add('hide');
} }
} else if ('MusicAlbum' !== item.Type || !item.AlbumArtists || !item.AlbumArtists.length) { } else if (item.Type !== 'MusicAlbum' || !item.AlbumArtists || !item.AlbumArtists.length) {
return void section.classList.add('hide'); return void section.classList.add('hide');
} }
@ -1120,7 +1120,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
SortOrder: 'Descending' SortOrder: 'Descending'
}; };
if ('MusicArtist' === item.Type) { if (item.Type === 'MusicArtist') {
query.ContributingArtistIds = item.Id; query.ContributingArtistIds = item.Id;
} else if (apiClient.isMinServerVersion('3.4.1.18')) { } else if (apiClient.isMinServerVersion('3.4.1.18')) {
query.AlbumArtistIds = item.AlbumArtists[0].Id; query.AlbumArtistIds = item.AlbumArtists[0].Id;
@ -1135,7 +1135,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
section.classList.remove('hide'); section.classList.remove('hide');
if ('MusicArtist' === item.Type) { if (item.Type === 'MusicArtist') {
section.querySelector('h2').innerHTML = globalize.translate('HeaderAppearsOn'); section.querySelector('h2').innerHTML = globalize.translate('HeaderAppearsOn');
} else { } else {
section.querySelector('h2').innerHTML = globalize.translate('MoreFromValue', item.AlbumArtists[0].Name); section.querySelector('h2').innerHTML = globalize.translate('MoreFromValue', item.AlbumArtists[0].Name);
@ -1147,7 +1147,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
shape: 'autooverflow', shape: 'autooverflow',
sectionTitleTagName: 'h2', sectionTitleTagName: 'h2',
scalable: true, scalable: true,
coverImage: 'MusicArtist' === item.Type || 'MusicAlbum' === item.Type, coverImage: item.Type === 'MusicArtist' || item.Type === 'MusicAlbum',
showTitle: true, showTitle: true,
showParentTitle: false, showParentTitle: false,
centerText: true, centerText: true,
@ -1163,7 +1163,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var similarCollapsible = page.querySelector('#similarCollapsible'); var similarCollapsible = page.querySelector('#similarCollapsible');
if (similarCollapsible) { if (similarCollapsible) {
if ('Movie' != item.Type && 'Trailer' != item.Type && 'Series' != item.Type && 'Program' != item.Type && 'Recording' != item.Type && 'MusicAlbum' != item.Type && 'MusicArtist' != item.Type && 'Playlist' != item.Type) { if (item.Type != 'Movie' && item.Type != 'Trailer' && item.Type != 'Series' && item.Type != 'Program' && item.Type != 'Recording' && item.Type != 'MusicAlbum' && item.Type != 'MusicArtist' && item.Type != 'Playlist') {
return void similarCollapsible.classList.add('hide'); return void similarCollapsible.classList.add('hide');
} }
@ -1175,7 +1175,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
fields: 'PrimaryImageAspectRatio,UserData,CanDelete' fields: 'PrimaryImageAspectRatio,UserData,CanDelete'
}; };
if ('MusicAlbum' == item.Type && item.AlbumArtists && item.AlbumArtists.length) { if (item.Type == 'MusicAlbum' && item.AlbumArtists && item.AlbumArtists.length) {
options.ExcludeArtistIds = item.AlbumArtists[0].Id; options.ExcludeArtistIds = item.AlbumArtists[0].Id;
} }
@ -1189,16 +1189,16 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
html += cardBuilder.getCardsHtml({ html += cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: 'autooverflow', shape: 'autooverflow',
showParentTitle: 'MusicAlbum' == item.Type, showParentTitle: item.Type == 'MusicAlbum',
centerText: true, centerText: true,
showTitle: true, showTitle: true,
context: context, context: context,
lazy: true, lazy: true,
showDetailsMenu: true, showDetailsMenu: true,
coverImage: 'MusicAlbum' == item.Type || 'MusicArtist' == item.Type, coverImage: item.Type == 'MusicAlbum' || item.Type == 'MusicArtist',
overlayPlayButton: true, overlayPlayButton: true,
overlayText: false, overlayText: false,
showYear: 'Movie' === item.Type || 'Trailer' === item.Type || 'Series' === item.Type showYear: item.Type === 'Movie' || item.Type === 'Trailer' || item.Type === 'Series'
}); });
var similarContent = similarCollapsible.querySelector('.similarContent'); var similarContent = similarCollapsible.querySelector('.similarContent');
similarContent.innerHTML = html; similarContent.innerHTML = html;
@ -1209,13 +1209,13 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function renderSeriesAirTime(page, item, isStatic) { function renderSeriesAirTime(page, item, isStatic) {
var seriesAirTime = page.querySelector('#seriesAirTime'); var seriesAirTime = page.querySelector('#seriesAirTime');
if ('Series' != item.Type) { if (item.Type != 'Series') {
seriesAirTime.classList.add('hide'); seriesAirTime.classList.add('hide');
return; return;
} }
var html = ''; var html = '';
if (item.AirDays && item.AirDays.length) { if (item.AirDays && item.AirDays.length) {
if (7 == item.AirDays.length) { if (item.AirDays.length == 7) {
html += 'daily'; html += 'daily';
} else { } else {
html += item.AirDays.map(function (a) { html += item.AirDays.map(function (a) {
@ -1240,7 +1240,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
} }
if (html) { if (html) {
html = ('Ended' == item.Status ? 'Aired ' : 'Airs ') + html; html = (item.Status == 'Ended' ? 'Aired ' : 'Airs ') + html;
seriesAirTime.innerHTML = html; seriesAirTime.innerHTML = html;
seriesAirTime.classList.remove('hide'); seriesAirTime.classList.remove('hide');
} else { } else {
@ -1253,7 +1253,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var tagElements = []; var tagElements = [];
var tags = item.Tags || []; var tags = item.Tags || [];
if ('Program' === item.Type) { if (item.Type === 'Program') {
tags = []; tags = [];
} }
@ -1277,7 +1277,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
Fields: fields Fields: fields
}; };
if ('BoxSet' !== item.Type) { if (item.Type !== 'BoxSet') {
query.SortBy = 'SortName'; query.SortBy = 'SortName';
} }
@ -1285,19 +1285,19 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var apiClient = connectionManager.getApiClient(item.ServerId); var apiClient = connectionManager.getApiClient(item.ServerId);
var userId = apiClient.getCurrentUserId(); var userId = apiClient.getCurrentUserId();
if ('Series' == item.Type) { if (item.Type == 'Series') {
promise = apiClient.getSeasons(item.Id, { promise = apiClient.getSeasons(item.Id, {
userId: userId, userId: userId,
Fields: fields Fields: fields
}); });
} else if ('Season' == item.Type) { } else if (item.Type == 'Season') {
fields += ',Overview'; fields += ',Overview';
promise = apiClient.getEpisodes(item.SeriesId, { promise = apiClient.getEpisodes(item.SeriesId, {
seasonId: item.Id, seasonId: item.Id,
userId: userId, userId: userId,
Fields: fields Fields: fields
}); });
} else if ('MusicArtist' == item.Type) { } else if (item.Type == 'MusicArtist') {
query.SortBy = 'ProductionYear,SortName'; query.SortBy = 'ProductionYear,SortName';
} }
@ -1308,7 +1308,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var isList = false; var isList = false;
var childrenItemsContainer = page.querySelector('.childrenItemsContainer'); var childrenItemsContainer = page.querySelector('.childrenItemsContainer');
if ('MusicAlbum' == item.Type) { if (item.Type == 'MusicAlbum') {
html = listView.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
smallIcon: true, smallIcon: true,
@ -1322,7 +1322,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
containerAlbumArtists: item.AlbumArtists containerAlbumArtists: item.AlbumArtists
}); });
isList = true; isList = true;
} else if ('Series' == item.Type) { } else if (item.Type == 'Series') {
scrollX = enableScrollX(); scrollX = enableScrollX();
html = cardBuilder.getCardsHtml({ html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
@ -1333,21 +1333,21 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
overlayPlayButton: true, overlayPlayButton: true,
allowBottomPadding: !scrollX allowBottomPadding: !scrollX
}); });
} else if ('Season' == item.Type || 'Episode' == item.Type) { } else if (item.Type == 'Season' || item.Type == 'Episode') {
if ('Episode' !== item.Type) { if (item.Type !== 'Episode') {
isList = true; isList = true;
} }
scrollX = 'Episode' == item.Type; scrollX = item.Type == 'Episode';
if (result.Items.length < 2 && 'Episode' === item.Type) { if (result.Items.length < 2 && item.Type === 'Episode') {
return; return;
} }
if ('Episode' === item.Type) { if (item.Type === 'Episode') {
html = cardBuilder.getCardsHtml({ html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: 'overflowBackdrop', shape: 'overflowBackdrop',
showTitle: true, showTitle: true,
displayAsSpecial: 'Season' == item.Type && item.IndexNumber, displayAsSpecial: item.Type == 'Season' && item.IndexNumber,
playFromHere: true, playFromHere: true,
overlayText: true, overlayText: true,
lazy: true, lazy: true,
@ -1356,7 +1356,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
allowBottomPadding: !scrollX, allowBottomPadding: !scrollX,
includeParentInfoInTitle: false includeParentInfoInTitle: false
}); });
} else if ('Season' === item.Type) { } else if (item.Type === 'Season') {
html = listView.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
showIndexNumber: false, showIndexNumber: false,
@ -1373,7 +1373,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
} }
if ('BoxSet' !== item.Type) { if (item.Type !== 'BoxSet') {
page.querySelector('#childrenCollapsible').classList.remove('hide'); page.querySelector('#childrenCollapsible').classList.remove('hide');
} }
if (scrollX) { if (scrollX) {
@ -1398,7 +1398,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
childrenItemsContainer.innerHTML = html; childrenItemsContainer.innerHTML = html;
imageLoader.lazyChildren(childrenItemsContainer); imageLoader.lazyChildren(childrenItemsContainer);
if ('BoxSet' == item.Type) { if (item.Type == 'BoxSet') {
var collectionItemTypes = [{ var collectionItemTypes = [{
name: globalize.translate('HeaderVideos'), name: globalize.translate('HeaderVideos'),
mediaType: 'Video' mediaType: 'Video'
@ -1416,17 +1416,17 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
}); });
if ('Season' == item.Type) { if (item.Type == 'Season') {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderEpisodes'); page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderEpisodes');
} else if ('Series' == item.Type) { } else if (item.Type == 'Series') {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderSeasons'); page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderSeasons');
} else if ('MusicAlbum' == item.Type) { } else if (item.Type == 'MusicAlbum') {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderTracks'); page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderTracks');
} else { } else {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderItems'); page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderItems');
} }
if ('MusicAlbum' == item.Type || 'Season' == item.Type) { if (item.Type == 'MusicAlbum' || item.Type == 'Season') {
page.querySelector('.childrenSectionHeader').classList.add('hide'); page.querySelector('.childrenSectionHeader').classList.add('hide');
page.querySelector('#childrenCollapsible').classList.add('verticalSection-extrabottompadding'); page.querySelector('#childrenCollapsible').classList.add('verticalSection-extrabottompadding');
} else { } else {
@ -1503,7 +1503,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function renderChannelGuide(page, apiClient, item) { function renderChannelGuide(page, apiClient, item) {
if ('TvChannel' === item.Type) { if (item.Type === 'TvChannel') {
page.querySelector('.programGuideSection').classList.remove('hide'); page.querySelector('.programGuideSection').classList.remove('hide');
apiClient.getLiveTvPrograms({ apiClient.getLiveTvPrograms({
ChannelIds: item.Id, ChannelIds: item.Id,
@ -1555,19 +1555,19 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
} }
function inferContext(item) { function inferContext(item) {
if ('Movie' === item.Type || 'BoxSet' === item.Type) { if (item.Type === 'Movie' || item.Type === 'BoxSet') {
return 'movies'; return 'movies';
} }
if ('Series' === item.Type || 'Season' === item.Type || 'Episode' === item.Type) { if (item.Type === 'Series' || item.Type === 'Season' || item.Type === 'Episode') {
return 'tvshows'; return 'tvshows';
} }
if ('MusicArtist' === item.Type || 'MusicAlbum' === item.Type || 'Audio' === item.Type || 'AudioBook' === item.Type) { if (item.Type === 'MusicArtist' || item.Type === 'MusicAlbum' || item.Type === 'Audio' || item.Type === 'AudioBook') {
return 'music'; return 'music';
} }
if ('Program' === item.Type) { if (item.Type === 'Program') {
return 'livetv'; return 'livetv';
} }
@ -1659,12 +1659,12 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
html += '</h2>'; html += '</h2>';
html += '</div>'; html += '</div>';
html += '<div is="emby-itemscontainer" class="itemsContainer collectionItemsContainer vertical-wrap padded-left padded-right">'; html += '<div is="emby-itemscontainer" class="itemsContainer collectionItemsContainer vertical-wrap padded-left padded-right">';
var shape = 'MusicAlbum' == type.type ? getSquareShape(false) : getPortraitShape(false); var shape = type.type == 'MusicAlbum' ? getSquareShape(false) : getPortraitShape(false);
html += cardBuilder.getCardsHtml({ html += cardBuilder.getCardsHtml({
items: items, items: items,
shape: shape, shape: shape,
showTitle: true, showTitle: true,
showYear: 'Video' === type.mediaType || 'Series' === type.type, showYear: type.mediaType === 'Video' || type.type === 'Series',
centerText: true, centerText: true,
lazy: true, lazy: true,
showDetailsMenu: true, showDetailsMenu: true,
@ -1849,7 +1849,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function playCurrentItem(button, mode) { function playCurrentItem(button, mode) {
var item = currentItem; var item = currentItem;
if ('Program' === item.Type) { if (item.Type === 'Program') {
var apiClient = connectionManager.getApiClient(item.ServerId); var apiClient = connectionManager.getApiClient(item.ServerId);
return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) { return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
playbackManager.play({ playbackManager.play({
@ -1925,7 +1925,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function onWebSocketMessage(e, data) { function onWebSocketMessage(e, data) {
var msg = data; var msg = data;
if ('UserDataChanged' === msg.MessageType && currentItem && msg.Data.UserId == apiClient.getCurrentUserId()) { if (msg.MessageType === 'UserDataChanged' && currentItem && msg.Data.UserId == apiClient.getCurrentUserId()) {
var key = currentItem.UserData.Key; var key = currentItem.UserData.Key;
var userData = msg.Data.UserDataList.filter(function (u) { var userData = msg.Data.UserDataList.filter(function (u) {
return u.Key == key; return u.Key == key;

View File

@ -9,7 +9,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
Limit: 300 Limit: 300
}; };
if ('Recordings' === params.type) { if (params.type === 'Recordings') {
query.IsInProgress = false; query.IsInProgress = false;
} else { } else {
query.HasAired = false; query.HasAired = false;
@ -19,39 +19,39 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
query.GenreIds = params.genreId; query.GenreIds = params.genreId;
} }
if ('true' === params.IsMovie) { if (params.IsMovie === 'true') {
query.IsMovie = true; query.IsMovie = true;
} else if ('false' === params.IsMovie) { } else if (params.IsMovie === 'false') {
query.IsMovie = false; query.IsMovie = false;
} }
if ('true' === params.IsSeries) { if (params.IsSeries === 'true') {
query.IsSeries = true; query.IsSeries = true;
} else if ('false' === params.IsSeries) { } else if (params.IsSeries === 'false') {
query.IsSeries = false; query.IsSeries = false;
} }
if ('true' === params.IsNews) { if (params.IsNews === 'true') {
query.IsNews = true; query.IsNews = true;
} else if ('false' === params.IsNews) { } else if (params.IsNews === 'false') {
query.IsNews = false; query.IsNews = false;
} }
if ('true' === params.IsSports) { if (params.IsSports === 'true') {
query.IsSports = true; query.IsSports = true;
} else if ('false' === params.IsSports) { } else if (params.IsSports === 'false') {
query.IsSports = false; query.IsSports = false;
} }
if ('true' === params.IsKids) { if (params.IsKids === 'true') {
query.IsKids = true; query.IsKids = true;
} else if ('false' === params.IsKids) { } else if (params.IsKids === 'false') {
query.IsKids = false; query.IsKids = false;
} }
if ('true' === params.IsAiring) { if (params.IsAiring === 'true') {
query.IsAiring = true; query.IsAiring = true;
} else if ('false' === params.IsAiring) { } else if (params.IsAiring === 'false') {
query.IsAiring = false; query.IsAiring = false;
} }
@ -181,13 +181,13 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var btnSortIcon = instance.btnSortIcon; var btnSortIcon = instance.btnSortIcon;
if (btnSortIcon) { if (btnSortIcon) {
setSortButtonIcon(btnSortIcon, 'Descending' === values.sortOrder ? 'arrow_downward' : 'arrow_upward'); setSortButtonIcon(btnSortIcon, values.sortOrder === 'Descending' ? 'arrow_downward' : 'arrow_upward');
} }
} }
} }
function updateItemsContainerForViewType(instance) { function updateItemsContainerForViewType(instance) {
if ('list' === instance.getViewSettings().imageType) { if (instance.getViewSettings().imageType === 'list') {
instance.itemsContainer.classList.remove('vertical-wrap'); instance.itemsContainer.classList.remove('vertical-wrap');
instance.itemsContainer.classList.add('vertical-list'); instance.itemsContainer.classList.add('vertical-list');
} else { } else {
@ -203,11 +203,11 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
if (alphaPicker) { if (alphaPicker) {
var values = instance.getSortValues(); var values = instance.getSortValues();
if (null == numItems) { if (numItems == null) {
numItems = 100; numItems = 100;
} }
if ('SortName' === values.sortBy && 'Ascending' === values.sortOrder && numItems > 40) { if (values.sortBy === 'SortName' && values.sortOrder === 'Ascending' && numItems > 40) {
alphaPicker.classList.remove('hide'); alphaPicker.classList.remove('hide');
instance.itemsContainer.parentNode.classList.add('padded-right-withalphapicker'); instance.itemsContainer.parentNode.classList.add('padded-right-withalphapicker');
} else { } else {
@ -222,19 +222,19 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var apiClient = connectionManager.getApiClient(params.serverId); var apiClient = connectionManager.getApiClient(params.serverId);
instance.queryRecursive = false; instance.queryRecursive = false;
if ('Recordings' === params.type) { if (params.type === 'Recordings') {
return apiClient.getLiveTvRecordings(getInitialLiveTvQuery(instance, params)); return apiClient.getLiveTvRecordings(getInitialLiveTvQuery(instance, params));
} }
if ('Programs' === params.type) { if (params.type === 'Programs') {
if ('true' === params.IsAiring) { if (params.IsAiring === 'true') {
return apiClient.getLiveTvRecommendedPrograms(getInitialLiveTvQuery(instance, params)); return apiClient.getLiveTvRecommendedPrograms(getInitialLiveTvQuery(instance, params));
} }
return apiClient.getLiveTvPrograms(getInitialLiveTvQuery(instance, params)); return apiClient.getLiveTvPrograms(getInitialLiveTvQuery(instance, params));
} }
if ('nextup' === params.type) { if (params.type === 'nextup') {
return apiClient.getNextUpEpisodes(modifyQueryWithFilters(instance, { return apiClient.getNextUpEpisodes(modifyQueryWithFilters(instance, {
Limit: limit, Limit: limit,
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo', Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo',
@ -250,9 +250,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
instance.queryRecursive = true; instance.queryRecursive = true;
var method = 'getItems'; var method = 'getItems';
if ('MusicArtist' === params.type) { if (params.type === 'MusicArtist') {
method = 'getArtists'; method = 'getArtists';
} else if ('Person' === params.type) { } else if (params.type === 'Person') {
method = 'getPeople'; method = 'getPeople';
} }
@ -261,15 +261,15 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
Limit: limit, Limit: limit,
Fields: 'PrimaryImageAspectRatio,SortName', Fields: 'PrimaryImageAspectRatio,SortName',
ImageTypeLimit: 1, ImageTypeLimit: 1,
IncludeItemTypes: 'MusicArtist' === params.type || 'Person' === params.type ? null : params.type, IncludeItemTypes: params.type === 'MusicArtist' || params.type === 'Person' ? null : params.type,
Recursive: true, Recursive: true,
IsFavorite: 'true' === params.IsFavorite || null, IsFavorite: params.IsFavorite === 'true' || null,
ArtistIds: params.artistId || null, ArtistIds: params.artistId || null,
SortBy: sortBy SortBy: sortBy
})); }));
} }
if ('Genre' === item.Type || 'MusicGenre' === item.Type || 'Studio' === item.Type || 'Person' === item.Type) { if (item.Type === 'Genre' || item.Type === 'MusicGenre' || item.Type === 'Studio' || item.Type === 'Person') {
instance.queryRecursive = true; instance.queryRecursive = true;
var query = { var query = {
StartIndex: startIndex, StartIndex: startIndex,
@ -280,25 +280,25 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
SortBy: sortBy SortBy: sortBy
}; };
if ('Studio' === item.Type) { if (item.Type === 'Studio') {
query.StudioIds = item.Id; query.StudioIds = item.Id;
} else if ('Genre' === item.Type || 'MusicGenre' === item.Type) { } else if (item.Type === 'Genre' || item.Type === 'MusicGenre') {
query.GenreIds = item.Id; query.GenreIds = item.Id;
} else if ('Person' === item.Type) { } else if (item.Type === 'Person') {
query.PersonIds = item.Id; query.PersonIds = item.Id;
} }
if ('MusicGenre' === item.Type) { if (item.Type === 'MusicGenre') {
query.IncludeItemTypes = 'MusicAlbum'; query.IncludeItemTypes = 'MusicAlbum';
} else if ('GameGenre' === item.Type) { } else if (item.Type === 'GameGenre') {
query.IncludeItemTypes = 'Game'; query.IncludeItemTypes = 'Game';
} else if ('movies' === item.CollectionType) { } else if (item.CollectionType === 'movies') {
query.IncludeItemTypes = 'Movie'; query.IncludeItemTypes = 'Movie';
} else if ('tvshows' === item.CollectionType) { } else if (item.CollectionType === 'tvshows') {
query.IncludeItemTypes = 'Series'; query.IncludeItemTypes = 'Series';
} else if ('Genre' === item.Type) { } else if (item.Type === 'Genre') {
query.IncludeItemTypes = 'Movie,Series,Video'; query.IncludeItemTypes = 'Movie,Series,Video';
} else if ('Person' === item.Type) { } else if (item.Type === 'Person') {
query.IncludeItemTypes = params.type; query.IncludeItemTypes = params.type;
} }
@ -316,7 +316,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
} }
function getItem(params) { function getItem(params) {
if ('Recordings' === params.type || 'Programs' === params.type || 'nextup' === params.type) { if (params.type === 'Recordings' || params.type === 'Programs' || params.type === 'nextup') {
return Promise.resolve(null); return Promise.resolve(null);
} }
@ -412,7 +412,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
function ItemsView(view, params) { function ItemsView(view, params) {
function fetchData() { function fetchData() {
return getItems(self, params, self.currentItem).then(function (result) { return getItems(self, params, self.currentItem).then(function (result) {
if (null == self.totalItemCount) { if (self.totalItemCount == null) {
self.totalItemCount = result.Items ? result.Items.length : result.length; self.totalItemCount = result.Items ? result.Items.length : result.length;
} }
@ -424,7 +424,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
function getItemsHtml(items) { function getItemsHtml(items) {
var settings = self.getViewSettings(); var settings = self.getViewSettings();
if ('list' === settings.imageType) { if (settings.imageType === 'list') {
return listView.getListViewHtml({ return listView.getListViewHtml({
items: items items: items
}); });
@ -438,24 +438,24 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var item = self.currentItem; var item = self.currentItem;
var lines = settings.showTitle ? 2 : 0; var lines = settings.showTitle ? 2 : 0;
if ('banner' === settings.imageType) { if (settings.imageType === 'banner') {
shape = 'banner'; shape = 'banner';
} else if ('disc' === settings.imageType) { } else if (settings.imageType === 'disc') {
shape = 'square'; shape = 'square';
preferDisc = true; preferDisc = true;
} else if ('logo' === settings.imageType) { } else if (settings.imageType === 'logo') {
shape = 'backdrop'; shape = 'backdrop';
preferLogo = true; preferLogo = true;
} else if ('thumb' === settings.imageType) { } else if (settings.imageType === 'thumb') {
shape = 'backdrop'; shape = 'backdrop';
preferThumb = true; preferThumb = true;
} else if ('nextup' === params.type) { } else if (params.type === 'nextup') {
shape = 'backdrop'; shape = 'backdrop';
preferThumb = 'thumb' === settings.imageType; preferThumb = settings.imageType === 'thumb';
} else if ('Programs' === params.type || 'Recordings' === params.type) { } else if (params.type === 'Programs' || params.type === 'Recordings') {
shape = 'true' === params.IsMovie ? 'portrait' : 'autoVertical'; shape = params.IsMovie === 'true' ? 'portrait' : 'autoVertical';
preferThumb = 'true' !== params.IsMovie ? 'auto' : false; preferThumb = params.IsMovie !== 'true' ? 'auto' : false;
defaultShape = 'true' === params.IsMovie ? 'portrait' : 'backdrop'; defaultShape = params.IsMovie === 'true' ? 'portrait' : 'backdrop';
} else { } else {
shape = 'autoVertical'; shape = 'autoVertical';
} }
@ -473,46 +473,46 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
overlayMoreButton: true, overlayMoreButton: true,
overlayText: !settings.showTitle, overlayText: !settings.showTitle,
defaultShape: defaultShape, defaultShape: defaultShape,
action: 'Audio' === params.type ? 'playallfromhere' : null action: params.type === 'Audio' ? 'playallfromhere' : null
}; };
if ('nextup' === params.type) { if (params.type === 'nextup') {
posterOptions.showParentTitle = settings.showTitle; posterOptions.showParentTitle = settings.showTitle;
} else if ('Person' === params.type) { } else if (params.type === 'Person') {
posterOptions.showYear = false; posterOptions.showYear = false;
posterOptions.showParentTitle = false; posterOptions.showParentTitle = false;
lines = 1; lines = 1;
} else if ('Audio' === params.type) { } else if (params.type === 'Audio') {
posterOptions.showParentTitle = settings.showTitle; posterOptions.showParentTitle = settings.showTitle;
} else if ('MusicAlbum' === params.type) { } else if (params.type === 'MusicAlbum') {
posterOptions.showParentTitle = settings.showTitle; posterOptions.showParentTitle = settings.showTitle;
} else if ('Episode' === params.type) { } else if (params.type === 'Episode') {
posterOptions.showParentTitle = settings.showTitle; posterOptions.showParentTitle = settings.showTitle;
} else if ('MusicArtist' === params.type) { } else if (params.type === 'MusicArtist') {
posterOptions.showYear = false; posterOptions.showYear = false;
lines = 1; lines = 1;
} else if ('Programs' === params.type) { } else if (params.type === 'Programs') {
lines = settings.showTitle ? 1 : 0; lines = settings.showTitle ? 1 : 0;
var showParentTitle = settings.showTitle && 'true' !== params.IsMovie; var showParentTitle = settings.showTitle && params.IsMovie !== 'true';
if (showParentTitle) { if (showParentTitle) {
lines++; lines++;
} }
var showAirTime = settings.showTitle && 'Recordings' !== params.type; var showAirTime = settings.showTitle && params.type !== 'Recordings';
if (showAirTime) { if (showAirTime) {
lines++; lines++;
} }
var showYear = settings.showTitle && 'true' === params.IsMovie && 'Recordings' === params.type; var showYear = settings.showTitle && params.IsMovie === 'true' && params.type === 'Recordings';
if (showYear) { if (showYear) {
lines++; lines++;
} }
posterOptions = Object.assign(posterOptions, { posterOptions = Object.assign(posterOptions, {
inheritThumb: 'Recordings' === params.type, inheritThumb: params.type === 'Recordings',
context: 'livetv', context: 'livetv',
showParentTitle: showParentTitle, showParentTitle: showParentTitle,
showAirTime: showAirTime, showAirTime: showAirTime,
@ -529,7 +529,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
posterOptions.lines = lines; posterOptions.lines = lines;
posterOptions.items = items; posterOptions.items = items;
if (item && 'folders' === item.CollectionType) { if (item && item.CollectionType === 'folders') {
posterOptions.context = 'folders'; posterOptions.context = 'folders';
} }
@ -561,7 +561,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
function setTitle(item) { function setTitle(item) {
Emby.Page.setTitle(getTitle(item) || ''); Emby.Page.setTitle(getTitle(item) || '');
if (item && 'playlists' === item.CollectionType) { if (item && item.CollectionType === 'playlists') {
hideOrShowAll(view.querySelectorAll('.btnNewItem'), false); hideOrShowAll(view.querySelectorAll('.btnNewItem'), false);
} else { } else {
hideOrShowAll(view.querySelectorAll('.btnNewItem'), true); hideOrShowAll(view.querySelectorAll('.btnNewItem'), true);
@ -569,43 +569,43 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
} }
function getTitle(item) { function getTitle(item) {
if ('Recordings' === params.type) { if (params.type === 'Recordings') {
return globalize.translate('Recordings'); return globalize.translate('Recordings');
} }
if ('Programs' === params.type) { if (params.type === 'Programs') {
if ('true' === params.IsMovie) { if (params.IsMovie === 'true') {
return globalize.translate('Movies'); return globalize.translate('Movies');
} }
if ('true' === params.IsSports) { if (params.IsSports === 'true') {
return globalize.translate('Sports'); return globalize.translate('Sports');
} }
if ('true' === params.IsKids) { if (params.IsKids === 'true') {
return globalize.translate('HeaderForKids'); return globalize.translate('HeaderForKids');
} }
if ('true' === params.IsAiring) { if (params.IsAiring === 'true') {
return globalize.translate('HeaderOnNow'); return globalize.translate('HeaderOnNow');
} }
if ('true' === params.IsSeries) { if (params.IsSeries === 'true') {
return globalize.translate('Shows'); return globalize.translate('Shows');
} }
if ('true' === params.IsNews) { if (params.IsNews === 'true') {
return globalize.translate('News'); return globalize.translate('News');
} }
return globalize.translate('Programs'); return globalize.translate('Programs');
} }
if ('nextup' === params.type) { if (params.type === 'nextup') {
return globalize.translate('NextUp'); return globalize.translate('NextUp');
} }
if ('favoritemovies' === params.type) { if (params.type === 'favoritemovies') {
return globalize.translate('FavoriteMovies'); return globalize.translate('FavoriteMovies');
} }
@ -613,35 +613,35 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
return item.Name; return item.Name;
} }
if ('Movie' === params.type) { if (params.type === 'Movie') {
return globalize.translate('Movies'); return globalize.translate('Movies');
} }
if ('Series' === params.type) { if (params.type === 'Series') {
return globalize.translate('Shows'); return globalize.translate('Shows');
} }
if ('Season' === params.type) { if (params.type === 'Season') {
return globalize.translate('Seasons'); return globalize.translate('Seasons');
} }
if ('Episode' === params.type) { if (params.type === 'Episode') {
return globalize.translate('Episodes'); return globalize.translate('Episodes');
} }
if ('MusicArtist' === params.type) { if (params.type === 'MusicArtist') {
return globalize.translate('Artists'); return globalize.translate('Artists');
} }
if ('MusicAlbum' === params.type) { if (params.type === 'MusicAlbum') {
return globalize.translate('Albums'); return globalize.translate('Albums');
} }
if ('Audio' === params.type) { if (params.type === 'Audio') {
return globalize.translate('Songs'); return globalize.translate('Songs');
} }
if ('Video' === params.type) { if (params.type === 'Video') {
return globalize.translate('Videos'); return globalize.translate('Videos');
} }
@ -700,11 +700,11 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
if (params.parentId) { if (params.parentId) {
this.itemsContainer.setAttribute('data-parentid', params.parentId); this.itemsContainer.setAttribute('data-parentid', params.parentId);
} else if ('nextup' === params.type) { } else if (params.type === 'nextup') {
this.itemsContainer.setAttribute('data-monitor', 'videoplayback'); this.itemsContainer.setAttribute('data-monitor', 'videoplayback');
} else if ('favoritemovies' === params.type) { } else if (params.type === 'favoritemovies') {
this.itemsContainer.setAttribute('data-monitor', 'markfavorite'); this.itemsContainer.setAttribute('data-monitor', 'markfavorite');
} else if ('Programs' === params.type) { } else if (params.type === 'Programs') {
this.itemsContainer.setAttribute('data-refreshinterval', '300000'); this.itemsContainer.setAttribute('data-refreshinterval', '300000');
} }
@ -737,7 +737,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var sortButton = sortButtons[i]; var sortButton = sortButtons[i];
sortButton.addEventListener('click', showSortMenu.bind(this)); sortButton.addEventListener('click', showSortMenu.bind(this));
if ('nextup' !== params.type) { if (params.type !== 'nextup') {
sortButton.classList.remove('hide'); sortButton.classList.remove('hide');
} }
} }
@ -772,19 +772,19 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
} }
}); });
if (!isRestored && item && 'PhotoAlbum' !== item.Type) { if (!isRestored && item && item.Type !== 'PhotoAlbum') {
initAlphaPicker(); initAlphaPicker();
} }
var itemType = item ? item.Type : null; var itemType = item ? item.Type : null;
if ('MusicGenre' === itemType || 'Programs' !== params.type && 'Channel' !== itemType) { if (itemType === 'MusicGenre' || params.type !== 'Programs' && itemType !== 'Channel') {
hideOrShowAll(view.querySelectorAll('.btnPlay'), false); hideOrShowAll(view.querySelectorAll('.btnPlay'), false);
} else { } else {
hideOrShowAll(view.querySelectorAll('.btnPlay'), true); hideOrShowAll(view.querySelectorAll('.btnPlay'), true);
} }
if ('MusicGenre' === itemType || 'Programs' !== params.type && 'nextup' !== params.type && 'Channel' !== itemType) { if (itemType === 'MusicGenre' || params.type !== 'Programs' && params.type !== 'nextup' && itemType !== 'Channel') {
hideOrShowAll(view.querySelectorAll('.btnShuffle'), false); hideOrShowAll(view.querySelectorAll('.btnShuffle'), false);
} else { } else {
hideOrShowAll(view.querySelectorAll('.btnShuffle'), true); hideOrShowAll(view.querySelectorAll('.btnShuffle'), true);
@ -845,14 +845,14 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
ItemsView.prototype.getFilters = function () { ItemsView.prototype.getFilters = function () {
var basekey = this.getSettingsKey(); var basekey = this.getSettingsKey();
return { return {
IsPlayed: 'true' === userSettings.getFilter(basekey + '-filter-IsPlayed'), IsPlayed: userSettings.getFilter(basekey + '-filter-IsPlayed') === 'true',
IsUnplayed: 'true' === userSettings.getFilter(basekey + '-filter-IsUnplayed'), IsUnplayed: userSettings.getFilter(basekey + '-filter-IsUnplayed') === 'true',
IsFavorite: 'true' === userSettings.getFilter(basekey + '-filter-IsFavorite'), IsFavorite: userSettings.getFilter(basekey + '-filter-IsFavorite') === 'true',
IsResumable: 'true' === userSettings.getFilter(basekey + '-filter-IsResumable'), IsResumable: userSettings.getFilter(basekey + '-filter-IsResumable') === 'true',
Is4K: 'true' === userSettings.getFilter(basekey + '-filter-Is4K'), Is4K: userSettings.getFilter(basekey + '-filter-Is4K') === 'true',
IsHD: 'true' === userSettings.getFilter(basekey + '-filter-IsHD'), IsHD: userSettings.getFilter(basekey + '-filter-IsHD') === 'true',
IsSD: 'true' === userSettings.getFilter(basekey + '-filter-IsSD'), IsSD: userSettings.getFilter(basekey + '-filter-IsSD') === 'true',
Is3D: 'true' === userSettings.getFilter(basekey + '-filter-Is3D'), Is3D: userSettings.getFilter(basekey + '-filter-Is3D') === 'true',
VideoTypes: userSettings.getFilter(basekey + '-filter-VideoTypes'), VideoTypes: userSettings.getFilter(basekey + '-filter-VideoTypes'),
SeriesStatus: userSettings.getFilter(basekey + '-filter-SeriesStatus'), SeriesStatus: userSettings.getFilter(basekey + '-filter-SeriesStatus'),
HasSubtitles: userSettings.getFilter(basekey + '-filter-HasSubtitles'), HasSubtitles: userSettings.getFilter(basekey + '-filter-HasSubtitles'),
@ -868,7 +868,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var basekey = this.getSettingsKey(); var basekey = this.getSettingsKey();
return { return {
sortBy: userSettings.getFilter(basekey + '-sortby') || this.getDefaultSortBy(), sortBy: userSettings.getFilter(basekey + '-sortby') || this.getDefaultSortBy(),
sortOrder: 'Descending' === userSettings.getFilter(basekey + '-sortorder') ? 'Descending' : 'Ascending' sortOrder: userSettings.getFilter(basekey + '-sortorder') === 'Descending' ? 'Descending' : 'Ascending'
}; };
}; };
@ -887,7 +887,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var sortBy = []; var sortBy = [];
var params = this.params; var params = this.params;
if ('Programs' === params.type) { if (params.type === 'Programs') {
sortBy.push({ sortBy.push({
name: globalize.translate('AirDate'), name: globalize.translate('AirDate'),
value: 'StartDate,SortName' value: 'StartDate,SortName'
@ -912,7 +912,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
sortBy.push(option); sortBy.push(option);
} }
if ('Programs' !== params.type) { if (params.type !== 'Programs') {
sortBy.push({ sortBy.push({
name: globalize.translate('DateAdded'), name: globalize.translate('DateAdded'),
value: 'DateCreated,SortName' value: 'DateCreated,SortName'
@ -955,7 +955,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
}; };
ItemsView.prototype.getNameSortOption = function (params) { ItemsView.prototype.getNameSortOption = function (params) {
if ('Episode' === params.type) { if (params.type === 'Episode') {
return { return {
name: globalize.translate('Name'), name: globalize.translate('Name'),
value: 'SeriesName,SortName' value: 'SeriesName,SortName'
@ -969,7 +969,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
}; };
ItemsView.prototype.getPlayCountSortOption = function () { ItemsView.prototype.getPlayCountSortOption = function () {
if ('Programs' === this.params.type) { if (this.params.type === 'Programs') {
return null; return null;
} }
@ -980,7 +980,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
}; };
ItemsView.prototype.getDatePlayedSortOption = function () { ItemsView.prototype.getDatePlayedSortOption = function () {
if ('Programs' === this.params.type) { if (this.params.type === 'Programs') {
return null; return null;
} }
@ -991,7 +991,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
}; };
ItemsView.prototype.getCriticRatingSortOption = function () { ItemsView.prototype.getCriticRatingSortOption = function () {
if ('Programs' === this.params.type) { if (this.params.type === 'Programs') {
return null; return null;
} }
@ -1012,8 +1012,8 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var filters = []; var filters = [];
var params = this.params; var params = this.params;
if (!('nextup' === params.type)) { if (!(params.type === 'nextup')) {
if ('Programs' === params.type) { if (params.type === 'Programs') {
filters.push('Genres'); filters.push('Genres');
} else { } else {
filters.push('IsUnplayed'); filters.push('IsUnplayed');
@ -1081,7 +1081,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var item = (this.params, this.currentItem); var item = (this.params, this.currentItem);
var fields = ['showTitle']; var fields = ['showTitle'];
if (!item || 'PhotoAlbum' !== item.Type && 'ChannelFolderItem' !== item.Type) { if (!item || item.Type !== 'PhotoAlbum' && item.Type !== 'ChannelFolderItem') {
fields.push('imageType'); fields.push('imageType');
} }
@ -1095,25 +1095,25 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
var item = this.currentItem; var item = this.currentItem;
var showTitle = userSettings.get(basekey + '-showTitle'); var showTitle = userSettings.get(basekey + '-showTitle');
if ('true' === showTitle) { if (showTitle === 'true') {
showTitle = true; showTitle = true;
} else if ('false' === showTitle) { } else if (showTitle === 'false') {
showTitle = false; showTitle = false;
} else if ('Programs' === params.type || 'Recordings' === params.type || 'Person' === params.type || 'nextup' === params.type || 'Audio' === params.type || 'MusicAlbum' === params.type || 'MusicArtist' === params.type) { } else if (params.type === 'Programs' || params.type === 'Recordings' || params.type === 'Person' || params.type === 'nextup' || params.type === 'Audio' || params.type === 'MusicAlbum' || params.type === 'MusicArtist') {
showTitle = true; showTitle = true;
} else if (item && 'PhotoAlbum' !== item.Type) { } else if (item && item.Type !== 'PhotoAlbum') {
showTitle = true; showTitle = true;
} }
var imageType = userSettings.get(basekey + '-imageType'); var imageType = userSettings.get(basekey + '-imageType');
if (!imageType && 'nextup' === params.type) { if (!imageType && params.type === 'nextup') {
imageType = 'thumb'; imageType = 'thumb';
} }
return { return {
showTitle: showTitle, showTitle: showTitle,
showYear: 'false' !== userSettings.get(basekey + '-showYear'), showYear: userSettings.get(basekey + '-showYear') !== 'false',
imageType: imageType || 'primary', imageType: imageType || 'primary',
viewType: userSettings.get(basekey + '-viewType') || 'images' viewType: userSettings.get(basekey + '-viewType') || 'images'
}; };
@ -1122,11 +1122,11 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
ItemsView.prototype.getItemTypes = function () { ItemsView.prototype.getItemTypes = function () {
var params = this.params; var params = this.params;
if ('nextup' === params.type) { if (params.type === 'nextup') {
return ['Episode']; return ['Episode'];
} }
if ('Programs' === params.type) { if (params.type === 'Programs') {
return ['Program']; return ['Program'];
} }

View File

@ -142,9 +142,9 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
coverImage: true, coverImage: true,
overlayText: false, overlayText: false,
lazy: true, lazy: true,
overlayPlayButton: 'play' === overlayButton, overlayPlayButton: overlayButton === 'play',
overlayMoreButton: 'more' === overlayButton, overlayMoreButton: overlayButton === 'more',
overlayInfoButton: 'info' === overlayButton, overlayInfoButton: overlayButton === 'info',
allowBottomPadding: !enableScrollX(), allowBottomPadding: !enableScrollX(),
showAirTime: true, showAirTime: true,
showAirDateTime: true showAirDateTime: true
@ -261,7 +261,7 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
require(depends, function (controllerFactory) { require(depends, function (controllerFactory) {
var tabContent; var tabContent;
if (0 == index) { if (index == 0) {
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']"); tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
self.tabContent = tabContent; self.tabContent = tabContent;
} }
@ -271,9 +271,9 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
if (!controller) { if (!controller) {
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']"); tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
if (0 === index) { if (index === 0) {
controller = self; controller = self;
} else if (6 === index) { } else if (index === 6) {
controller = new controllerFactory(view, tabContent, { controller = new controllerFactory(view, tabContent, {
collectionType: 'livetv' collectionType: 'livetv'
}); });
@ -305,8 +305,8 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
getTabController(page, index, function (controller) { getTabController(page, index, function (controller) {
initialTabIndex = null; initialTabIndex = null;
if (-1 == renderedTabs.indexOf(index)) { if (renderedTabs.indexOf(index) == -1) {
if (1 === index) { if (index === 1) {
renderedTabs.push(index); renderedTabs.push(index);
} }

View File

@ -21,7 +21,7 @@ function fillTypes(view, currentId) {
html += globalize.translate('TabOther'); html += globalize.translate('TabOther');
html += '</option>'; html += '</option>';
selectType.innerHTML = html; selectType.innerHTML = html;
selectType.disabled = null != currentId; selectType.disabled = currentId != null;
selectType.value = ''; selectType.value = '';
onTypeChange.call(selectType); onTypeChange.call(selectType);
}); });
@ -112,15 +112,15 @@ function getDetectedDevice() {
function onTypeChange() { function onTypeChange() {
const value = this.value; const value = this.value;
const view = dom.parentWithClass(this, 'page'); const view = dom.parentWithClass(this, 'page');
const mayIncludeUnsupportedDrmChannels = 'hdhomerun' === value; const mayIncludeUnsupportedDrmChannels = value === 'hdhomerun';
const supportsTranscoding = 'hdhomerun' === value; const supportsTranscoding = value === 'hdhomerun';
const supportsFavorites = 'hdhomerun' === value; const supportsFavorites = value === 'hdhomerun';
const supportsTunerIpAddress = 'hdhomerun' === value; const supportsTunerIpAddress = value === 'hdhomerun';
const supportsTunerFileOrUrl = 'm3u' === value; const supportsTunerFileOrUrl = value === 'm3u';
const supportsStreamLooping = 'm3u' === value; const supportsStreamLooping = value === 'm3u';
const supportsTunerCount = 'm3u' === value; const supportsTunerCount = value === 'm3u';
const supportsUserAgent = 'm3u' === value; const supportsUserAgent = value === 'm3u';
const suppportsSubmit = 'other' !== value; const suppportsSubmit = value !== 'other';
const supportsSelectablePath = supportsTunerFileOrUrl; const supportsSelectablePath = supportsTunerFileOrUrl;
const txtDevicePath = view.querySelector('.txtDevicePath'); const txtDevicePath = view.querySelector('.txtDevicePath');

View File

@ -50,7 +50,7 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
var viewStyle = self.getCurrentViewStyle(); var viewStyle = self.getCurrentViewStyle();
var itemsContainer = tabContent.querySelector('.itemsContainer'); var itemsContainer = tabContent.querySelector('.itemsContainer');
if ('List' == viewStyle) { if (viewStyle == 'List') {
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
} else { } else {

View File

@ -56,13 +56,13 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
var elem = entry.target; var elem = entry.target;
var id = elem.getAttribute('data-id'); var id = elem.getAttribute('data-id');
var viewStyle = self.getCurrentViewStyle(); var viewStyle = self.getCurrentViewStyle();
var limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9; var limit = viewStyle == 'Thumb' || viewStyle == 'ThumbCard' ? 5 : 9;
if (enableScrollX()) { if (enableScrollX()) {
limit = 10; limit = 10;
} }
var enableImageTypes = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 'Primary,Backdrop,Thumb' : 'Primary'; var enableImageTypes = viewStyle == 'Thumb' || viewStyle == 'ThumbCard' ? 'Primary,Backdrop,Thumb' : 'Primary';
var query = { var query = {
SortBy: 'SortName', SortBy: 'SortName',
SortOrder: 'Ascending', SortOrder: 'Ascending',

View File

@ -73,7 +73,7 @@ import 'emby-itemscontainer';
const viewStyle = self.getCurrentViewStyle(); const viewStyle = self.getCurrentViewStyle();
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabContent.querySelector('.itemsContainer');
if ('List' == viewStyle) { if (viewStyle == 'List') {
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
} else { } else {

View File

@ -57,7 +57,7 @@ import 'emby-itemscontainer';
const viewStyle = self.getCurrentViewStyle(); const viewStyle = self.getCurrentViewStyle();
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabContent.querySelector('.itemsContainer');
if ('List' == viewStyle) { if (viewStyle == 'List') {
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
} else { } else {

View File

@ -304,7 +304,7 @@ import 'flexStyles';
import(depends).then(({default: controllerFactory}) => { import(depends).then(({default: controllerFactory}) => {
let tabContent; let tabContent;
if (0 == index) { if (index == 0) {
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']"); tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
self.tabContent = tabContent; self.tabContent = tabContent;
} }

View File

@ -22,18 +22,18 @@ import 'css!assets/css/videoosd';
/* eslint-disable indent */ /* eslint-disable indent */
function seriesImageUrl(item, options) { function seriesImageUrl(item, options) {
if ('Episode' !== item.Type) { if (item.Type !== 'Episode') {
return null; return null;
} }
options = options || {}; options = options || {};
options.type = options.type || 'Primary'; options.type = options.type || 'Primary';
if ('Primary' === options.type && item.SeriesPrimaryImageTag) { if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag; options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
if ('Thumb' === options.type) { if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) { if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag; options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
@ -57,7 +57,7 @@ import 'css!assets/css/videoosd';
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options); return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
} }
if ('Primary' === options.type && item.AlbumId && item.AlbumPrimaryImageTag) { if (options.type === 'Primary' && item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag; options.tag = item.AlbumPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options); return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
} }
@ -104,7 +104,7 @@ import 'css!assets/css/videoosd';
function onDoubleClick(e) { function onDoubleClick(e) {
const clientX = e.clientX; const clientX = e.clientX;
if (null != clientX) { if (clientX != null) {
if (clientX < dom.getWindowSize().innerWidth / 2) { if (clientX < dom.getWindowSize().innerWidth / 2) {
playbackManager.rewind(currentPlayer); playbackManager.rewind(currentPlayer);
} else { } else {
@ -117,7 +117,7 @@ import 'css!assets/css/videoosd';
} }
function getDisplayItem(item) { function getDisplayItem(item) {
if ('TvChannel' === item.Type) { if (item.Type === 'TvChannel') {
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = connectionManager.getApiClient(item.ServerId);
return apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (refreshedItem) { return apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (refreshedItem) {
return { return {
@ -133,7 +133,7 @@ import 'css!assets/css/videoosd';
} }
function updateRecordingButton(item) { function updateRecordingButton(item) {
if (!item || 'Program' !== item.Type) { if (!item || item.Type !== 'Program') {
if (recordingButtonManager) { if (recordingButtonManager) {
recordingButtonManager.destroy(); recordingButtonManager.destroy();
recordingButtonManager = null; recordingButtonManager = null;
@ -176,8 +176,8 @@ import 'css!assets/css/videoosd';
const osdTitle = view.querySelector('.osdTitle'); const osdTitle = view.querySelector('.osdTitle');
titleElement = osdTitle; titleElement = osdTitle;
let displayName = itemHelper.getDisplayName(displayItem, { let displayName = itemHelper.getDisplayName(displayItem, {
includeParentInfo: 'Program' !== displayItem.Type, includeParentInfo: displayItem.Type !== 'Program',
includeIndexNumber: 'Program' !== displayItem.Type includeIndexNumber: displayItem.Type !== 'Program'
}); });
if (!displayName) { if (!displayName) {
@ -198,8 +198,8 @@ import 'css!assets/css/videoosd';
tomatoes: false, tomatoes: false,
endsAt: false, endsAt: false,
episodeTitle: false, episodeTitle: false,
originalAirDate: 'Program' !== displayItem.Type, originalAirDate: displayItem.Type !== 'Program',
episodeTitleIndexNumber: 'Program' !== displayItem.Type, episodeTitleIndexNumber: displayItem.Type !== 'Program',
programIndicator: false programIndicator: false
}); });
const osdMediaInfo = view.querySelector('.osdMediaInfo'); const osdMediaInfo = view.querySelector('.osdMediaInfo');
@ -271,7 +271,7 @@ import 'css!assets/css/videoosd';
} }
function shouldEnableProgressByTimeOfDay(item) { function shouldEnableProgressByTimeOfDay(item) {
return !('TvChannel' !== item.Type || !item.CurrentProgram); return !(item.Type !== 'TvChannel' || !item.CurrentProgram);
} }
function updateNowPlayingInfo(player, state) { function updateNowPlayingInfo(player, state) {
@ -372,7 +372,7 @@ import 'css!assets/css/videoosd';
} }
function toggleOsd() { function toggleOsd() {
if ('osd' === currentVisibleMenu) { if (currentVisibleMenu === 'osd') {
hideOsd(); hideOsd();
} else if (!currentVisibleMenu) { } else if (!currentVisibleMenu) {
showOsd(); showOsd();
@ -433,7 +433,7 @@ import 'css!assets/css/videoosd';
} }
function hideMainOsdControls() { function hideMainOsdControls() {
if ('osd' === currentVisibleMenu) { if (currentVisibleMenu === 'osd') {
const elem = osdBottomElement; const elem = osdBottomElement;
clearHideAnimationEventListeners(elem); clearHideAnimationEventListeners(elem);
elem.classList.add('videoOsdBottom-hidden'); elem.classList.add('videoOsdBottom-hidden');
@ -463,7 +463,7 @@ import 'css!assets/css/videoosd';
} }
function onPointerMove(e) { function onPointerMove(e) {
if ('mouse' === (e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse'))) { if ((e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse')) === 'mouse') {
const eventX = e.screenX || 0; const eventX = e.screenX || 0;
const eventY = e.screenY || 0; const eventY = e.screenY || 0;
const obj = lastPointerMoveData; const obj = lastPointerMoveData;
@ -491,7 +491,7 @@ import 'css!assets/css/videoosd';
switch (e.detail.command) { switch (e.detail.command) {
case 'left': case 'left':
if ('osd' === currentVisibleMenu) { if (currentVisibleMenu === 'osd') {
showOsd(); showOsd();
} else { } else {
if (!currentVisibleMenu) { if (!currentVisibleMenu) {
@ -503,7 +503,7 @@ import 'css!assets/css/videoosd';
break; break;
case 'right': case 'right':
if ('osd' === currentVisibleMenu) { if (currentVisibleMenu === 'osd') {
showOsd(); showOsd();
} else if (!currentVisibleMenu) { } else if (!currentVisibleMenu) {
e.preventDefault(); e.preventDefault();
@ -618,7 +618,7 @@ import 'css!assets/css/videoosd';
resetUpNextDialog(); resetUpNextDialog();
console.debug('nowplaying event: ' + e.type); console.debug('nowplaying event: ' + e.type);
if ('Video' !== state.NextMediaType) { if (state.NextMediaType !== 'Video') {
view.removeEventListener('viewbeforehide', onViewHideStopPlayback); view.removeEventListener('viewbeforehide', onViewHideStopPlayback);
Emby.Page.back(); Emby.Page.back();
} }
@ -705,7 +705,7 @@ import 'css!assets/css/videoosd';
} }
function showComingUpNextIfNeeded(player, currentItem, currentTimeTicks, runtimeTicks) { function showComingUpNextIfNeeded(player, currentItem, currentTimeTicks, runtimeTicks) {
if (runtimeTicks && currentTimeTicks && !comingUpNextDisplayed && !currentVisibleMenu && 'Episode' === currentItem.Type && userSettings.enableNextVideoInfoOverlay()) { if (runtimeTicks && currentTimeTicks && !comingUpNextDisplayed && !currentVisibleMenu && currentItem.Type === 'Episode' && userSettings.enableNextVideoInfoOverlay()) {
const showAtSecondsLeft = runtimeTicks >= 3e10 ? 40 : runtimeTicks >= 24e9 ? 35 : 30; const showAtSecondsLeft = runtimeTicks >= 3e10 ? 40 : runtimeTicks >= 24e9 ? 35 : 30;
const showAtTicks = runtimeTicks - 1e3 * showAtSecondsLeft * 1e4; const showAtTicks = runtimeTicks - 1e3 * showAtSecondsLeft * 1e4;
const timeRemainingTicks = runtimeTicks - currentTimeTicks; const timeRemainingTicks = runtimeTicks - currentTimeTicks;
@ -717,7 +717,7 @@ import 'css!assets/css/videoosd';
} }
function onUpNextHidden() { function onUpNextHidden() {
if ('upnext' === currentVisibleMenu) { if (currentVisibleMenu === 'upnext') {
currentVisibleMenu = null; currentVisibleMenu = null;
} }
} }
@ -740,7 +740,7 @@ import 'css!assets/css/videoosd';
} }
function refreshProgramInfoIfNeeded(player, item) { function refreshProgramInfoIfNeeded(player, item) {
if ('TvChannel' === item.Type) { if (item.Type === 'TvChannel') {
const program = item.CurrentProgram; const program = item.CurrentProgram;
if (program && program.EndDate) { if (program && program.EndDate) {
@ -781,7 +781,7 @@ import 'css!assets/css/videoosd';
updatePlayPauseState(playState.IsPaused); updatePlayPauseState(playState.IsPaused);
const supportedCommands = playbackManager.getSupportedCommands(player); const supportedCommands = playbackManager.getSupportedCommands(player);
currentPlayerSupportedCommands = supportedCommands; currentPlayerSupportedCommands = supportedCommands;
supportsBrightnessChange = -1 !== supportedCommands.indexOf('SetBrightness'); supportsBrightnessChange = supportedCommands.indexOf('SetBrightness') !== -1;
updatePlayerVolumeState(player, playState.IsMuted, playState.VolumeLevel); updatePlayerVolumeState(player, playState.IsMuted, playState.VolumeLevel);
if (nowPlayingPositionSlider && !nowPlayingPositionSlider.dragging) { if (nowPlayingPositionSlider && !nowPlayingPositionSlider.dragging) {
@ -795,13 +795,13 @@ import 'css!assets/css/videoosd';
updateTimeDisplay(playState.PositionTicks, nowPlayingItem.RunTimeTicks, playState.PlaybackStartTimeTicks, playState.BufferedRanges || []); updateTimeDisplay(playState.PositionTicks, nowPlayingItem.RunTimeTicks, playState.PlaybackStartTimeTicks, playState.BufferedRanges || []);
updateNowPlayingInfo(player, state); updateNowPlayingInfo(player, state);
if (state.MediaSource && state.MediaSource.SupportsTranscoding && -1 !== supportedCommands.indexOf('SetMaxStreamingBitrate')) { if (state.MediaSource && state.MediaSource.SupportsTranscoding && supportedCommands.indexOf('SetMaxStreamingBitrate') !== -1) {
view.querySelector('.btnVideoOsdSettings').classList.remove('hide'); view.querySelector('.btnVideoOsdSettings').classList.remove('hide');
} else { } else {
view.querySelector('.btnVideoOsdSettings').classList.add('hide'); view.querySelector('.btnVideoOsdSettings').classList.add('hide');
} }
const isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks; const isProgressClear = state.MediaSource && state.MediaSource.RunTimeTicks == null;
nowPlayingPositionSlider.setIsClear(isProgressClear); nowPlayingPositionSlider.setIsClear(isProgressClear);
if (nowPlayingItem.RunTimeTicks) { if (nowPlayingItem.RunTimeTicks) {
@ -809,19 +809,19 @@ import 'css!assets/css/videoosd';
userSettings.skipForwardLength() * 1000000 / nowPlayingItem.RunTimeTicks); userSettings.skipForwardLength() * 1000000 / nowPlayingItem.RunTimeTicks);
} }
if (-1 === supportedCommands.indexOf('ToggleFullscreen') || player.isLocalPlayer && layoutManager.tv && playbackManager.isFullscreen(player)) { if (supportedCommands.indexOf('ToggleFullscreen') === -1 || player.isLocalPlayer && layoutManager.tv && playbackManager.isFullscreen(player)) {
view.querySelector('.btnFullscreen').classList.add('hide'); view.querySelector('.btnFullscreen').classList.add('hide');
} else { } else {
view.querySelector('.btnFullscreen').classList.remove('hide'); view.querySelector('.btnFullscreen').classList.remove('hide');
} }
if (-1 === supportedCommands.indexOf('PictureInPicture')) { if (supportedCommands.indexOf('PictureInPicture') === -1) {
view.querySelector('.btnPip').classList.add('hide'); view.querySelector('.btnPip').classList.add('hide');
} else { } else {
view.querySelector('.btnPip').classList.remove('hide'); view.querySelector('.btnPip').classList.remove('hide');
} }
if (-1 === supportedCommands.indexOf('AirPlay')) { if (supportedCommands.indexOf('AirPlay') === -1) {
view.querySelector('.btnAirPlay').classList.add('hide'); view.querySelector('.btnAirPlay').classList.add('hide');
} else { } else {
view.querySelector('.btnAirPlay').classList.remove('hide'); view.querySelector('.btnAirPlay').classList.remove('hide');
@ -869,7 +869,7 @@ import 'css!assets/css/videoosd';
nowPlayingPositionSlider.value = 0; nowPlayingPositionSlider.value = 0;
} }
if (runtimeTicks && null != positionTicks && currentRuntimeTicks && !enableProgressByTimeOfDay && currentItem.RunTimeTicks && 'Recording' !== currentItem.Type) { if (runtimeTicks && positionTicks != null && currentRuntimeTicks && !enableProgressByTimeOfDay && currentItem.RunTimeTicks && currentItem.Type !== 'Recording') {
endsAtText.innerHTML = '&nbsp;&nbsp;-&nbsp;&nbsp;' + mediaInfo.getEndsAtFromPosition(runtimeTicks, positionTicks, true); endsAtText.innerHTML = '&nbsp;&nbsp;-&nbsp;&nbsp;' + mediaInfo.getEndsAtFromPosition(runtimeTicks, positionTicks, true);
} else { } else {
endsAtText.innerHTML = ''; endsAtText.innerHTML = '';
@ -890,11 +890,11 @@ import 'css!assets/css/videoosd';
let showMuteButton = true; let showMuteButton = true;
let showVolumeSlider = true; let showVolumeSlider = true;
if (-1 === supportedCommands.indexOf('Mute')) { if (supportedCommands.indexOf('Mute') === -1) {
showMuteButton = false; showMuteButton = false;
} }
if (-1 === supportedCommands.indexOf('SetVolume')) { if (supportedCommands.indexOf('SetVolume') === -1) {
showVolumeSlider = false; showVolumeSlider = false;
} }
@ -945,7 +945,7 @@ import 'css!assets/css/videoosd';
} }
function updateTimeText(elem, ticks, divider) { function updateTimeText(elem, ticks, divider) {
if (null == ticks) { if (ticks == null) {
elem.innerHTML = ''; elem.innerHTML = '';
return; return;
} }
@ -987,9 +987,9 @@ import 'css!assets/css/videoosd';
} }
function onSettingsOption(selectedOption) { function onSettingsOption(selectedOption) {
if ('stats' === selectedOption) { if (selectedOption === 'stats') {
toggleStats(); toggleStats();
} else if ('suboffset' === selectedOption) { } else if (selectedOption === 'suboffset') {
const player = currentPlayer; const player = currentPlayer;
if (player) { if (player) {
playbackManager.enableShowingSubtitleOffset(player); playbackManager.enableShowingSubtitleOffset(player);
@ -1063,7 +1063,7 @@ import 'css!assets/css/videoosd';
const streams = playbackManager.subtitleTracks(player); const streams = playbackManager.subtitleTracks(player);
let currentIndex = playbackManager.getSubtitleStreamIndex(player); let currentIndex = playbackManager.getSubtitleStreamIndex(player);
if (null == currentIndex) { if (currentIndex == null) {
currentIndex = -1; currentIndex = -1;
} }
@ -1136,7 +1136,7 @@ import 'css!assets/css/videoosd';
const key = keyboardnavigation.getKeyName(e); const key = keyboardnavigation.getKeyName(e);
const isKeyModified = e.ctrlKey || e.altKey; const isKeyModified = e.ctrlKey || e.altKey;
if (!currentVisibleMenu && 32 === e.keyCode) { if (!currentVisibleMenu && e.keyCode === 32) {
playbackManager.playPause(currentPlayer); playbackManager.playPause(currentPlayer);
showOsd(); showOsd();
return; return;

View File

@ -3,21 +3,21 @@ import globalize from 'globalize';
/* eslint-disable indent */ /* eslint-disable indent */
function processForgotPasswordResult(result) { function processForgotPasswordResult(result) {
if ('ContactAdmin' == result.Action) { if (result.Action == 'ContactAdmin') {
return void Dashboard.alert({ return void Dashboard.alert({
message: globalize.translate('MessageContactAdminToResetPassword'), message: globalize.translate('MessageContactAdminToResetPassword'),
title: globalize.translate('HeaderForgotPassword') title: globalize.translate('HeaderForgotPassword')
}); });
} }
if ('InNetworkRequired' == result.Action) { if (result.Action == 'InNetworkRequired') {
return void Dashboard.alert({ return void Dashboard.alert({
message: globalize.translate('MessageForgotPasswordInNetworkRequired'), message: globalize.translate('MessageForgotPasswordInNetworkRequired'),
title: globalize.translate('HeaderForgotPassword') title: globalize.translate('HeaderForgotPassword')
}); });
} }
if ('PinCode' == result.Action) { if (result.Action == 'PinCode') {
let msg = globalize.translate('MessageForgotPasswordFileCreated'); let msg = globalize.translate('MessageForgotPasswordFileCreated');
msg += '<br/>'; msg += '<br/>';
msg += '<br/>'; msg += '<br/>';

View File

@ -58,7 +58,7 @@ import 'emby-itemscontainer';
const viewStyle = self.getCurrentViewStyle(); const viewStyle = self.getCurrentViewStyle();
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabContent.querySelector('.itemsContainer');
if ('List' == viewStyle) { if (viewStyle == 'List') {
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
} else { } else {

View File

@ -62,13 +62,13 @@ import 'emby-button';
const elem = entry.target; const elem = entry.target;
const id = elem.getAttribute('data-id'); const id = elem.getAttribute('data-id');
const viewStyle = self.getCurrentViewStyle(); const viewStyle = self.getCurrentViewStyle();
let limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9; let limit = viewStyle == 'Thumb' || viewStyle == 'ThumbCard' ? 5 : 9;
if (enableScrollX()) { if (enableScrollX()) {
limit = 10; limit = 10;
} }
const enableImageTypes = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 'Primary,Backdrop,Thumb' : 'Primary'; const enableImageTypes = viewStyle == 'Thumb' || viewStyle == 'ThumbCard' ? 'Primary,Backdrop,Thumb' : 'Primary';
const query = { const query = {
SortBy: 'SortName', SortBy: 'SortName',
SortOrder: 'Ascending', SortOrder: 'Ascending',

View File

@ -58,7 +58,7 @@ import 'emby-itemscontainer';
const viewStyle = self.getCurrentViewStyle(); const viewStyle = self.getCurrentViewStyle();
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabContent.querySelector('.itemsContainer');
if ('List' == viewStyle) { if (viewStyle == 'List') {
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
} else { } else {

View File

@ -1663,7 +1663,7 @@ function tryRemoveElement(elem) {
setAspectRatio(val) { setAspectRatio(val) {
const mediaElement = this.#mediaElement; const mediaElement = this.#mediaElement;
if (mediaElement) { if (mediaElement) {
if ('auto' === val) { if (val === 'auto') {
mediaElement.style.removeProperty('object-fit'); mediaElement.style.removeProperty('object-fit');
} else { } else {
mediaElement.style['object-fit'] = val; mediaElement.style['object-fit'] = val;

View File

@ -11,7 +11,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
}); });
} }
if (item.ProgramCount && 'Person' == item.Type) { if (item.ProgramCount && item.Type == 'Person') {
sections.push({ sections.push({
name: globalize.translate('HeaderUpcomingOnTV'), name: globalize.translate('HeaderUpcomingOnTV'),
type: 'Program' type: 'Program'
@ -65,7 +65,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
var html = ''; var html = '';
var sectionClass = 'verticalSection'; var sectionClass = 'verticalSection';
if ('Audio' === section.type) { if (section.type === 'Audio') {
sectionClass += ' verticalSection-extrabottompadding'; sectionClass += ' verticalSection-extrabottompadding';
} }
@ -272,7 +272,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
listOptions.items = result.Items; listOptions.items = result.Items;
var itemsContainer = element.querySelector('.itemsContainer'); var itemsContainer = element.querySelector('.itemsContainer');
if ('Audio' == type) { if (type == 'Audio') {
html = listView.getListViewHtml(listOptions); html = listView.getListViewHtml(listOptions);
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
@ -288,23 +288,23 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
} }
function getMoreItemsHref(item, type) { function getMoreItemsHref(item, type) {
if ('Genre' == item.Type) { if (item.Type == 'Genre') {
return 'list.html?type=' + type + '&genreId=' + item.Id + '&serverId=' + item.ServerId; return 'list.html?type=' + type + '&genreId=' + item.Id + '&serverId=' + item.ServerId;
} }
if ('MusicGenre' == item.Type) { if (item.Type == 'MusicGenre') {
return 'list.html?type=' + type + '&musicGenreId=' + item.Id + '&serverId=' + item.ServerId; return 'list.html?type=' + type + '&musicGenreId=' + item.Id + '&serverId=' + item.ServerId;
} }
if ('Studio' == item.Type) { if (item.Type == 'Studio') {
return 'list.html?type=' + type + '&studioId=' + item.Id + '&serverId=' + item.ServerId; return 'list.html?type=' + type + '&studioId=' + item.Id + '&serverId=' + item.ServerId;
} }
if ('MusicArtist' == item.Type) { if (item.Type == 'MusicArtist') {
return 'list.html?type=' + type + '&artistId=' + item.Id + '&serverId=' + item.ServerId; return 'list.html?type=' + type + '&artistId=' + item.Id + '&serverId=' + item.ServerId;
} }
if ('Person' == item.Type) { if (item.Type == 'Person') {
return 'list.html?type=' + type + '&personId=' + item.Id + '&serverId=' + item.ServerId; return 'list.html?type=' + type + '&personId=' + item.Id + '&serverId=' + item.ServerId;
} }
@ -354,7 +354,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
var apiClient = connectionManager.getApiClient(item.ServerId); var apiClient = connectionManager.getApiClient(item.ServerId);
if ('MusicArtist' === query.IncludeItemTypes) { if (query.IncludeItemTypes === 'MusicArtist') {
query.IncludeItemTypes = null; query.IncludeItemTypes = null;
return apiClient.getAlbumArtists(apiClient.getCurrentUserId(), query); return apiClient.getAlbumArtists(apiClient.getCurrentUserId(), query);
} }

View File

@ -178,9 +178,9 @@ export function showSortMenu (options) {
html += globalize.translate('HeaderSortOrder'); html += globalize.translate('HeaderSortOrder');
html += '</h2>'; html += '</h2>';
html += '<div>'; html += '<div>';
isChecked = 'Ascending' == options.query.SortOrder ? ' checked' : ''; isChecked = options.query.SortOrder == 'Ascending' ? ' checked' : '';
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionAscending') + '</span></label>'; html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionAscending') + '</span></label>';
isChecked = 'Descending' == options.query.SortOrder ? ' checked' : ''; isChecked = options.query.SortOrder == 'Descending' ? ' checked' : '';
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionDescending') + '</span></label>'; html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionDescending') + '</span></label>';
html += '</div>'; html += '</div>';
html += '</div>'; html += '</div>';

View File

@ -309,7 +309,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
} }
function isUrlInCurrentView(url) { function isUrlInCurrentView(url) {
return -1 !== window.location.href.toString().toLowerCase().indexOf(url.toLowerCase()); return window.location.href.toString().toLowerCase().indexOf(url.toLowerCase()) !== -1;
} }
function updateDashboardMenuSelectedItem() { function updateDashboardMenuSelectedItem() {
@ -323,7 +323,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
if (pageIds) { if (pageIds) {
pageIds = pageIds.split('|'); pageIds = pageIds.split('|');
selected = -1 != pageIds.indexOf(currentViewId); selected = pageIds.indexOf(currentViewId) != -1;
} }
var pageUrls = link.getAttribute('data-pageurls'); var pageUrls = link.getAttribute('data-pageurls');
@ -545,7 +545,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
var view = items[i]; var view = items[i];
list.push(view); list.push(view);
if ('livetv' == view.CollectionType) { if (view.CollectionType == 'livetv') {
view.ImageTags = {}; view.ImageTags = {};
view.icon = 'live_tv'; view.icon = 'live_tv';
var guideView = Object.assign({}, view); var guideView = Object.assign({}, view);
@ -671,15 +671,15 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
var lnkMediaFolder = elems[i]; var lnkMediaFolder = elems[i];
var itemId = lnkMediaFolder.getAttribute('data-itemid'); var itemId = lnkMediaFolder.getAttribute('data-itemid');
if (isChannelsPage && 'channels' === itemId) { if (isChannelsPage && itemId === 'channels') {
lnkMediaFolder.classList.add('navMenuOption-selected'); lnkMediaFolder.classList.add('navMenuOption-selected');
} else if (isLiveTvPage && 'livetv' === itemId) { } else if (isLiveTvPage && itemId === 'livetv') {
lnkMediaFolder.classList.add('navMenuOption-selected'); lnkMediaFolder.classList.add('navMenuOption-selected');
} else if (isEditorPage && 'editor' === itemId) { } else if (isEditorPage && itemId === 'editor') {
lnkMediaFolder.classList.add('navMenuOption-selected'); lnkMediaFolder.classList.add('navMenuOption-selected');
} else if (isMySyncPage && 'manageoffline' === itemId && -1 != window.location.href.toString().indexOf('mode=download')) { } else if (isMySyncPage && itemId === 'manageoffline' && window.location.href.toString().indexOf('mode=download') != -1) {
lnkMediaFolder.classList.add('navMenuOption-selected'); lnkMediaFolder.classList.add('navMenuOption-selected');
} else if (isMySyncPage && 'syncotherdevices' === itemId && -1 == window.location.href.toString().indexOf('mode=download')) { } else if (isMySyncPage && itemId === 'syncotherdevices' && window.location.href.toString().indexOf('mode=download') == -1) {
lnkMediaFolder.classList.add('navMenuOption-selected'); lnkMediaFolder.classList.add('navMenuOption-selected');
} else if (id && itemId == id) { } else if (id && itemId == id) {
lnkMediaFolder.classList.add('navMenuOption-selected'); lnkMediaFolder.classList.add('navMenuOption-selected');
@ -753,7 +753,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
} }
if (headerBackButton) { if (headerBackButton) {
if ('false' !== page.getAttribute('data-backbutton') && appRouter.canGoBack()) { if (page.getAttribute('data-backbutton') !== 'false' && appRouter.canGoBack()) {
headerBackButton.classList.remove('hide'); headerBackButton.classList.remove('hide');
} else { } else {
headerBackButton.classList.add('hide'); headerBackButton.classList.add('hide');
@ -863,11 +863,11 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
document.title = 'Jellyfin'; document.title = 'Jellyfin';
}, },
setTitle: function (title) { setTitle: function (title) {
if (null == title) { if (title == null) {
return void LibraryMenu.setDefaultTitle(); return void LibraryMenu.setDefaultTitle();
} }
if ('-' === title) { if (title === '-') {
title = ''; title = '';
} }
@ -922,7 +922,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
} }
} }
if ('library' !== currentDrawerType) { if (currentDrawerType !== 'library') {
refreshLibraryDrawer(); refreshLibraryDrawer();
} }
} }

View File

@ -60,7 +60,7 @@ export default function (view, params) {
const viewStyle = getPageData(view).view; const viewStyle = getPageData(view).view;
const itemsContainer = view.querySelector('.itemsContainer'); const itemsContainer = view.querySelector('.itemsContainer');
if ('List' == viewStyle) { if (viewStyle == 'List') {
itemsContainer.classList.add('vertical-list'); itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap'); itemsContainer.classList.remove('vertical-wrap');
} else { } else {

View File

@ -6,7 +6,7 @@ function getWindowLocationSearch(win) {
if (!search) { if (!search) {
var index = window.location.href.indexOf('?'); var index = window.location.href.indexOf('?');
if (-1 != index) { if (index != -1) {
search = window.location.href.substring(index); search = window.location.href.substring(index);
} }
} }
@ -22,7 +22,7 @@ window.getParameterByName = function (name, url) {
var regex = new RegExp(regexS, 'i'); var regex = new RegExp(regexS, 'i');
var results = regex.exec(url || getWindowLocationSearch()); var results = regex.exec(url || getWindowLocationSearch());
if (null == results) { if (results == null) {
return ''; return '';
} }
@ -73,7 +73,7 @@ var Dashboard = {
var urlLower = window.location.href.toLowerCase(); var urlLower = window.location.href.toLowerCase();
var index = urlLower.lastIndexOf('/web'); var index = urlLower.lastIndexOf('/web');
if (-1 != index) { if (index != -1) {
return urlLower.substring(0, index); return urlLower.substring(0, index);
} }
@ -178,7 +178,7 @@ var Dashboard = {
}); });
}, },
alert: function (options) { alert: function (options) {
if ('string' == typeof options) { if (typeof options == 'string') {
return void require(['toast'], function (toast) { return void require(['toast'], function (toast) {
toast({ toast({
text: options text: options
@ -197,7 +197,7 @@ var Dashboard = {
var capabilities = { var capabilities = {
PlayableMediaTypes: ['Audio', 'Video'], PlayableMediaTypes: ['Audio', 'Video'],
SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'], SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'],
SupportsPersistentIdentifier: 'cordova' === self.appMode || 'android' === self.appMode, SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android',
SupportsMediaControl: true SupportsMediaControl: true
}; };
appHost.getPushTokenInfo(); appHost.getPushTokenInfo();
@ -452,8 +452,8 @@ function initClient() {
} }
function onGlobalizeInit(browser, globalize) { function onGlobalizeInit(browser, globalize) {
if ('android' === self.appMode) { if (self.appMode === 'android') {
if (-1 !== self.location.href.toString().toLowerCase().indexOf('start=backgroundsync')) { if (self.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) {
return onAppReady(browser); return onAppReady(browser);
} }
} }
@ -863,7 +863,7 @@ function initClient() {
}); });
define('appRouter', [componentsPath + '/appRouter', 'itemHelper'], function (appRouter, itemHelper) { define('appRouter', [componentsPath + '/appRouter', 'itemHelper'], function (appRouter, itemHelper) {
function showItem(item, serverId, options) { function showItem(item, serverId, options) {
if ('string' == typeof item) { if (typeof item == 'string') {
require(['connectionManager'], function (connectionManager) { require(['connectionManager'], function (connectionManager) {
var apiClient = connectionManager.currentApiClient(); var apiClient = connectionManager.currentApiClient();
apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) {
@ -871,7 +871,7 @@ function initClient() {
}); });
}); });
} else { } else {
if (2 == arguments.length) { if (arguments.length == 2) {
options = arguments[1]; options = arguments[1];
} }
@ -953,27 +953,27 @@ function initClient() {
var itemType = item.Type || (options ? options.itemType : null); var itemType = item.Type || (options ? options.itemType : null);
var serverId = item.ServerId || options.serverId; var serverId = item.ServerId || options.serverId;
if ('settings' === item) { if (item === 'settings') {
return 'mypreferencesmenu.html'; return 'mypreferencesmenu.html';
} }
if ('wizard' === item) { if (item === 'wizard') {
return 'wizardstart.html'; return 'wizardstart.html';
} }
if ('manageserver' === item) { if (item === 'manageserver') {
return 'dashboard.html'; return 'dashboard.html';
} }
if ('recordedtv' === item) { if (item === 'recordedtv') {
return 'livetv.html?tab=3&serverId=' + options.serverId; return 'livetv.html?tab=3&serverId=' + options.serverId;
} }
if ('nextup' === item) { if (item === 'nextup') {
return 'list.html?type=nextup&serverId=' + options.serverId; return 'list.html?type=nextup&serverId=' + options.serverId;
} }
if ('list' === item) { if (item === 'list') {
var url = 'list.html?serverId=' + options.serverId + '&type=' + options.itemTypes; var url = 'list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
if (options.isFavorite) { if (options.isFavorite) {
@ -983,61 +983,61 @@ function initClient() {
return url; return url;
} }
if ('livetv' === item) { if (item === 'livetv') {
if ('programs' === options.section) { if (options.section === 'programs') {
return 'livetv.html?tab=0&serverId=' + options.serverId; return 'livetv.html?tab=0&serverId=' + options.serverId;
} }
if ('guide' === options.section) { if (options.section === 'guide') {
return 'livetv.html?tab=1&serverId=' + options.serverId; return 'livetv.html?tab=1&serverId=' + options.serverId;
} }
if ('movies' === options.section) { if (options.section === 'movies') {
return 'list.html?type=Programs&IsMovie=true&serverId=' + options.serverId; return 'list.html?type=Programs&IsMovie=true&serverId=' + options.serverId;
} }
if ('shows' === options.section) { if (options.section === 'shows') {
return 'list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId; return 'list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId;
} }
if ('sports' === options.section) { if (options.section === 'sports') {
return 'list.html?type=Programs&IsSports=true&serverId=' + options.serverId; return 'list.html?type=Programs&IsSports=true&serverId=' + options.serverId;
} }
if ('kids' === options.section) { if (options.section === 'kids') {
return 'list.html?type=Programs&IsKids=true&serverId=' + options.serverId; return 'list.html?type=Programs&IsKids=true&serverId=' + options.serverId;
} }
if ('news' === options.section) { if (options.section === 'news') {
return 'list.html?type=Programs&IsNews=true&serverId=' + options.serverId; return 'list.html?type=Programs&IsNews=true&serverId=' + options.serverId;
} }
if ('onnow' === options.section) { if (options.section === 'onnow') {
return 'list.html?type=Programs&IsAiring=true&serverId=' + options.serverId; return 'list.html?type=Programs&IsAiring=true&serverId=' + options.serverId;
} }
if ('dvrschedule' === options.section) { if (options.section === 'dvrschedule') {
return 'livetv.html?tab=4&serverId=' + options.serverId; return 'livetv.html?tab=4&serverId=' + options.serverId;
} }
if ('seriesrecording' === options.section) { if (options.section === 'seriesrecording') {
return 'livetv.html?tab=5&serverId=' + options.serverId; return 'livetv.html?tab=5&serverId=' + options.serverId;
} }
return 'livetv.html?serverId=' + options.serverId; return 'livetv.html?serverId=' + options.serverId;
} }
if ('SeriesTimer' == itemType) { if (itemType == 'SeriesTimer') {
return 'details?seriesTimerId=' + id + '&serverId=' + serverId; return 'details?seriesTimerId=' + id + '&serverId=' + serverId;
} }
if ('livetv' == item.CollectionType) { if (item.CollectionType == 'livetv') {
return 'livetv.html'; return 'livetv.html';
} }
if ('Genre' === item.Type) { if (item.Type === 'Genre') {
url = 'list.html?genreId=' + item.Id + '&serverId=' + serverId; url = 'list.html?genreId=' + item.Id + '&serverId=' + serverId;
if ('livetv' === context) { if (context === 'livetv') {
url += '&type=Programs'; url += '&type=Programs';
} }
@ -1048,7 +1048,7 @@ function initClient() {
return url; return url;
} }
if ('MusicGenre' === item.Type) { if (item.Type === 'MusicGenre') {
url = 'list.html?musicGenreId=' + item.Id + '&serverId=' + serverId; url = 'list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
if (options.parentId) { if (options.parentId) {
@ -1058,7 +1058,7 @@ function initClient() {
return url; return url;
} }
if ('Studio' === item.Type) { if (item.Type === 'Studio') {
url = 'list.html?studioId=' + item.Id + '&serverId=' + serverId; url = 'list.html?studioId=' + item.Id + '&serverId=' + serverId;
if (options.parentId) { if (options.parentId) {
@ -1068,28 +1068,28 @@ function initClient() {
return url; return url;
} }
if ('folders' !== context && !itemHelper.isLocalItem(item)) { if (context !== 'folders' && !itemHelper.isLocalItem(item)) {
if ('movies' == item.CollectionType) { if (item.CollectionType == 'movies') {
url = 'movies.html?topParentId=' + item.Id; url = 'movies.html?topParentId=' + item.Id;
if (options && 'latest' === options.section) { if (options && options.section === 'latest') {
url += '&tab=1'; url += '&tab=1';
} }
return url; return url;
} }
if ('tvshows' == item.CollectionType) { if (item.CollectionType == 'tvshows') {
url = 'tv.html?topParentId=' + item.Id; url = 'tv.html?topParentId=' + item.Id;
if (options && 'latest' === options.section) { if (options && options.section === 'latest') {
url += '&tab=2'; url += '&tab=2';
} }
return url; return url;
} }
if ('music' == item.CollectionType) { if (item.CollectionType == 'music') {
return 'music.html?topParentId=' + item.Id; return 'music.html?topParentId=' + item.Id;
} }
} }
@ -1102,7 +1102,7 @@ function initClient() {
var contextSuffix = context ? '&context=' + context : ''; var contextSuffix = context ? '&context=' + context : '';
if ('Series' == itemType || 'Season' == itemType || 'Episode' == itemType) { if (itemType == 'Series' || itemType == 'Season' || itemType == 'Episode') {
return 'details?id=' + id + contextSuffix + '&serverId=' + serverId; return 'details?id=' + id + contextSuffix + '&serverId=' + serverId;
} }

View File

@ -13,7 +13,7 @@ pageClassOn('viewbeforeshow', 'page', function () {
var theme; var theme;
var context; var context;
if ('a' === viewType) { if (viewType === 'a') {
theme = userSettings.dashboardTheme(); theme = userSettings.dashboardTheme();
context = 'serverdashboard'; context = 'serverdashboard';
} else { } else {