diff --git a/.eslintrc.js b/.eslintrc.js index 40b200f689..ec1cd17c41 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -76,7 +76,6 @@ module.exports = { 'sonarjs/cognitive-complexity': ['warn'], // TODO: Enable the following rules and fix issues 'sonarjs/no-duplicate-string': ['off'], - 'sonarjs/no-duplicated-branches': ['off'], 'sonarjs/no-identical-functions': ['off'], 'sonarjs/no-redundant-jump': ['off'], 'sonarjs/no-small-switch': ['off'], diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js index c22e6a2b3f..5bc6bf88ad 100644 --- a/src/components/cardbuilder/cardBuilder.js +++ b/src/components/cardbuilder/cardBuilder.js @@ -513,6 +513,7 @@ import { appRouter } from '../appRouter'; let imgType = null; let itemId = null; + /* eslint-disable sonarjs/no-duplicated-branches */ if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) { imgType = 'Thumb'; imgTag = item.ImageTags.Thumb; @@ -609,6 +610,7 @@ import { appRouter } from '../appRouter'; imgTag = item.ParentBackdropImageTags[0]; itemId = item.ParentBackdropItemId; } + /* eslint-enable sonarjs/no-duplicated-branches */ if (!itemId) { itemId = item.Id; diff --git a/src/components/itemsrefresher.js b/src/components/itemsrefresher.js index 2799a00b1a..a2c57dee1d 100644 --- a/src/components/itemsrefresher.js +++ b/src/components/itemsrefresher.js @@ -4,13 +4,12 @@ import { Events } from 'jellyfin-apiclient'; function onUserDataChanged() { const instance = this; - const eventsToMonitor = getEventsToMonitor(instance); // TODO: Check user data change reason? - if (eventsToMonitor.indexOf('markfavorite') !== -1) { - instance.notifyRefreshNeeded(); - } else if (eventsToMonitor.indexOf('markplayed') !== -1) { + if (eventsToMonitor.indexOf('markfavorite') !== -1 + || eventsToMonitor.indexOf('markplayed') !== -1 + ) { instance.notifyRefreshNeeded(); } } diff --git a/src/components/recordingcreator/recordingfields.js b/src/components/recordingcreator/recordingfields.js index ffc43b4bb4..64d58e9045 100644 --- a/src/components/recordingcreator/recordingfields.js +++ b/src/components/recordingcreator/recordingfields.js @@ -61,31 +61,20 @@ function fetchData(instance) { function onTimerChangedExternally(e, apiClient, data) { const options = this.options; - let refresh = false; - if (data.Id && this.TimerId === data.Id) { - refresh = true; - } else if (data.ProgramId && options && options.programId === data.ProgramId) { - refresh = true; - } - - if (refresh) { + if ((data.Id && this.TimerId === data.Id) + || (data.ProgramId && options && options.programId === data.ProgramId) + ) { this.refresh(); } } function onSeriesTimerChangedExternally(e, apiClient, data) { const options = this.options; - let refresh = false; - if (data.Id && this.SeriesTimerId === data.Id) { - refresh = true; - } - if (data.ProgramId && options && options.programId === data.ProgramId) { - refresh = true; - } - - if (refresh) { + if ((data.Id && this.SeriesTimerId === data.Id) + || (data.ProgramId && options && options.programId === data.ProgramId) + ) { this.refresh(); } } diff --git a/src/elements/emby-itemscontainer/emby-itemscontainer.js b/src/elements/emby-itemscontainer/emby-itemscontainer.js index 4752613ddd..da9592ca19 100644 --- a/src/elements/emby-itemscontainer/emby-itemscontainer.js +++ b/src/elements/emby-itemscontainer/emby-itemscontainer.js @@ -153,9 +153,9 @@ import Sortable from 'sortablejs'; const eventsToMonitor = getEventsToMonitor(itemsContainer); // TODO: Check user data change reason? - if (eventsToMonitor.indexOf('markfavorite') !== -1) { - itemsContainer.notifyRefreshNeeded(); - } else if (eventsToMonitor.indexOf('markplayed') !== -1) { + if (eventsToMonitor.indexOf('markfavorite') !== -1 + || eventsToMonitor.indexOf('markplayed') !== -1 + ) { itemsContainer.notifyRefreshNeeded(); } } diff --git a/src/elements/emby-ratingbutton/emby-ratingbutton.js b/src/elements/emby-ratingbutton/emby-ratingbutton.js index dea35f36f3..91233cef42 100644 --- a/src/elements/emby-ratingbutton/emby-ratingbutton.js +++ b/src/elements/emby-ratingbutton/emby-ratingbutton.js @@ -63,18 +63,6 @@ import ServerConnections from '../../components/ServerConnections'; } 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 { if (icon) { icon.classList.add('favorite'); diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index d7ae7f7841..40a2c1c06b 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1490,15 +1490,14 @@ function tryRemoveElement(elem) { if ( // Check non-standard Safari PiP support 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 || document.pictureInPictureEnabled ) { 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) { diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 9ac3c2b7eb..4ea95a09da 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -110,7 +110,7 @@ import browser from './browser'; function canPlayAudioFormat(format) { let typeString; - if (format === 'flac') { + if (format === 'flac' || format === 'asf') { if (browser.tizen || browser.web0s || browser.edgeUwp) { return true; } @@ -118,10 +118,6 @@ import browser from './browser'; if (browser.tizen || browser.edgeUwp) { return true; } - } else if (format === 'asf') { - if (browser.tizen || browser.web0s || browser.edgeUwp) { - return true; - } } else if (format === 'opus') { if (browser.web0s) { // canPlayType lies about OPUS support @@ -171,9 +167,7 @@ import browser from './browser'; } function testCanPlayAv1(videoTestElement) { - if (browser.tizenVersion >= 5.5) { - return true; - } else if (browser.web0sVersion >= 5) { + if (browser.tizenVersion >= 5.5 || browser.web0sVersion >= 5) { return true; } @@ -199,6 +193,7 @@ import browser from './browser'; switch (container) { case 'asf': + case 'wmv': supported = browser.tizen || browser.web0s || browser.edgeUwp; videoAudioCodecs = []; break; @@ -241,10 +236,6 @@ import browser from './browser'; videoCodecs.push('mpeg2video'); } break; - case 'wmv': - supported = browser.tizen || browser.web0s || browser.edgeUwp; - videoAudioCodecs = []; - break; case 'ts': supported = testCanPlayTs(); videoCodecs.push('h264');