mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Apply ESLint autofix for no-yoda rule
This commit is contained in:
parent
642e2624e5
commit
22a46ecea6
49 changed files with 440 additions and 440 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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>';
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ pageClassOn('viewbeforeshow', 'page', function () {
|
|||
var theme;
|
||||
var context;
|
||||
|
||||
if ('a' === viewType) {
|
||||
if (viewType === 'a') {
|
||||
theme = userSettings.dashboardTheme();
|
||||
context = 'serverdashboard';
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue