fix some toast imports
This commit is contained in:
parent
c7caf8134d
commit
4b42afcd7a
11 changed files with 38 additions and 59 deletions
|
@ -13,6 +13,7 @@ import 'material-design-icons-iconfont';
|
|||
import '../formdialog.css';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -81,9 +82,7 @@ import ServerConnections from '../ServerConnections';
|
|||
dlg.submitted = true;
|
||||
dialogHelper.close(dlg);
|
||||
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('MessageItemsAdded'));
|
||||
});
|
||||
toast(globalize.translate('MessageItemsAdded'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import '../../elements/emby-select/emby-select';
|
|||
import '../../elements/emby-checkbox/emby-checkbox';
|
||||
import '../../elements/emby-button/emby-button';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -169,9 +170,7 @@ import ServerConnections from '../ServerConnections';
|
|||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
}
|
||||
Events.trigger(instance, 'saved');
|
||||
}, () => {
|
||||
|
|
|
@ -10,6 +10,7 @@ import '../listview/listview.css';
|
|||
import '../../elements/emby-select/emby-select';
|
||||
import '../../elements/emby-checkbox/emby-checkbox';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -371,9 +372,7 @@ import ServerConnections from '../ServerConnections';
|
|||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
}
|
||||
|
||||
Events.trigger(instance, 'saved');
|
||||
|
|
|
@ -16,6 +16,7 @@ import '../../elements/emby-select/emby-select';
|
|||
import '../formdialog.css';
|
||||
import './style.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
let currentItemId;
|
||||
let currentServerId;
|
||||
|
@ -27,16 +28,12 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
switch (evt.target.error.code) {
|
||||
case evt.target.error.NOT_FOUND_ERR:
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('MessageFileReadError'));
|
||||
});
|
||||
toast(globalize.translate('MessageFileReadError'));
|
||||
break;
|
||||
case evt.target.error.ABORT_ERR:
|
||||
break; // noop
|
||||
default:
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('MessageFileReadError'));
|
||||
});
|
||||
toast(globalize.translate('MessageFileReadError'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -88,9 +85,7 @@ import ServerConnections from '../ServerConnections';
|
|||
}
|
||||
|
||||
if (!file.type.startsWith('image/')) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('MessageImageFileTypeAllowed'));
|
||||
});
|
||||
toast(globalize.translate('MessageImageFileTypeAllowed'));
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
@ -101,9 +96,7 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
const imageType = dlg.querySelector('#selectImageType').value;
|
||||
if (imageType === 'None') {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('MessageImageTypeNotSelected'));
|
||||
});
|
||||
toast(globalize.translate('MessageImageTypeNotSelected'));
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { appRouter } from './appRouter';
|
|||
import itemHelper from './itemHelper';
|
||||
import { playbackManager } from './playback/playbackmanager';
|
||||
import ServerConnections from './ServerConnections';
|
||||
import toast from './toast/toast';
|
||||
|
||||
/* eslint-disable indent */
|
||||
export function getCommands(options) {
|
||||
|
@ -373,9 +374,7 @@ import ServerConnections from './ServerConnections';
|
|||
textArea.select();
|
||||
|
||||
if (document.execCommand('copy')) {
|
||||
import('./toast/toast').then((toast) => {
|
||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||
});
|
||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||
} else {
|
||||
prompt(globalize.translate('CopyStreamURL'), downloadHref);
|
||||
}
|
||||
|
@ -388,9 +387,7 @@ import ServerConnections from './ServerConnections';
|
|||
} else {
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||
import('./toast/toast').then((toast) => {
|
||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||
});
|
||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||
}).catch(function () {
|
||||
textAreaCopy();
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@ import '../formdialog.css';
|
|||
import 'material-design-icons-iconfont';
|
||||
import '../cardbuilder/card.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||
|
||||
|
@ -68,9 +69,7 @@ import ServerConnections from '../ServerConnections';
|
|||
}
|
||||
|
||||
if (!hasId && !lookupInfo.Name) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('PleaseEnterNameOrId'));
|
||||
});
|
||||
toast(globalize.translate('PleaseEnterNameOrId'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import '../../elements/emby-toggle/emby-toggle';
|
|||
import '../listview/listview.css';
|
||||
import '../formdialog.css';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
function onAddLibrary() {
|
||||
if (isCreating) {
|
||||
|
@ -54,9 +55,7 @@ import '../../assets/css/flexstyles.css';
|
|||
loading.hide();
|
||||
dialogHelper.close(dlg);
|
||||
}, () => {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
|
||||
isCreating = false;
|
||||
loading.hide();
|
||||
|
|
|
@ -17,6 +17,7 @@ import '../../elements/emby-button/paper-icon-button-light';
|
|||
import '../formdialog.css';
|
||||
import '../../elements/emby-toggle/emby-toggle';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
function onEditLibrary() {
|
||||
if (isCreating) {
|
||||
|
@ -47,9 +48,7 @@ import '../../assets/css/flexstyles.css';
|
|||
hasChanges = true;
|
||||
refreshLibraryFromServer(page);
|
||||
}, () => {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -62,9 +61,7 @@ import '../../assets/css/flexstyles.css';
|
|||
hasChanges = true;
|
||||
refreshLibraryFromServer(page);
|
||||
}, () => {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,9 +81,7 @@ import '../../assets/css/flexstyles.css';
|
|||
hasChanges = true;
|
||||
refreshLibraryFromServer(dom.parentWithClass(button, 'dlg-libraryeditor'));
|
||||
}, () => {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('ErrorDefault'));
|
||||
});
|
||||
toast(globalize.translate('ErrorDefault'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,6 +12,7 @@ import globalize from '../scripts/globalize';
|
|||
import dom from '../scripts/dom';
|
||||
import recordingHelper from './recordingcreator/recordinghelper';
|
||||
import ServerConnections from './ServerConnections';
|
||||
import toast from './toast/toast';
|
||||
|
||||
function playAllFromHere(card, serverId, queue) {
|
||||
const parent = card.parentNode;
|
||||
|
@ -165,9 +166,7 @@ import ServerConnections from './ServerConnections';
|
|||
}
|
||||
|
||||
function sendToast(text) {
|
||||
import('./toast/toast').then((toast) => {
|
||||
toast(text);
|
||||
});
|
||||
toast(text);
|
||||
}
|
||||
|
||||
function executeAction(card, target, action) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import './toast';
|
||||
import './toast.css';
|
||||
|
||||
function remove(elem) {
|
||||
setTimeout(function () {
|
||||
|
|
|
@ -11,18 +11,18 @@ import { AppStorage, Events } from 'jellyfin-apiclient';
|
|||
|
||||
export function enableAutoLogin(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('enableAutoLogin', val.toString());
|
||||
set('enableAutoLogin', val.toString());
|
||||
}
|
||||
|
||||
return this.get('enableAutoLogin') !== 'false';
|
||||
return get('enableAutoLogin') !== 'false';
|
||||
}
|
||||
|
||||
export function enableSystemExternalPlayers(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('enableSystemExternalPlayers', val.toString());
|
||||
set('enableSystemExternalPlayers', val.toString());
|
||||
}
|
||||
|
||||
return this.get('enableSystemExternalPlayers') === 'true';
|
||||
return get('enableSystemExternalPlayers') === 'true';
|
||||
}
|
||||
|
||||
export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
|
||||
|
@ -32,13 +32,13 @@ import { AppStorage, Events } from 'jellyfin-apiclient';
|
|||
val = true;
|
||||
}
|
||||
|
||||
this.set(key, val.toString());
|
||||
set(key, val.toString());
|
||||
}
|
||||
|
||||
if (isInNetwork && mediaType === 'Audio') {
|
||||
return true;
|
||||
} else {
|
||||
return this.get(key) !== 'false';
|
||||
return get(key) !== 'false';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ import { AppStorage, Events } from 'jellyfin-apiclient';
|
|||
if (isInNetwork && mediaType === 'Audio') {
|
||||
// nothing to do, this is always a max value
|
||||
} else {
|
||||
this.set(key, val);
|
||||
set(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,30 +56,30 @@ import { AppStorage, Events } from 'jellyfin-apiclient';
|
|||
// return a huge number so that it always direct plays
|
||||
return 150000000;
|
||||
} else {
|
||||
return parseInt(this.get(key) || '0') || 1500000;
|
||||
return parseInt(get(key) || '0') || 1500000;
|
||||
}
|
||||
}
|
||||
|
||||
export function maxStaticMusicBitrate(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('maxStaticMusicBitrate', val);
|
||||
set('maxStaticMusicBitrate', val);
|
||||
}
|
||||
|
||||
const defaultValue = 320000;
|
||||
return parseInt(this.get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
|
||||
return parseInt(get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
|
||||
}
|
||||
|
||||
export function maxChromecastBitrate(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('chromecastBitrate1', val);
|
||||
set('chromecastBitrate1', val);
|
||||
}
|
||||
|
||||
val = this.get('chromecastBitrate1');
|
||||
val = get('chromecastBitrate1');
|
||||
return val ? parseInt(val) : null;
|
||||
}
|
||||
|
||||
export function set(name, value, userId) {
|
||||
const currentValue = this.get(name, userId);
|
||||
const currentValue = get(name, userId);
|
||||
AppStorage.setItem(getKey(name, userId), value);
|
||||
|
||||
if (currentValue !== value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue