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

View File

@ -47,7 +47,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
} else {
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);
}
@ -370,7 +370,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
return window.NativeShell.AppHost.supports(command);
}
return -1 !== supportedFeatures.indexOf(command.toLowerCase());
return supportedFeatures.indexOf(command.toLowerCase()) !== -1;
},
preferVisualCards: browser.android || browser.chrome,
getSyncProfile: getSyncProfile,

View File

@ -120,7 +120,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
var promise;
if ('MusicArtist' === section.types) {
if (section.types === 'MusicArtist') {
promise = ApiClient.getArtists(userId, options);
} else {
options.IncludeItemTypes = section.types;
@ -160,7 +160,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
preferThumb: section.preferThumb,
shape: section.shape,
centerText: section.centerText && !cardLayout,
overlayText: false !== section.overlayText,
overlayText: section.overlayText !== false,
showTitle: section.showTitle,
showParentTitle: section.showParentTitle,
scalable: true,
@ -192,7 +192,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
if (types) {
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++) {
var section = sections[i];
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 () {

View File

@ -21,7 +21,7 @@ import connectionManager from 'connectionManager';
if (!actionableParent || actionableParent.classList.contains('cardContent')) {
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]);
}

View File

@ -16,7 +16,7 @@ import 'emby-input';
return {
Type: type,
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 += '<h3 class="checkboxListLabel" style="margin:0;">' + globalize.translate('HeaderTypeImageFetchers', availableTypeOptions.Type) + '</h3>';
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 += '</div>';
@ -362,7 +362,7 @@ import 'emby-input';
TypeOptions: []
};
currentAvailableOptions = null;
const isNewLibrary = null === libraryOptions;
const isNewLibrary = libraryOptions === null;
isNewLibrary && parent.classList.add('newlibrary');
const response = await fetch('components/libraryoptionseditor/libraryoptionseditor.template.html');
const template = await response.text();
@ -578,7 +578,7 @@ import 'emby-input';
parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;
parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch;
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 => {
elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang'));

View File

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

View File

@ -48,7 +48,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
menuItems.unshift({
id: -1,
name: globalize.translate('ButtonOff'),
selected: null == currentIndex
selected: currentIndex == null
});
require(['actionsheet'], function (actionsheet) {
@ -69,18 +69,18 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
}
function seriesImageUrl(item, options) {
if ('Episode' !== item.Type) {
if (item.Type !== 'Episode') {
return null;
}
options = options || {};
options.type = options.type || 'Primary';
if ('Primary' === options.type && item.SeriesPrimaryImageTag) {
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
}
if ('Thumb' === options.type) {
if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
@ -210,7 +210,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
backdrop.setBackdrops([item]);
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
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('.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');
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;
}
}
@ -278,7 +278,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
currentPlayerSupportedCommands = supportedCommands;
var playState = state.PlayState || {};
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);
updateSubtitleTracksDisplay(player, context);
@ -306,15 +306,15 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
context.querySelector('.remoteControlSection').classList.add('hide');
}
buttonVisible(context.querySelector('.btnStop'), null != item);
buttonVisible(context.querySelector('.btnNextTrack'), null != item);
buttonVisible(context.querySelector('.btnPreviousTrack'), null != item);
buttonVisible(context.querySelector('.btnStop'), item != null);
buttonVisible(context.querySelector('.btnNextTrack'), item != null);
buttonVisible(context.querySelector('.btnPreviousTrack'), item != null);
if (layoutManager.mobile) {
buttonVisible(context.querySelector('.btnRewind'), false);
buttonVisible(context.querySelector('.btnFastForward'), false);
} else {
buttonVisible(context.querySelector('.btnRewind'), null != item);
buttonVisible(context.querySelector('.btnFastForward'), null != item);
buttonVisible(context.querySelector('.btnRewind'), item != null);
buttonVisible(context.querySelector('.btnFastForward'), item != null);
}
var positionSlider = context.querySelector('.nowPlayingPositionSlider');
@ -325,15 +325,15 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
if (positionSlider && !positionSlider.dragging) {
positionSlider.disabled = !playState.CanSeek;
var isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks;
var isProgressClear = state.MediaSource && state.MediaSource.RunTimeTicks == null;
positionSlider.setIsClear(isProgressClear);
}
updatePlayPauseState(playState.IsPaused, null != item);
updatePlayPauseState(playState.IsPaused, item != null);
updateTimeDisplay(playState.PositionTicks, item ? item.RunTimeTicks : null);
updatePlayerVolumeState(context, playState.IsMuted, playState.VolumeLevel);
if (item && 'Video' == item.MediaType) {
if (item && item.MediaType == 'Video') {
context.classList.remove('hideVideoButtons');
} else {
context.classList.add('hideVideoButtons');
@ -346,12 +346,12 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
function updateAudioTracksDisplay(player, context) {
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) {
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) {
@ -383,11 +383,11 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
var view = context;
var supportedCommands = currentPlayerSupportedCommands;
if (-1 === supportedCommands.indexOf('Mute')) {
if (supportedCommands.indexOf('Mute') === -1) {
showMuteButton = false;
}
if (-1 === supportedCommands.indexOf('SetVolume')) {
if (supportedCommands.indexOf('SetVolume') === -1) {
showVolumeSlider = false;
}
@ -452,8 +452,8 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
}
}
context.querySelector('.positionTime').innerHTML = null == positionTicks ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
context.querySelector('.runtime').innerHTML = null != runtimeTicks ? datetime.getDisplayRunningTime(runtimeTicks) : '--:--';
context.querySelector('.positionTime').innerHTML = positionTicks == null ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
context.querySelector('.runtime').innerHTML = runtimeTicks != null ? datetime.getDisplayRunningTime(runtimeTicks) : '--:--';
}
function getPlaylistItems(player) {

View File

@ -42,7 +42,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'listViewStyle', 'emb
for (var region in result) {
var countries = result[region];
if (countries.length && 'ZZZ' !== region) {
if (countries.length && region !== 'ZZZ') {
for (i = 0, length = countries.length; i < length; i++) {
countryList.push({
name: countries[i].fullName,
@ -237,7 +237,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'listViewStyle', 'emb
var device = devices[i];
html += '<div class="listItem">';
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' : '';
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">';

View File

@ -84,7 +84,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-input', 'listVi
}).then(function (result) {
loading.hide();
if (false !== options.showConfirmation) {
if (options.showConfirmation !== false) {
Dashboard.processServerConfigurationUpdateResult();
}
@ -118,7 +118,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-input', 'listVi
var device = devices[i];
html += '<div class="listItem">';
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' : '';
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">';

View File

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

View File

@ -313,7 +313,7 @@ import 'emby-itemscontainer';
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>';
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 += '</div>';
@ -346,7 +346,7 @@ import 'emby-itemscontainer';
function renderRunningTasks(view, tasks) {
let html = '';
tasks = tasks.filter(function (task) {
if ('Idle' != task.State) {
if (task.State != 'Idle') {
return !task.IsHidden;
}
@ -551,7 +551,7 @@ import 'emby-itemscontainer';
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');
} else {
row.querySelector('.btnSessionSendMessage').classList.add('hide');

View File

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

View File

@ -18,13 +18,13 @@ import 'emby-button';
function renderUserProfiles(page, profiles) {
renderProfiles(page, page.querySelector('.customProfiles'), profiles.filter(function (p) {
return 'User' == p.Type;
return p.Type == 'User';
}));
}
function renderSystemProfiles(page, profiles) {
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 += '</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>';
}

View File

@ -8,7 +8,7 @@ import libraryMenu from 'libraryMenu';
function loadPage(page, config, systemInfo) {
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('#chkDecodingColorDepth10Vp9').checked = config.EnableDecodingColorDepth10Vp9;
@ -107,7 +107,7 @@ import libraryMenu from 'libraryMenu';
value = value || '';
let any;
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');
} else {
dom.parentWithTag(c, 'LABEL').classList.remove('hide');
@ -138,7 +138,7 @@ import libraryMenu from 'libraryMenu';
$(document).on('pageinit', '#encodingSettingsPage', function () {
const page = this;
page.querySelector('#selectVideoDecoder').addEventListener('change', function () {
if ('vaapi' == this.value) {
if (this.value == 'vaapi') {
page.querySelector('.fldVaapiDevice').classList.remove('hide');
page.querySelector('#txtVaapiDevice').setAttribute('required', 'required');
} else {

View File

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

View File

@ -156,7 +156,7 @@ import 'emby-itemrefreshindicator';
}
function shouldRefreshLibraryAfterChanges(page) {
return 'mediaLibraryPage' === page.id;
return page.id === 'mediaLibraryPage';
}
function reloadVirtualFolders(page, virtualFolders) {
@ -286,7 +286,7 @@ import 'emby-itemrefreshindicator';
if (hasCardImageContainer) {
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>';
}

View File

@ -30,7 +30,7 @@ import 'emby-select';
}).filter(function (s) {
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.PublicHttpsPort = form.querySelector('#txtPublicHttpsPort').value;
config.HttpServerPortNumber = form.querySelector('#txtPortNumber').value;
@ -110,7 +110,7 @@ import 'emby-select';
page.querySelector('#txtLanNetworks').value = (config.LocalNetworkSubnets || []).join(', ');
page.querySelector('#txtExternalAddressFilter').value = (config.RemoteIPFilter || []).join(', ');
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('#chkEnableHttps').checked = config.EnableHttps;
page.querySelector('#chkRequireHttps').checked = config.RequireHttps;

View File

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

View File

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

View File

@ -84,16 +84,16 @@ import 'emby-select';
},
// TODO: Replace this mess with date-fns and remove datetime completely
getTriggerFriendlyName: function (trigger) {
if ('DailyTrigger' == trigger.Type) {
if (trigger.Type == 'DailyTrigger') {
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
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');
}

View File

@ -14,13 +14,13 @@ import globalize from 'globalize';
let html = '';
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"' : '';
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) {
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"' : '';
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);
$('#chkEnableVideoPlaybackRemuxing', page).prop('checked', user.Policy.EnablePlaybackRemuxing);
$('#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);
$('#chkEnableConversion', page).prop('checked', user.Policy.EnableMediaConversion || false);
$('#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++) {
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"' : '';
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++) {
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"' : '';
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++) {
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>';
}

View File

@ -67,7 +67,7 @@ import 'paper-icon-button-light';
for (let i = 0, length = items.length; i < length; 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>';
}
@ -201,7 +201,7 @@ import 'paper-icon-button-light';
}).then(function (updatedSchedule) {
const schedules = getSchedulesFromPage(page);
if (-1 == index) {
if (index == -1) {
index = schedules.length;
}
@ -234,7 +234,7 @@ import 'paper-icon-button-light';
}).then(function (value) {
const tags = getBlockedTagsFromPage(page);
if (-1 == tags.indexOf(value)) {
if (tags.indexOf(value) == -1) {
tags.push(value);
loadBlockedTags(page, tags);
}

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ define(['tabbedView', 'globalize', 'require', 'emby-tabs', 'emby-button', 'emby-
}
function getTabController(index) {
if (null == index) {
if (index == 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) {
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');
}
@ -108,7 +108,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
function renderSeriesTimerEditor(page, item, apiClient, user) {
if ('SeriesTimer' !== item.Type) {
if (item.Type !== 'SeriesTimer') {
return void hideAll(page, 'btnCancelSeriesTimer');
}
@ -131,7 +131,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function renderTrackSelections(page, instance, item, forceReload) {
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');
select.innerHTML = '';
page.querySelector('.selectVideo').innerHTML = '';
@ -210,7 +210,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
return m.Id === mediaSourceId;
})[0];
var tracks = mediaSource.MediaStreams.filter(function (m) {
return 'Audio' === m.Type;
return m.Type === 'Audio';
});
var select = page.querySelector('.selectAudio');
select.setLabel(globalize.translate('LabelAudio'));
@ -239,19 +239,19 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
return m.Id === mediaSourceId;
})[0];
var tracks = mediaSource.MediaStreams.filter(function (m) {
return 'Subtitle' === m.Type;
return m.Type === 'Subtitle';
});
var select = page.querySelector('.selectSubtitles');
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) {
return 'Video' === m.Type;
return m.Type === 'Video';
});
// This only makes sense on Video items
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) {
selected = v.Index === selectedId ? ' selected' : '';
return '<option value="' + v.Index + '" ' + selected + '>' + v.DisplayTitle + '</option>';
@ -273,7 +273,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function reloadPlayButtons(page, item) {
var canPlay = false;
if ('Program' == item.Type) {
if (item.Type == 'Program') {
var now = new Date();
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');
} else if (playbackManager.canPlay(item)) {
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);
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);
canPlay = true;
@ -373,10 +373,10 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
if (item.AlbumArtists) {
parentNameHtml.push(getArtistLinksHtml(item.AlbumArtists, item.ServerId, context));
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));
parentNameLast = true;
} else if (item.SeriesName && 'Episode' === item.Type) {
} else if (item.SeriesName && item.Type === 'Episode') {
parentRoute = appRouter.getRouteUrl({
Id: item.SeriesId,
Name: item.SeriesName,
@ -391,7 +391,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
parentNameHtml.push(item.Name);
}
if (item.SeriesName && 'Season' === item.Type) {
if (item.SeriesName && item.Type === 'Season') {
parentRoute = appRouter.getRouteUrl({
Id: item.SeriesId,
Name: item.SeriesName,
@ -402,7 +402,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
context: context
});
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({
Id: item.SeasonId,
Name: item.SeasonName,
@ -413,9 +413,9 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
context: context
});
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);
} 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({
Id: item.AlbumId,
Name: item.Album,
@ -478,7 +478,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
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);
} else {
hideAll(page, 'btnPlayTrailer');
@ -557,7 +557,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
setInitialCollapsibleState(page, item, apiClient, params.context, user);
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);
} else {
hideAll(page, 'btnPlayTrailer');
@ -565,7 +565,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
setTrailerButtonVisibility(page, item);
if ('Program' !== item.Type || canPlay) {
if (item.Type !== 'Program' || canPlay) {
hideAll(page, 'mainDetailButtons', true);
} else {
hideAll(page, 'mainDetailButtons');
@ -573,7 +573,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
showRecordingFields(instance, page, item, user);
var groupedVersions = (item.MediaSources || []).filter(function (g) {
return 'Grouping' == g.Type;
return g.Type == 'Grouping';
});
if (user.Policy.IsAdministrator && groupedVersions.length) {
@ -590,7 +590,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var itemBirthday = page.querySelector('#itemBirthday');
if ('Person' == item.Type && item.PremiereDate) {
if (item.Type == 'Person' && item.PremiereDate) {
try {
var birthday = datetime.parseISO8601Date(item.PremiereDate, true).toDateString();
itemBirthday.classList.remove('hide');
@ -604,7 +604,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var itemDeathDate = page.querySelector('#itemDeathDate');
if ('Person' == item.Type && item.EndDate) {
if (item.Type == 'Person' && item.EndDate) {
try {
var deathday = datetime.parseISO8601Date(item.EndDate, true).toDateString();
itemDeathDate.classList.remove('hide');
@ -618,7 +618,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
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>';
itemBirthLocation.classList.remove('hide');
itemBirthLocation.innerHTML = globalize.translate('BirthPlaceValue', gmap);
@ -674,7 +674,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
if (!instance.currentRecordingFields) {
var recordingFieldsElement = page.querySelector('.recordingFields');
if ('Program' == item.Type && user.Policy.EnableLiveTvManagement) {
if (item.Type == 'Program' && user.Policy.EnableLiveTvManagement) {
require(['recordingFields'], function (recordingFields) {
instance.currentRecordingFields = new recordingFields({
parent: recordingFieldsElement,
@ -755,7 +755,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
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');
} else {
page.querySelector('#peopleHeader').innerHTML = globalize.translate('HeaderCastAndCrew');
@ -765,7 +765,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function renderNextUp(page, item, user) {
var section = page.querySelector('.nextUpSection');
if ('Series' != item.Type) {
if (item.Type != 'Series') {
return void section.classList.add('hide');
}
@ -783,7 +783,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
items: result.Items,
shape: 'overflowBackdrop',
showTitle: true,
displayAsSpecial: 'Season' == item.Type && item.IndexNumber,
displayAsSpecial: item.Type == 'Season' && item.IndexNumber,
overlayText: false,
centerText: true,
overlayPlayButton: true
@ -797,14 +797,14 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function setInitialCollapsibleState(page, item, apiClient, context, user) {
page.querySelector('.collectionItems').innerHTML = '';
if ('Playlist' == item.Type) {
if (item.Type == 'Playlist') {
page.querySelector('#childrenCollapsible').classList.remove('hide');
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');
renderItemsByName(page, item);
} else if (item.IsFolder) {
if ('BoxSet' == item.Type) {
if (item.Type == 'BoxSet') {
page.querySelector('#childrenCollapsible').classList.add('hide');
}
@ -813,7 +813,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
page.querySelector('#childrenCollapsible').classList.add('hide');
}
if ('Series' == item.Type) {
if (item.Type == 'Series') {
renderSeriesSchedule(page, item);
renderNextUp(page, item, user);
} else {
@ -822,7 +822,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
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');
renderSpecials(page, item, user);
} else {
@ -838,7 +838,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
page.querySelector('#additionalPartsCollapsible').classList.add('hide');
}
if ('MusicAlbum' == item.Type) {
if (item.Type == 'MusicAlbum') {
renderMusicVideos(page, item, user);
} else {
page.querySelector('#musicVideosCollapsible').classList.add('hide');
@ -986,7 +986,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
subtitles: false
});
if (miscInfo.innerHTML && 'SeriesTimer' !== item.Type) {
if (miscInfo.innerHTML && item.Type !== 'SeriesTimer') {
miscInfo.classList.remove('hide');
} else {
miscInfo.classList.add('hide');
@ -1000,7 +1000,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
interactive: true
});
if (miscInfo.innerHTML && 'SeriesTimer' !== item.Type) {
if (miscInfo.innerHTML && item.Type !== 'SeriesTimer') {
miscInfo.classList.remove('hide');
} else {
miscInfo.classList.add('hide');
@ -1041,7 +1041,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
function getPortraitShape(scrollX) {
if (null == scrollX) {
if (scrollX == null) {
scrollX = enableScrollX();
}
@ -1049,7 +1049,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
function getSquareShape(scrollX) {
if (null == scrollX) {
if (scrollX == null) {
scrollX = enableScrollX();
}
@ -1060,7 +1060,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var section = view.querySelector('.moreFromSeasonSection');
if (section) {
if ('Episode' !== item.Type || !item.SeasonId || !item.SeriesId) {
if (item.Type !== 'Episode' || !item.SeasonId || !item.SeriesId) {
return void section.classList.add('hide');
}
@ -1104,11 +1104,11 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var section = view.querySelector('.moreFromArtistSection');
if (section) {
if ('MusicArtist' === item.Type) {
if (item.Type === 'MusicArtist') {
if (!apiClient.isMinServerVersion('3.4.1.19')) {
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');
}
@ -1120,7 +1120,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
SortOrder: 'Descending'
};
if ('MusicArtist' === item.Type) {
if (item.Type === 'MusicArtist') {
query.ContributingArtistIds = item.Id;
} else if (apiClient.isMinServerVersion('3.4.1.18')) {
query.AlbumArtistIds = item.AlbumArtists[0].Id;
@ -1135,7 +1135,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
section.classList.remove('hide');
if ('MusicArtist' === item.Type) {
if (item.Type === 'MusicArtist') {
section.querySelector('h2').innerHTML = globalize.translate('HeaderAppearsOn');
} else {
section.querySelector('h2').innerHTML = globalize.translate('MoreFromValue', item.AlbumArtists[0].Name);
@ -1147,7 +1147,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
shape: 'autooverflow',
sectionTitleTagName: 'h2',
scalable: true,
coverImage: 'MusicArtist' === item.Type || 'MusicAlbum' === item.Type,
coverImage: item.Type === 'MusicArtist' || item.Type === 'MusicAlbum',
showTitle: true,
showParentTitle: false,
centerText: true,
@ -1163,7 +1163,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var similarCollapsible = page.querySelector('#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');
}
@ -1175,7 +1175,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
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;
}
@ -1189,16 +1189,16 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
html += cardBuilder.getCardsHtml({
items: result.Items,
shape: 'autooverflow',
showParentTitle: 'MusicAlbum' == item.Type,
showParentTitle: item.Type == 'MusicAlbum',
centerText: true,
showTitle: true,
context: context,
lazy: true,
showDetailsMenu: true,
coverImage: 'MusicAlbum' == item.Type || 'MusicArtist' == item.Type,
coverImage: item.Type == 'MusicAlbum' || item.Type == 'MusicArtist',
overlayPlayButton: true,
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');
similarContent.innerHTML = html;
@ -1209,13 +1209,13 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function renderSeriesAirTime(page, item, isStatic) {
var seriesAirTime = page.querySelector('#seriesAirTime');
if ('Series' != item.Type) {
if (item.Type != 'Series') {
seriesAirTime.classList.add('hide');
return;
}
var html = '';
if (item.AirDays && item.AirDays.length) {
if (7 == item.AirDays.length) {
if (item.AirDays.length == 7) {
html += 'daily';
} else {
html += item.AirDays.map(function (a) {
@ -1240,7 +1240,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
}
if (html) {
html = ('Ended' == item.Status ? 'Aired ' : 'Airs ') + html;
html = (item.Status == 'Ended' ? 'Aired ' : 'Airs ') + html;
seriesAirTime.innerHTML = html;
seriesAirTime.classList.remove('hide');
} else {
@ -1253,7 +1253,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var tagElements = [];
var tags = item.Tags || [];
if ('Program' === item.Type) {
if (item.Type === 'Program') {
tags = [];
}
@ -1277,7 +1277,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
Fields: fields
};
if ('BoxSet' !== item.Type) {
if (item.Type !== 'BoxSet') {
query.SortBy = 'SortName';
}
@ -1285,19 +1285,19 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var apiClient = connectionManager.getApiClient(item.ServerId);
var userId = apiClient.getCurrentUserId();
if ('Series' == item.Type) {
if (item.Type == 'Series') {
promise = apiClient.getSeasons(item.Id, {
userId: userId,
Fields: fields
});
} else if ('Season' == item.Type) {
} else if (item.Type == 'Season') {
fields += ',Overview';
promise = apiClient.getEpisodes(item.SeriesId, {
seasonId: item.Id,
userId: userId,
Fields: fields
});
} else if ('MusicArtist' == item.Type) {
} else if (item.Type == 'MusicArtist') {
query.SortBy = 'ProductionYear,SortName';
}
@ -1308,7 +1308,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
var isList = false;
var childrenItemsContainer = page.querySelector('.childrenItemsContainer');
if ('MusicAlbum' == item.Type) {
if (item.Type == 'MusicAlbum') {
html = listView.getListViewHtml({
items: result.Items,
smallIcon: true,
@ -1322,7 +1322,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
containerAlbumArtists: item.AlbumArtists
});
isList = true;
} else if ('Series' == item.Type) {
} else if (item.Type == 'Series') {
scrollX = enableScrollX();
html = cardBuilder.getCardsHtml({
items: result.Items,
@ -1333,21 +1333,21 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
overlayPlayButton: true,
allowBottomPadding: !scrollX
});
} else if ('Season' == item.Type || 'Episode' == item.Type) {
if ('Episode' !== item.Type) {
} else if (item.Type == 'Season' || item.Type == 'Episode') {
if (item.Type !== 'Episode') {
isList = true;
}
scrollX = 'Episode' == item.Type;
if (result.Items.length < 2 && 'Episode' === item.Type) {
scrollX = item.Type == 'Episode';
if (result.Items.length < 2 && item.Type === 'Episode') {
return;
}
if ('Episode' === item.Type) {
if (item.Type === 'Episode') {
html = cardBuilder.getCardsHtml({
items: result.Items,
shape: 'overflowBackdrop',
showTitle: true,
displayAsSpecial: 'Season' == item.Type && item.IndexNumber,
displayAsSpecial: item.Type == 'Season' && item.IndexNumber,
playFromHere: true,
overlayText: true,
lazy: true,
@ -1356,7 +1356,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
allowBottomPadding: !scrollX,
includeParentInfoInTitle: false
});
} else if ('Season' === item.Type) {
} else if (item.Type === 'Season') {
html = listView.getListViewHtml({
items: result.Items,
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');
}
if (scrollX) {
@ -1398,7 +1398,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
childrenItemsContainer.innerHTML = html;
imageLoader.lazyChildren(childrenItemsContainer);
if ('BoxSet' == item.Type) {
if (item.Type == 'BoxSet') {
var collectionItemTypes = [{
name: globalize.translate('HeaderVideos'),
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');
} else if ('Series' == item.Type) {
} else if (item.Type == 'Series') {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderSeasons');
} else if ('MusicAlbum' == item.Type) {
} else if (item.Type == 'MusicAlbum') {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderTracks');
} else {
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('#childrenCollapsible').classList.add('verticalSection-extrabottompadding');
} else {
@ -1503,7 +1503,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
function renderChannelGuide(page, apiClient, item) {
if ('TvChannel' === item.Type) {
if (item.Type === 'TvChannel') {
page.querySelector('.programGuideSection').classList.remove('hide');
apiClient.getLiveTvPrograms({
ChannelIds: item.Id,
@ -1555,19 +1555,19 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
}
function inferContext(item) {
if ('Movie' === item.Type || 'BoxSet' === item.Type) {
if (item.Type === 'Movie' || item.Type === 'BoxSet') {
return 'movies';
}
if ('Series' === item.Type || 'Season' === item.Type || 'Episode' === item.Type) {
if (item.Type === 'Series' || item.Type === 'Season' || item.Type === 'Episode') {
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';
}
if ('Program' === item.Type) {
if (item.Type === 'Program') {
return 'livetv';
}
@ -1659,12 +1659,12 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
html += '</h2>';
html += '</div>';
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({
items: items,
shape: shape,
showTitle: true,
showYear: 'Video' === type.mediaType || 'Series' === type.type,
showYear: type.mediaType === 'Video' || type.type === 'Series',
centerText: true,
lazy: true,
showDetailsMenu: true,
@ -1849,7 +1849,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function playCurrentItem(button, mode) {
var item = currentItem;
if ('Program' === item.Type) {
if (item.Type === 'Program') {
var apiClient = connectionManager.getApiClient(item.ServerId);
return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
playbackManager.play({
@ -1925,7 +1925,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
function onWebSocketMessage(e, 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 userData = msg.Data.UserDataList.filter(function (u) {
return u.Key == key;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1663,7 +1663,7 @@ function tryRemoveElement(elem) {
setAspectRatio(val) {
const mediaElement = this.#mediaElement;
if (mediaElement) {
if ('auto' === val) {
if (val === 'auto') {
mediaElement.style.removeProperty('object-fit');
} else {
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({
name: globalize.translate('HeaderUpcomingOnTV'),
type: 'Program'
@ -65,7 +65,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
var html = '';
var sectionClass = 'verticalSection';
if ('Audio' === section.type) {
if (section.type === 'Audio') {
sectionClass += ' verticalSection-extrabottompadding';
}
@ -272,7 +272,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
listOptions.items = result.Items;
var itemsContainer = element.querySelector('.itemsContainer');
if ('Audio' == type) {
if (type == 'Audio') {
html = listView.getListViewHtml(listOptions);
itemsContainer.classList.remove('vertical-wrap');
itemsContainer.classList.add('vertical-list');
@ -288,23 +288,23 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
}
function getMoreItemsHref(item, type) {
if ('Genre' == item.Type) {
if (item.Type == 'Genre') {
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;
}
if ('Studio' == item.Type) {
if (item.Type == 'Studio') {
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;
}
if ('Person' == item.Type) {
if (item.Type == 'Person') {
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);
if ('MusicArtist' === query.IncludeItemTypes) {
if (query.IncludeItemTypes === 'MusicArtist') {
query.IncludeItemTypes = null;
return apiClient.getAlbumArtists(apiClient.getCurrentUserId(), query);
}

View File

@ -178,9 +178,9 @@ export function showSortMenu (options) {
html += globalize.translate('HeaderSortOrder');
html += '</h2>';
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>';
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 += '</div>';
html += '</div>';

View File

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

View File

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

View File

@ -6,7 +6,7 @@ function getWindowLocationSearch(win) {
if (!search) {
var index = window.location.href.indexOf('?');
if (-1 != index) {
if (index != -1) {
search = window.location.href.substring(index);
}
}
@ -22,7 +22,7 @@ window.getParameterByName = function (name, url) {
var regex = new RegExp(regexS, 'i');
var results = regex.exec(url || getWindowLocationSearch());
if (null == results) {
if (results == null) {
return '';
}
@ -73,7 +73,7 @@ var Dashboard = {
var urlLower = window.location.href.toLowerCase();
var index = urlLower.lastIndexOf('/web');
if (-1 != index) {
if (index != -1) {
return urlLower.substring(0, index);
}
@ -178,7 +178,7 @@ var Dashboard = {
});
},
alert: function (options) {
if ('string' == typeof options) {
if (typeof options == 'string') {
return void require(['toast'], function (toast) {
toast({
text: options
@ -197,7 +197,7 @@ var Dashboard = {
var capabilities = {
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'],
SupportsPersistentIdentifier: 'cordova' === self.appMode || 'android' === self.appMode,
SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android',
SupportsMediaControl: true
};
appHost.getPushTokenInfo();
@ -452,8 +452,8 @@ function initClient() {
}
function onGlobalizeInit(browser, globalize) {
if ('android' === self.appMode) {
if (-1 !== self.location.href.toString().toLowerCase().indexOf('start=backgroundsync')) {
if (self.appMode === 'android') {
if (self.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) {
return onAppReady(browser);
}
}
@ -863,7 +863,7 @@ function initClient() {
});
define('appRouter', [componentsPath + '/appRouter', 'itemHelper'], function (appRouter, itemHelper) {
function showItem(item, serverId, options) {
if ('string' == typeof item) {
if (typeof item == 'string') {
require(['connectionManager'], function (connectionManager) {
var apiClient = connectionManager.currentApiClient();
apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) {
@ -871,7 +871,7 @@ function initClient() {
});
});
} else {
if (2 == arguments.length) {
if (arguments.length == 2) {
options = arguments[1];
}
@ -953,27 +953,27 @@ function initClient() {
var itemType = item.Type || (options ? options.itemType : null);
var serverId = item.ServerId || options.serverId;
if ('settings' === item) {
if (item === 'settings') {
return 'mypreferencesmenu.html';
}
if ('wizard' === item) {
if (item === 'wizard') {
return 'wizardstart.html';
}
if ('manageserver' === item) {
if (item === 'manageserver') {
return 'dashboard.html';
}
if ('recordedtv' === item) {
if (item === 'recordedtv') {
return 'livetv.html?tab=3&serverId=' + options.serverId;
}
if ('nextup' === item) {
if (item === 'nextup') {
return 'list.html?type=nextup&serverId=' + options.serverId;
}
if ('list' === item) {
if (item === 'list') {
var url = 'list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
if (options.isFavorite) {
@ -983,61 +983,61 @@ function initClient() {
return url;
}
if ('livetv' === item) {
if ('programs' === options.section) {
if (item === 'livetv') {
if (options.section === 'programs') {
return 'livetv.html?tab=0&serverId=' + options.serverId;
}
if ('guide' === options.section) {
if (options.section === 'guide') {
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;
}
if ('shows' === options.section) {
if (options.section === 'shows') {
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;
}
if ('kids' === options.section) {
if (options.section === 'kids') {
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;
}
if ('onnow' === options.section) {
if (options.section === 'onnow') {
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;
}
if ('seriesrecording' === options.section) {
if (options.section === 'seriesrecording') {
return 'livetv.html?tab=5&serverId=' + options.serverId;
}
return 'livetv.html?serverId=' + options.serverId;
}
if ('SeriesTimer' == itemType) {
if (itemType == 'SeriesTimer') {
return 'details?seriesTimerId=' + id + '&serverId=' + serverId;
}
if ('livetv' == item.CollectionType) {
if (item.CollectionType == 'livetv') {
return 'livetv.html';
}
if ('Genre' === item.Type) {
if (item.Type === 'Genre') {
url = 'list.html?genreId=' + item.Id + '&serverId=' + serverId;
if ('livetv' === context) {
if (context === 'livetv') {
url += '&type=Programs';
}
@ -1048,7 +1048,7 @@ function initClient() {
return url;
}
if ('MusicGenre' === item.Type) {
if (item.Type === 'MusicGenre') {
url = 'list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
if (options.parentId) {
@ -1058,7 +1058,7 @@ function initClient() {
return url;
}
if ('Studio' === item.Type) {
if (item.Type === 'Studio') {
url = 'list.html?studioId=' + item.Id + '&serverId=' + serverId;
if (options.parentId) {
@ -1068,28 +1068,28 @@ function initClient() {
return url;
}
if ('folders' !== context && !itemHelper.isLocalItem(item)) {
if ('movies' == item.CollectionType) {
if (context !== 'folders' && !itemHelper.isLocalItem(item)) {
if (item.CollectionType == 'movies') {
url = 'movies.html?topParentId=' + item.Id;
if (options && 'latest' === options.section) {
if (options && options.section === 'latest') {
url += '&tab=1';
}
return url;
}
if ('tvshows' == item.CollectionType) {
if (item.CollectionType == 'tvshows') {
url = 'tv.html?topParentId=' + item.Id;
if (options && 'latest' === options.section) {
if (options && options.section === 'latest') {
url += '&tab=2';
}
return url;
}
if ('music' == item.CollectionType) {
if (item.CollectionType == 'music') {
return 'music.html?topParentId=' + item.Id;
}
}
@ -1102,7 +1102,7 @@ function initClient() {
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;
}

View File

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