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

Merge pull request #3603 from ryan-hartzell/eslint-no-nested-ternary

add eslint no-nested-ternary rule and fix violations
This commit is contained in:
Bill Thornton 2022-05-17 11:44:32 -04:00 committed by GitHub
commit babc425fdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 89 additions and 32 deletions

View file

@ -121,10 +121,14 @@ import '../elements/emby-itemscontainer/emby-itemscontainer';
}
if (!isSingleSection) {
options.Limit = screenWidth >= 1920 ? 10 : screenWidth >= 1440 ? 8 : 6;
options.Limit = 6;
if (enableScrollX()) {
options.Limit = 20;
} else if (screenWidth >= 1920) {
options.Limit = 10;
} else if (screenWidth >= 1440) {
options.Limit = 8;
}
}

View file

@ -1,6 +1,5 @@
import escapeHtml from 'escape-html';
import cardBuilder from '../cardbuilder/cardBuilder';
import dom from '../../scripts/dom';
import layoutManager from '../layoutManager';
import imageLoader from '../images/imageLoader';
import globalize from '../../scripts/globalize';
@ -401,15 +400,8 @@ import ServerConnections from '../ServerConnections';
function getItemsToResumeFn(mediaType, serverId) {
return function () {
const apiClient = ServerConnections.getApiClient(serverId);
const screenWidth = dom.getWindowSize().innerWidth;
let limit;
if (enableScrollX()) {
limit = 12;
} else {
limit = screenWidth >= 1920 ? 8 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6));
limit = Math.min(limit, 5);
}
const limit = enableScrollX() ? 12 : 5;
const options = {
Limit: limit,

View file

@ -520,7 +520,14 @@ import toast from './toast/toast';
}
function play(item, resume, queue, queueNext) {
const method = queue ? (queueNext ? 'queueNext' : 'queue') : 'play';
let method = 'play';
if (queue) {
if (queueNext) {
method = 'queueNext';
} else {
method = 'queue';
}
}
let startPosition = 0;
if (resume && item.UserData && item.UserData.PlaybackPositionTicks) {

View file

@ -550,7 +550,9 @@ import template from './libraryoptionseditor.template.html';
function getOrderedPlugins(plugins, configuredOrder) {
plugins = plugins.slice(0);
plugins.sort((a, b) => {
return a = configuredOrder.indexOf(a.Name), b = configuredOrder.indexOf(b.Name), a < b ? -1 : a > b ? 1 : 0;
a = configuredOrder.indexOf(a.Name);
b = configuredOrder.indexOf(b.Name);
return a - b;
});
return plugins;
}

View file

@ -1827,12 +1827,18 @@ class PlaybackManager {
Limit: UNLIMITED_ITEMS
}, queryOptions));
} else if (firstItem.IsFolder) {
let sortBy = null;
if (options.shuffle) {
sortBy = 'Random';
} else if (firstItem.Type !== 'BoxSet') {
sortBy = 'SortName';
}
promise = getItemsForPlayback(serverId, mergePlaybackQueries({
ParentId: firstItem.Id,
Filters: 'IsNotFolder',
Recursive: true,
// These are pre-sorted
SortBy: options.shuffle ? 'Random' : (['BoxSet'].indexOf(firstItem.Type) === -1 ? 'SortName' : null),
SortBy: sortBy,
MediaTypes: 'Audio,Video'
}, queryOptions));
} else if (firstItem.Type === 'Episode' && items.length === 1 && getPlayer(firstItem, options).supportsProgress !== false) {

View file

@ -61,7 +61,12 @@ import layoutManager from './layoutManager';
* @return {number} Clamped value.
*/
function clamp(value, min, max) {
return value <= min ? min : value >= max ? max : value;
if (value <= min) {
return min;
} else if (value >= max) {
return max;
}
return value;
}
/**

View file

@ -173,12 +173,18 @@ export function translateItemsForPlayback(apiClient, items, options) {
MediaTypes: 'Audio'
});
} else if (firstItem.IsFolder) {
let sortBy = null;
if (options.shuffle) {
sortBy = 'Random';
} else if (firstItem.Type === 'BoxSet') {
sortBy = 'SortName';
}
promise = getItemsForPlayback(apiClient, mergePlaybackQueries({
ParentId: firstItem.Id,
Filters: 'IsNotFolder',
Recursive: true,
// These are pre-sorted.
SortBy: options.shuffle ? 'Random' : (['BoxSet'].indexOf(firstItem.Type) === -1 ? 'SortName' : null),
SortBy: sortBy,
MediaTypes: 'Audio,Video'
}, queryOptions));
} else if (firstItem.Type === 'Episode' && items.length === 1) {