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