Fix sonarjs no-duplicated-branches
This commit is contained in:
parent
ad5c1ab018
commit
554cd1210c
8 changed files with 21 additions and 54 deletions
|
@ -76,7 +76,6 @@ module.exports = {
|
||||||
'sonarjs/cognitive-complexity': ['warn'],
|
'sonarjs/cognitive-complexity': ['warn'],
|
||||||
// TODO: Enable the following rules and fix issues
|
// TODO: Enable the following rules and fix issues
|
||||||
'sonarjs/no-duplicate-string': ['off'],
|
'sonarjs/no-duplicate-string': ['off'],
|
||||||
'sonarjs/no-duplicated-branches': ['off'],
|
|
||||||
'sonarjs/no-identical-functions': ['off'],
|
'sonarjs/no-identical-functions': ['off'],
|
||||||
'sonarjs/no-redundant-jump': ['off'],
|
'sonarjs/no-redundant-jump': ['off'],
|
||||||
'sonarjs/no-small-switch': ['off'],
|
'sonarjs/no-small-switch': ['off'],
|
||||||
|
|
|
@ -513,6 +513,7 @@ import { appRouter } from '../appRouter';
|
||||||
let imgType = null;
|
let imgType = null;
|
||||||
let itemId = null;
|
let itemId = null;
|
||||||
|
|
||||||
|
/* eslint-disable sonarjs/no-duplicated-branches */
|
||||||
if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
|
if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
|
||||||
imgType = 'Thumb';
|
imgType = 'Thumb';
|
||||||
imgTag = item.ImageTags.Thumb;
|
imgTag = item.ImageTags.Thumb;
|
||||||
|
@ -609,6 +610,7 @@ import { appRouter } from '../appRouter';
|
||||||
imgTag = item.ParentBackdropImageTags[0];
|
imgTag = item.ParentBackdropImageTags[0];
|
||||||
itemId = item.ParentBackdropItemId;
|
itemId = item.ParentBackdropItemId;
|
||||||
}
|
}
|
||||||
|
/* eslint-enable sonarjs/no-duplicated-branches */
|
||||||
|
|
||||||
if (!itemId) {
|
if (!itemId) {
|
||||||
itemId = item.Id;
|
itemId = item.Id;
|
||||||
|
|
|
@ -4,13 +4,12 @@ import { Events } from 'jellyfin-apiclient';
|
||||||
|
|
||||||
function onUserDataChanged() {
|
function onUserDataChanged() {
|
||||||
const instance = this;
|
const instance = this;
|
||||||
|
|
||||||
const eventsToMonitor = getEventsToMonitor(instance);
|
const eventsToMonitor = getEventsToMonitor(instance);
|
||||||
|
|
||||||
// TODO: Check user data change reason?
|
// TODO: Check user data change reason?
|
||||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
if (eventsToMonitor.indexOf('markfavorite') !== -1
|
||||||
instance.notifyRefreshNeeded();
|
|| eventsToMonitor.indexOf('markplayed') !== -1
|
||||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
) {
|
||||||
instance.notifyRefreshNeeded();
|
instance.notifyRefreshNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,31 +61,20 @@ function fetchData(instance) {
|
||||||
|
|
||||||
function onTimerChangedExternally(e, apiClient, data) {
|
function onTimerChangedExternally(e, apiClient, data) {
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
let refresh = false;
|
|
||||||
|
|
||||||
if (data.Id && this.TimerId === data.Id) {
|
if ((data.Id && this.TimerId === data.Id)
|
||||||
refresh = true;
|
|| (data.ProgramId && options && options.programId === data.ProgramId)
|
||||||
} else if (data.ProgramId && options && options.programId === data.ProgramId) {
|
) {
|
||||||
refresh = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refresh) {
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSeriesTimerChangedExternally(e, apiClient, data) {
|
function onSeriesTimerChangedExternally(e, apiClient, data) {
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
let refresh = false;
|
|
||||||
|
|
||||||
if (data.Id && this.SeriesTimerId === data.Id) {
|
if ((data.Id && this.SeriesTimerId === data.Id)
|
||||||
refresh = true;
|
|| (data.ProgramId && options && options.programId === data.ProgramId)
|
||||||
}
|
) {
|
||||||
if (data.ProgramId && options && options.programId === data.ProgramId) {
|
|
||||||
refresh = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refresh) {
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,9 +153,9 @@ import Sortable from 'sortablejs';
|
||||||
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
|
|
||||||
// TODO: Check user data change reason?
|
// TODO: Check user data change reason?
|
||||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
if (eventsToMonitor.indexOf('markfavorite') !== -1
|
||||||
itemsContainer.notifyRefreshNeeded();
|
|| eventsToMonitor.indexOf('markplayed') !== -1
|
||||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,18 +63,6 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
}
|
}
|
||||||
|
|
||||||
button.classList.add('ratingbutton-withrating');
|
button.classList.add('ratingbutton-withrating');
|
||||||
} else if (likes) {
|
|
||||||
if (icon) {
|
|
||||||
icon.classList.add('favorite');
|
|
||||||
icon.classList.remove('ratingbutton-icon-withrating');
|
|
||||||
}
|
|
||||||
button.classList.remove('ratingbutton-withrating');
|
|
||||||
} else if (likes === false) {
|
|
||||||
if (icon) {
|
|
||||||
icon.classList.add('favorite');
|
|
||||||
icon.classList.remove('ratingbutton-icon-withrating');
|
|
||||||
}
|
|
||||||
button.classList.remove('ratingbutton-withrating');
|
|
||||||
} else {
|
} else {
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.classList.add('favorite');
|
icon.classList.add('favorite');
|
||||||
|
|
|
@ -1490,15 +1490,14 @@ function tryRemoveElement(elem) {
|
||||||
if (
|
if (
|
||||||
// Check non-standard Safari PiP support
|
// Check non-standard Safari PiP support
|
||||||
typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode('picture-in-picture') && typeof video.webkitSetPresentationMode === 'function'
|
typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode('picture-in-picture') && typeof video.webkitSetPresentationMode === 'function'
|
||||||
|
// Check non-standard Windows PiP support
|
||||||
|
|| (window.Windows
|
||||||
|
&& Windows.UI.ViewManagement.ApplicationView.getForCurrentView()
|
||||||
|
.isViewModeSupported(Windows.UI.ViewManagement.ApplicationViewMode.compactOverlay))
|
||||||
// Check standard PiP support
|
// Check standard PiP support
|
||||||
|| document.pictureInPictureEnabled
|
|| document.pictureInPictureEnabled
|
||||||
) {
|
) {
|
||||||
list.push('PictureInPicture');
|
list.push('PictureInPicture');
|
||||||
} else if (window.Windows
|
|
||||||
&& Windows.UI.ViewManagement.ApplicationView.getForCurrentView()
|
|
||||||
.isViewModeSupported(Windows.UI.ViewManagement.ApplicationViewMode.compactOverlay)
|
|
||||||
) {
|
|
||||||
list.push('PictureInPicture');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.safari || browser.iOS || browser.iPad) {
|
if (browser.safari || browser.iOS || browser.iPad) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ import browser from './browser';
|
||||||
function canPlayAudioFormat(format) {
|
function canPlayAudioFormat(format) {
|
||||||
let typeString;
|
let typeString;
|
||||||
|
|
||||||
if (format === 'flac') {
|
if (format === 'flac' || format === 'asf') {
|
||||||
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -118,10 +118,6 @@ import browser from './browser';
|
||||||
if (browser.tizen || browser.edgeUwp) {
|
if (browser.tizen || browser.edgeUwp) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (format === 'asf') {
|
|
||||||
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (format === 'opus') {
|
} else if (format === 'opus') {
|
||||||
if (browser.web0s) {
|
if (browser.web0s) {
|
||||||
// canPlayType lies about OPUS support
|
// canPlayType lies about OPUS support
|
||||||
|
@ -171,9 +167,7 @@ import browser from './browser';
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanPlayAv1(videoTestElement) {
|
function testCanPlayAv1(videoTestElement) {
|
||||||
if (browser.tizenVersion >= 5.5) {
|
if (browser.tizenVersion >= 5.5 || browser.web0sVersion >= 5) {
|
||||||
return true;
|
|
||||||
} else if (browser.web0sVersion >= 5) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +193,7 @@ import browser from './browser';
|
||||||
|
|
||||||
switch (container) {
|
switch (container) {
|
||||||
case 'asf':
|
case 'asf':
|
||||||
|
case 'wmv':
|
||||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||||
videoAudioCodecs = [];
|
videoAudioCodecs = [];
|
||||||
break;
|
break;
|
||||||
|
@ -241,10 +236,6 @@ import browser from './browser';
|
||||||
videoCodecs.push('mpeg2video');
|
videoCodecs.push('mpeg2video');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'wmv':
|
|
||||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
|
||||||
videoAudioCodecs = [];
|
|
||||||
break;
|
|
||||||
case 'ts':
|
case 'ts':
|
||||||
supported = testCanPlayTs();
|
supported = testCanPlayTs();
|
||||||
videoCodecs.push('h264');
|
videoCodecs.push('h264');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue