mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix sonarjs prefer-single-boolean-return
This commit is contained in:
parent
bb86ab7f27
commit
b426b6e2bf
18 changed files with 52 additions and 187 deletions
|
@ -19,25 +19,14 @@ function isTv() {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (isWeb0s()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return isWeb0s();
|
||||
}
|
||||
|
||||
function isWeb0s() {
|
||||
const userAgent = navigator.userAgent.toLowerCase();
|
||||
|
||||
if (userAgent.indexOf('netcast') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('web0s') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return userAgent.indexOf('netcast') !== -1
|
||||
|| userAgent.indexOf('web0s') !== -1;
|
||||
}
|
||||
|
||||
function isMobile(userAgent) {
|
||||
|
@ -84,11 +73,7 @@ function hasKeyboard(browser) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (browser.tv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !!browser.tv;
|
||||
}
|
||||
|
||||
function iOSversion() {
|
||||
|
|
|
@ -53,12 +53,8 @@ import browser from './browser';
|
|||
}
|
||||
|
||||
const media = document.createElement('video');
|
||||
if (media.canPlayType('application/x-mpegURL').replace(/no/, '') ||
|
||||
media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, '')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !!(media.canPlayType('application/x-mpegURL').replace(/no/, '') ||
|
||||
media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, ''));
|
||||
}
|
||||
|
||||
function canPlayHlsWithMSE() {
|
||||
|
@ -159,11 +155,7 @@ import browser from './browser';
|
|||
return true;
|
||||
}
|
||||
|
||||
if (browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !!browser.edgeUwp;
|
||||
}
|
||||
|
||||
function testCanPlayAv1(videoTestElement) {
|
||||
|
|
|
@ -168,12 +168,7 @@ function throttle(key) {
|
|||
const time = times[key] || 0;
|
||||
const now = new Date().getTime();
|
||||
|
||||
if ((now - time) >= 200) {
|
||||
//times[key] = now;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return (now - time) >= 200;
|
||||
}
|
||||
|
||||
function resetThrottle(key) {
|
||||
|
@ -187,11 +182,7 @@ function allowInput() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (appHost.getWindowState() === 'Minimized') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return appHost.getWindowState() !== 'Minimized';
|
||||
}
|
||||
|
||||
function raiseEvent(name, key, keyCode) {
|
||||
|
|
|
@ -105,11 +105,7 @@ import dom from '../scripts/dom';
|
|||
return false;
|
||||
}
|
||||
|
||||
if (browser.tv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !!browser.tv;
|
||||
}
|
||||
|
||||
function onMouseInterval() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue