mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
Use toBoolean from string utils
This commit is contained in:
parent
92d249354c
commit
9de11b443d
@ -9,6 +9,7 @@ import '../elements/emby-button/emby-button';
|
|||||||
import './listview/listview.scss';
|
import './listview/listview.scss';
|
||||||
import ServerConnections from './ServerConnections';
|
import ServerConnections from './ServerConnections';
|
||||||
import alert from './alert';
|
import alert from './alert';
|
||||||
|
import { toBoolean } from '../utils/string.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ import alert from './alert';
|
|||||||
|
|
||||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||||
const minDate = new Date();
|
const minDate = new Date();
|
||||||
const hasUserId = elem.getAttribute('data-useractivity') !== 'false';
|
const hasUserId = toBoolean(elem.getAttribute('data-useractivity'), true);
|
||||||
|
|
||||||
// TODO: Use date-fns
|
// TODO: Use date-fns
|
||||||
if (hasUserId) {
|
if (hasUserId) {
|
||||||
|
@ -3,7 +3,9 @@ import focusManager from '../focusManager';
|
|||||||
import browser from '../../scripts/browser';
|
import browser from '../../scripts/browser';
|
||||||
import layoutManager from '../layoutManager';
|
import layoutManager from '../layoutManager';
|
||||||
import inputManager from '../../scripts/inputManager';
|
import inputManager from '../../scripts/inputManager';
|
||||||
|
import { toBoolean } from '../../utils/string.ts';
|
||||||
import dom from '../../scripts/dom';
|
import dom from '../../scripts/dom';
|
||||||
|
|
||||||
import './dialoghelper.scss';
|
import './dialoghelper.scss';
|
||||||
import '../../assets/css/scrollstyles.scss';
|
import '../../assets/css/scrollstyles.scss';
|
||||||
|
|
||||||
@ -95,7 +97,7 @@ import '../../assets/css/scrollstyles.scss';
|
|||||||
focusManager.focus(activeElement);
|
focusManager.focus(activeElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlg.getAttribute('data-removeonclose') !== 'false') {
|
if (toBoolean(dlg.getAttribute('data-removeonclose'), true)) {
|
||||||
removeCenterFocus(dlg);
|
removeCenterFocus(dlg);
|
||||||
|
|
||||||
const dialogContainer = dlg.dialogContainer;
|
const dialogContainer = dlg.dialogContainer;
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import ActivityLog from '../../components/activitylog';
|
import ActivityLog from '../../components/activitylog';
|
||||||
import globalize from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
|
import { toBoolean } from '../../utils/string.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
export default function (view, params) {
|
export default function (view, params) {
|
||||||
let activityLog;
|
let activityLog;
|
||||||
|
|
||||||
if (params.useractivity !== 'false') {
|
if (toBoolean(params.useractivity, true)) {
|
||||||
view.querySelector('.activityItems').setAttribute('data-useractivity', 'true');
|
view.querySelector('.activityItems').setAttribute('data-useractivity', 'true');
|
||||||
view.querySelector('.sectionTitle').innerHTML = globalize.translate('HeaderActivity');
|
view.querySelector('.sectionTitle').innerHTML = globalize.translate('HeaderActivity');
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable indent */
|
|
||||||
import { AppStorage, Events } from 'jellyfin-apiclient';
|
import { AppStorage, Events } from 'jellyfin-apiclient';
|
||||||
|
import { toBoolean } from '../../utils/string.ts';
|
||||||
|
|
||||||
class AppSettings {
|
class AppSettings {
|
||||||
#getKey(name, userId) {
|
#getKey(name, userId) {
|
||||||
@ -15,7 +15,7 @@ class AppSettings {
|
|||||||
this.set('enableAutoLogin', val.toString());
|
this.set('enableAutoLogin', val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('enableAutoLogin') !== 'false';
|
return toBoolean(this.get('enableAutoLogin'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +28,7 @@ class AppSettings {
|
|||||||
return this.set('enableGamepad', val.toString());
|
return this.set('enableGamepad', val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('enableGamepad') === 'true';
|
return toBoolean(this.get('enableGamepad'), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableSystemExternalPlayers(val) {
|
enableSystemExternalPlayers(val) {
|
||||||
@ -36,7 +36,7 @@ class AppSettings {
|
|||||||
this.set('enableSystemExternalPlayers', val.toString());
|
this.set('enableSystemExternalPlayers', val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('enableSystemExternalPlayers') === 'true';
|
return toBoolean(this.get('enableSystemExternalPlayers'), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
|
enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
|
||||||
@ -52,7 +52,7 @@ class AppSettings {
|
|||||||
if (isInNetwork && mediaType === 'Audio') {
|
if (isInNetwork && mediaType === 'Audio') {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return this.get(key) !== 'false';
|
return toBoolean(this.get(key), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +106,4 @@ class AppSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable indent */
|
|
||||||
|
|
||||||
export default new AppSettings();
|
export default new AppSettings();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import appSettings from './appSettings';
|
import appSettings from './appSettings';
|
||||||
import { Events } from 'jellyfin-apiclient';
|
import { Events } from 'jellyfin-apiclient';
|
||||||
|
import { toBoolean } from '../../utils/string.ts';
|
||||||
|
|
||||||
function onSaveTimeout() {
|
function onSaveTimeout() {
|
||||||
const self = this;
|
const self = this;
|
||||||
@ -134,8 +135,7 @@ export class UserSettings {
|
|||||||
return this.set('preferFmp4HlsContainer', val.toString(), false);
|
return this.set('preferFmp4HlsContainer', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('preferFmp4HlsContainer', false);
|
return toBoolean(this.get('preferFmp4HlsContainer', false), false);
|
||||||
return val === 'true';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,8 +148,7 @@ export class UserSettings {
|
|||||||
return this.set('enableCinemaMode', val.toString(), false);
|
return this.set('enableCinemaMode', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('enableCinemaMode', false);
|
return toBoolean(this.get('enableCinemaMode', false), true);
|
||||||
return val !== 'false';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,8 +161,7 @@ export class UserSettings {
|
|||||||
return this.set('enableNextVideoInfoOverlay', val.toString());
|
return this.set('enableNextVideoInfoOverlay', val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('enableNextVideoInfoOverlay', false);
|
return toBoolean(this.get('enableNextVideoInfoOverlay', false), true);
|
||||||
return val !== 'false';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +174,7 @@ export class UserSettings {
|
|||||||
return this.set('enableSetUsingLastTracks', val.toString());
|
return this.set('enableSetUsingLastTracks', val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('enableSetUsingLastTracks', false) !== 'false';
|
return toBoolean(this.get('enableSetUsingLastTracks', false), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,8 +187,7 @@ export class UserSettings {
|
|||||||
return this.set('enableThemeSongs', val.toString(), false);
|
return this.set('enableThemeSongs', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('enableThemeSongs', false);
|
return toBoolean(this.get('enableThemeSongs', false), false);
|
||||||
return val === 'true';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,8 +200,7 @@ export class UserSettings {
|
|||||||
return this.set('enableThemeVideos', val.toString(), false);
|
return this.set('enableThemeVideos', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('enableThemeVideos', false);
|
return toBoolean(this.get('enableThemeVideos', false), false);
|
||||||
return val === 'true';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,8 +213,7 @@ export class UserSettings {
|
|||||||
return this.set('fastFadein', val.toString(), false);
|
return this.set('fastFadein', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('fastFadein', false);
|
return toBoolean(this.get('fastFadein', false), true);
|
||||||
return val !== 'false';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,8 +226,7 @@ export class UserSettings {
|
|||||||
return this.set('blurhash', val.toString(), false);
|
return this.set('blurhash', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('blurhash', false);
|
return toBoolean(this.get('blurhash', false), true);
|
||||||
return val !== 'false';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,8 +239,7 @@ export class UserSettings {
|
|||||||
return this.set('enableBackdrops', val.toString(), false);
|
return this.set('enableBackdrops', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('enableBackdrops', false);
|
return toBoolean(this.get('enableBackdrops', false), false);
|
||||||
return val === 'true';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -259,7 +252,7 @@ export class UserSettings {
|
|||||||
return this.set('disableCustomCss', val.toString(), false);
|
return this.set('disableCustomCss', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('disableCustomCss', false) === 'true';
|
return toBoolean(this.get('disableCustomCss', false), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,8 +278,7 @@ export class UserSettings {
|
|||||||
return this.set('detailsBanner', val.toString(), false);
|
return this.set('detailsBanner', val.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('detailsBanner', false);
|
return toBoolean(this.get('detailsBanner', false), true);
|
||||||
return val !== 'false';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -299,8 +291,7 @@ export class UserSettings {
|
|||||||
return this.set('useEpisodeImagesInNextUpAndResume', val.toString(), true);
|
return this.set('useEpisodeImagesInNextUpAndResume', val.toString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = this.get('useEpisodeImagesInNextUpAndResume', true);
|
return toBoolean(this.get('useEpisodeImagesInNextUpAndResume', true), false);
|
||||||
return val === 'true';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -468,7 +459,7 @@ export class UserSettings {
|
|||||||
return this.set('enableRewatchingInNextUp', val, false);
|
return this.set('enableRewatchingInNextUp', val, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('enableRewatchingInNextUp', false) === 'true';
|
return toBoolean(this.get('enableRewatchingInNextUp', false), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user