mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
solved imports for alert, toast and confirm
This commit is contained in:
parent
4b42afcd7a
commit
86a9f4e36f
49 changed files with 417 additions and 550 deletions
|
@ -7,6 +7,7 @@ import serverNotifications from '../scripts/serverNotifications';
|
|||
import '../elements/emby-button/emby-button';
|
||||
import './listview/listview.css';
|
||||
import ServerConnections from './ServerConnections';
|
||||
import alert from './alert';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -128,10 +129,8 @@ import ServerConnections from './ServerConnections';
|
|||
}
|
||||
|
||||
function showItemOverview(item) {
|
||||
import('./alert').then((alert) => {
|
||||
alert({
|
||||
text: item.Overview
|
||||
});
|
||||
alert({
|
||||
text: item.Overview
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import viewManager from './viewManager/viewManager';
|
|||
import AppInfo from './AppInfo';
|
||||
import Dashboard from '../scripts/clientUtils';
|
||||
import ServerConnections from './ServerConnections';
|
||||
import alert from './alert';
|
||||
|
||||
class AppRouter {
|
||||
allRoutes = [];
|
||||
|
@ -289,13 +290,11 @@ class AppRouter {
|
|||
this.showWelcome();
|
||||
break;
|
||||
case 'ServerUpdateNeeded':
|
||||
import('./alert').then((alert) =>{
|
||||
alert({
|
||||
text: globalize.translate('ServerUpdateNeeded', 'https://github.com/jellyfin/jellyfin'),
|
||||
html: globalize.translate('ServerUpdateNeeded', '<a href="https://github.com/jellyfin/jellyfin">https://github.com/jellyfin/jellyfin</a>')
|
||||
}).then(() => {
|
||||
this.showSelectServer();
|
||||
});
|
||||
alert({
|
||||
text: globalize.translate('ServerUpdateNeeded', 'https://github.com/jellyfin/jellyfin'),
|
||||
html: globalize.translate('ServerUpdateNeeded', '<a href="https://github.com/jellyfin/jellyfin">https://github.com/jellyfin/jellyfin</a>')
|
||||
}).then(() => {
|
||||
this.showSelectServer();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
@ -410,9 +409,7 @@ class AppRouter {
|
|||
this.forcedLogoutMsg = null;
|
||||
|
||||
if (msg) {
|
||||
import('./alert').then((alert) => {
|
||||
alert(msg);
|
||||
});
|
||||
alert(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,68 +2,64 @@ import browser from '../../scripts/browser';
|
|||
import dialog from '../dialog/dialog';
|
||||
import globalize from '../../scripts/globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
export default (() => {
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
function nativeConfirm(options) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
if (browser.tv && window.confirm) {
|
||||
// Use the native confirm dialog
|
||||
return options => {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
const text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
const result = window.confirm(text);
|
||||
|
||||
const text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
const result = window.confirm(text);
|
||||
if (result) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
}
|
||||
|
||||
if (result) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
function customConfirm(text, title) {
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
text: text
|
||||
};
|
||||
} else {
|
||||
// Use our own dialog
|
||||
return (text, title) => {
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
text: text
|
||||
};
|
||||
} else {
|
||||
options = text;
|
||||
}
|
||||
|
||||
const items = [];
|
||||
|
||||
items.push({
|
||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||
id: 'cancel',
|
||||
type: 'cancel'
|
||||
});
|
||||
|
||||
items.push({
|
||||
name: options.confirmText || globalize.translate('ButtonOk'),
|
||||
id: 'ok',
|
||||
type: options.primary === 'delete' ? 'delete' : 'submit'
|
||||
});
|
||||
|
||||
options.buttons = items;
|
||||
|
||||
return dialog.show(options).then(result => {
|
||||
if (result === 'ok') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return Promise.reject();
|
||||
});
|
||||
};
|
||||
options = text;
|
||||
}
|
||||
})();
|
||||
/* eslint-enable indent */
|
||||
|
||||
const items = [];
|
||||
|
||||
items.push({
|
||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||
id: 'cancel',
|
||||
type: 'cancel'
|
||||
});
|
||||
|
||||
items.push({
|
||||
name: options.confirmText || globalize.translate('ButtonOk'),
|
||||
id: 'ok',
|
||||
type: options.primary === 'delete' ? 'delete' : 'submit'
|
||||
});
|
||||
|
||||
options.buttons = items;
|
||||
|
||||
return dialog.show(options).then(result => {
|
||||
if (result === 'ok') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return Promise.reject();
|
||||
});
|
||||
}
|
||||
|
||||
const baseConfirm = browser.tv && window.confirm ? nativeConfirm : customConfirm;
|
||||
|
||||
export default baseConfirm;
|
||||
|
|
|
@ -8,6 +8,7 @@ import '../../elements/emby-button/paper-icon-button-light';
|
|||
import './directorybrowser.css';
|
||||
import '../formdialog.css';
|
||||
import '../../elements/emby-button/emby-button';
|
||||
import alert from '../alert';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -157,9 +158,7 @@ import '../../elements/emby-button/emby-button';
|
|||
}
|
||||
|
||||
function alertTextWithOptions(options) {
|
||||
import('../alert').then((alert) => {
|
||||
alert(options);
|
||||
});
|
||||
alert(options);
|
||||
}
|
||||
|
||||
function validatePath(path, validateWriteable, apiClient) {
|
||||
|
|
|
@ -14,6 +14,8 @@ import '../../elements/emby-button/emby-button';
|
|||
import '../../elements/emby-button/paper-icon-button-light';
|
||||
import './imageeditor.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import alert from '../alert';
|
||||
import confirm from '../confirm/confirm';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -200,15 +202,11 @@ import ServerConnections from '../ServerConnections';
|
|||
return;
|
||||
}
|
||||
|
||||
import('../confirm/confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
|
||||
text: globalize.translate('ConfirmDeleteImage'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
|
||||
}).then(afterConfirm);
|
||||
});
|
||||
confirm({
|
||||
text: globalize.translate('ConfirmDeleteImage'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
}).then(afterConfirm);
|
||||
}
|
||||
|
||||
function moveImage(context, apiClient, itemId, type, index, newIndex, focusContext) {
|
||||
|
@ -216,9 +214,7 @@ import ServerConnections from '../ServerConnections';
|
|||
hasChanges = true;
|
||||
reload(context, null, focusContext);
|
||||
}, function () {
|
||||
import('../alert').then((alert) => {
|
||||
alert(globalize.translate('ErrorDefault'));
|
||||
});
|
||||
alert(globalize.translate('ErrorDefault'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import '../listview/listview.css';
|
|||
import '../formdialog.css';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import toast from '../toast/toast';
|
||||
import alert from '../alert';
|
||||
|
||||
function onAddLibrary() {
|
||||
if (isCreating) {
|
||||
|
@ -27,11 +28,9 @@ import toast from '../toast/toast';
|
|||
}
|
||||
|
||||
if (pathInfos.length == 0) {
|
||||
import('../alert').then((alert) => {
|
||||
alert({
|
||||
text: globalize.translate('PleaseAddAtLeastOneFolder'),
|
||||
type: 'error'
|
||||
});
|
||||
alert({
|
||||
text: globalize.translate('PleaseAddAtLeastOneFolder'),
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
return false;
|
||||
|
|
|
@ -18,6 +18,7 @@ import '../formdialog.css';
|
|||
import '../../elements/emby-toggle/emby-toggle';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import toast from '../toast/toast';
|
||||
import confirm from '../confirm/confirm';
|
||||
|
||||
function onEditLibrary() {
|
||||
if (isCreating) {
|
||||
|
@ -69,20 +70,18 @@ import toast from '../toast/toast';
|
|||
const button = btnRemovePath;
|
||||
const virtualFolder = currentOptions.library;
|
||||
|
||||
import('../confirm/confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
title: globalize.translate('HeaderRemoveMediaLocation'),
|
||||
text: globalize.translate('MessageConfirmRemoveMediaLocation'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
}).then(() => {
|
||||
const refreshAfterChange = currentOptions.refresh;
|
||||
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(() => {
|
||||
hasChanges = true;
|
||||
refreshLibraryFromServer(dom.parentWithClass(button, 'dlg-libraryeditor'));
|
||||
}, () => {
|
||||
toast(globalize.translate('ErrorDefault'));
|
||||
});
|
||||
confirm({
|
||||
title: globalize.translate('HeaderRemoveMediaLocation'),
|
||||
text: globalize.translate('MessageConfirmRemoveMediaLocation'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
}).then(() => {
|
||||
const refreshAfterChange = currentOptions.refresh;
|
||||
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(() => {
|
||||
hasChanges = true;
|
||||
refreshLibraryFromServer(dom.parentWithClass(button, 'dlg-libraryeditor'));
|
||||
}, () => {
|
||||
toast(globalize.translate('ErrorDefault'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import '../formdialog.css';
|
|||
import '../../assets/css/clearbutton.css';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -36,9 +37,7 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
function submitUpdatedItem(form, item) {
|
||||
function afterContentTypeUpdated() {
|
||||
import('../toast/toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageItemSaved'));
|
||||
});
|
||||
toast(globalize.translate('MessageItemSaved'));
|
||||
|
||||
loading.hide();
|
||||
closeDialog(true);
|
||||
|
|
|
@ -5,6 +5,9 @@ import globalize from '../../scripts/globalize';
|
|||
import dom from '../../scripts/dom';
|
||||
import './multiSelect.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import alert from '../alert';
|
||||
import playlistEditor from '../playlisteditor/playlisteditor';
|
||||
import confirm from '../confirm/confirm';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -138,10 +141,8 @@ import ServerConnections from '../ServerConnections';
|
|||
}
|
||||
|
||||
function alertText(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
import('../alert').then((alert) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -155,17 +156,15 @@ import ServerConnections from '../ServerConnections';
|
|||
title = globalize.translate('HeaderDeleteItems');
|
||||
}
|
||||
|
||||
import('../confirm/confirm').then((confirm) => {
|
||||
confirm(msg, title).then(() => {
|
||||
const promises = itemIds.map(itemId => {
|
||||
apiClient.deleteItem(itemId);
|
||||
});
|
||||
confirm(msg, title).then(() => {
|
||||
const promises = itemIds.map(itemId => {
|
||||
apiClient.deleteItem(itemId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(resolve, () => {
|
||||
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
||||
});
|
||||
}, reject);
|
||||
});
|
||||
Promise.all(promises).then(resolve, () => {
|
||||
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
||||
});
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -318,11 +317,8 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
function combineVersions(apiClient, selection) {
|
||||
if (selection.length < 2) {
|
||||
import('../alert').then((alert) => {
|
||||
alert({
|
||||
|
||||
text: globalize.translate('PleaseSelectTwoItems')
|
||||
});
|
||||
alert({
|
||||
text: globalize.translate('PleaseSelectTwoItems')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import loading from '../loading/loading';
|
|||
import { appHost } from '../apphost';
|
||||
import * as Screenfull from 'screenfull';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import alert from '../alert';
|
||||
|
||||
function enableLocalPlaylistManagement(player) {
|
||||
if (player.getPlaylist) {
|
||||
|
@ -648,11 +649,9 @@ function validatePlaybackInfoResult(instance, result) {
|
|||
}
|
||||
|
||||
function showPlaybackInfoErrorMessage(instance, errorCode) {
|
||||
import('../alert').then(({ default: alert }) => {
|
||||
alert({
|
||||
text: globalize.translate(errorCode),
|
||||
title: globalize.translate('HeaderPlaybackError')
|
||||
});
|
||||
alert({
|
||||
text: globalize.translate(errorCode),
|
||||
title: globalize.translate('HeaderPlaybackError')
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import { Events } from 'jellyfin-apiclient';
|
|||
import '../../elements/emby-select/emby-select';
|
||||
import '../../elements/emby-checkbox/emby-checkbox';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -244,9 +245,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');
|
||||
|
|
|
@ -9,6 +9,7 @@ import '../../elements/emby-button/paper-icon-button-light';
|
|||
import './recordingfields.css';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/*eslint prefer-const: "error"*/
|
||||
|
||||
|
@ -226,9 +227,7 @@ function onRecordChange(e) {
|
|||
}
|
||||
|
||||
function sendToast(msg) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(msg);
|
||||
});
|
||||
toast(msg);
|
||||
}
|
||||
|
||||
function onRecordSeriesChange(e) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import globalize from '../../scripts/globalize';
|
||||
import loading from '../loading/loading';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
import confirm from '../confirm/confirm';
|
||||
|
||||
/*eslint prefer-const: "error"*/
|
||||
|
||||
|
@ -29,48 +31,42 @@ function changeRecordingToSeries(apiClient, timerId, programId, confirmTimerCanc
|
|||
|
||||
function cancelTimerWithConfirmation(timerId, serverId) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
import('../confirm/confirm').then((confirm) => {
|
||||
confirm.default({
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
primary: 'delete',
|
||||
confirmText: globalize.translate('HeaderCancelRecording'),
|
||||
cancelText: globalize.translate('HeaderKeepRecording')
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
primary: 'delete',
|
||||
confirmText: globalize.translate('HeaderCancelRecording'),
|
||||
cancelText: globalize.translate('HeaderKeepRecording')
|
||||
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
cancelTimer(apiClient, timerId, true).then(resolve, reject);
|
||||
}, reject);
|
||||
});
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
cancelTimer(apiClient, timerId, true).then(resolve, reject);
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
function cancelSeriesTimerWithConfirmation(timerId, serverId) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
import('../confirm/confirm').then((confirm) => {
|
||||
confirm.default({
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
primary: 'delete',
|
||||
confirmText: globalize.translate('HeaderCancelSeries'),
|
||||
cancelText: globalize.translate('HeaderKeepSeries')
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
primary: 'delete',
|
||||
confirmText: globalize.translate('HeaderCancelSeries'),
|
||||
cancelText: globalize.translate('HeaderKeepSeries')
|
||||
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('SeriesCancelled'));
|
||||
});
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
|
||||
toast(globalize.translate('SeriesCancelled'));
|
||||
|
||||
loading.hide();
|
||||
resolve();
|
||||
}, reject);
|
||||
loading.hide();
|
||||
resolve();
|
||||
}, reject);
|
||||
});
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -99,9 +95,7 @@ function createRecording(apiClient, programId, isSeries) {
|
|||
}
|
||||
|
||||
function sendToast(msg) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(msg);
|
||||
});
|
||||
toast(msg);
|
||||
}
|
||||
|
||||
function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||
|
@ -151,10 +145,7 @@ function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus,
|
|||
loading.show();
|
||||
|
||||
apiClient.cancelLiveTvSeriesTimer(seriesTimerId).then(function () {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('SeriesCancelled'));
|
||||
});
|
||||
|
||||
toast(globalize.translate('SeriesCancelled'));
|
||||
loading.hide();
|
||||
resolve();
|
||||
}, reject);
|
||||
|
|
|
@ -11,6 +11,7 @@ import '../../elements/emby-select/emby-select';
|
|||
import 'material-design-icons-iconfont';
|
||||
import '../formdialog.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/*eslint prefer-const: "error"*/
|
||||
|
||||
|
@ -86,9 +87,7 @@ function onSubmit(e) {
|
|||
|
||||
dialogHelper.close(dlg);
|
||||
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('RefreshQueued'));
|
||||
});
|
||||
toast(globalize.translate('RefreshQueued'));
|
||||
|
||||
loading.hide();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
|||
import './remotecontrol.css';
|
||||
import '../../elements/emby-ratingbutton/emby-ratingbutton';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/*eslint prefer-const: "error"*/
|
||||
|
||||
|
@ -864,9 +865,7 @@ export default function () {
|
|||
}, currentPlayer);
|
||||
form.querySelector('input').value = '';
|
||||
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast('Message sent.');
|
||||
});
|
||||
toast('Message sent.');
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
@ -883,9 +882,7 @@ export default function () {
|
|||
}, currentPlayer);
|
||||
form.querySelector('input').value = '';
|
||||
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast('Text sent.');
|
||||
});
|
||||
toast('Text sent.');
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
|
@ -15,6 +15,8 @@ import './subtitleeditor.css';
|
|||
import '../../elements/emby-button/emby-button';
|
||||
import '../../assets/css/flexstyles.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
import confirm from '../confirm/confirm';
|
||||
|
||||
let currentItem;
|
||||
let hasChanges;
|
||||
|
@ -31,9 +33,7 @@ function downloadRemoteSubtitles(context, id) {
|
|||
}).then(function () {
|
||||
hasChanges = true;
|
||||
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('MessageDownloadQueued'));
|
||||
});
|
||||
toast(globalize.translate('MessageDownloadQueued'));
|
||||
|
||||
focusManager.autoFocus(context);
|
||||
});
|
||||
|
@ -42,31 +42,29 @@ function downloadRemoteSubtitles(context, id) {
|
|||
function deleteLocalSubtitle(context, index) {
|
||||
const msg = globalize.translate('MessageAreYouSureDeleteSubtitles');
|
||||
|
||||
import('../confirm/confirm').then((confirm) => {
|
||||
confirm({
|
||||
confirm({
|
||||
|
||||
title: globalize.translate('ConfirmDeletion'),
|
||||
text: msg,
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
title: globalize.translate('ConfirmDeletion'),
|
||||
text: msg,
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
|
||||
const itemId = currentItem.Id;
|
||||
const url = 'Videos/' + itemId + '/Subtitles/' + index;
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(currentItem.ServerId);
|
||||
|
||||
apiClient.ajax({
|
||||
|
||||
type: 'DELETE',
|
||||
url: apiClient.getUrl(url)
|
||||
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
|
||||
const itemId = currentItem.Id;
|
||||
const url = 'Videos/' + itemId + '/Subtitles/' + index;
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(currentItem.ServerId);
|
||||
|
||||
apiClient.ajax({
|
||||
|
||||
type: 'DELETE',
|
||||
url: apiClient.getUrl(url)
|
||||
|
||||
}).then(function () {
|
||||
hasChanges = true;
|
||||
reload(context, apiClient, itemId);
|
||||
});
|
||||
hasChanges = true;
|
||||
reload(context, apiClient, itemId);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import '../../elements/emby-checkbox/emby-checkbox';
|
|||
import '../../assets/css/flexstyles.css';
|
||||
import './subtitlesettings.css';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
/**
|
||||
* Subtitle settings.
|
||||
|
@ -88,9 +89,7 @@ function save(instance, context, userId, userSettings, apiClient, enableSaveConf
|
|||
saveUser(context, user, userSettings, instance.appearanceKey, apiClient).then(function () {
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('../toast/toast').then((toast) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
}
|
||||
|
||||
Events.trigger(instance, 'saved');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue