mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
remove require
This commit is contained in:
parent
aea66e008a
commit
9e28d2d4cc
2 changed files with 45 additions and 57 deletions
|
@ -270,36 +270,6 @@ function reload(context, apiClient, itemId) {
|
||||||
context.querySelector('.pathValue').innerHTML = '';
|
context.querySelector('.pathValue').innerHTML = '';
|
||||||
context.querySelector('.originalFile').classList.add('hide');
|
context.querySelector('.originalFile').classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function onOpenUploadMenu(e) {
|
|
||||||
var dialog = dom.parentWithClass(e.target, 'subtitleEditorDialog');
|
|
||||||
var selectLanguage = dialog.querySelector('#selectLanguage');
|
|
||||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
|
||||||
|
|
||||||
require(['subtitleUploader'], function (subtitleUploader) {
|
|
||||||
subtitleUploader.show({
|
|
||||||
languages: {
|
|
||||||
list: selectLanguage.innerHTML,
|
|
||||||
value: selectLanguage.value
|
|
||||||
},
|
|
||||||
itemId: currentItem.Id,
|
|
||||||
serverId: currentItem.ServerId
|
|
||||||
}).then(function (hasChanged) {
|
|
||||||
if (hasChanged) {
|
|
||||||
hasChanges = true;
|
|
||||||
reload(dialog, apiClient, currentItem.Id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSearchSubmit(e) {
|
|
||||||
var form = this;
|
|
||||||
|
|
||||||
var lang = form.querySelector('#selectLanguage', form).value;
|
|
||||||
|
|
||||||
searchForSubtitles(dom.parentWithClass(form, 'formDialogContent'), lang);
|
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
@ -382,6 +352,28 @@ function centerFocus(elem, horiz, on) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onOpenUploadMenu(e) {
|
||||||
|
const dialog = dom.parentWithClass(e.target, 'subtitleEditorDialog');
|
||||||
|
const selectLanguage = dialog.querySelector('#selectLanguage');
|
||||||
|
const apiClient = ServerConnections.getApiClient(currentItem.ServerId);
|
||||||
|
|
||||||
|
import('../subtitleuploader/subtitleuploader').then(({default: subtitleUploader}) => {
|
||||||
|
subtitleUploader.show({
|
||||||
|
languages: {
|
||||||
|
list: selectLanguage.innerHTML,
|
||||||
|
value: selectLanguage.value
|
||||||
|
},
|
||||||
|
itemId: currentItem.Id,
|
||||||
|
serverId: currentItem.ServerId
|
||||||
|
}).then(function (hasChanged) {
|
||||||
|
if (hasChanged) {
|
||||||
|
hasChanges = true;
|
||||||
|
reload(dialog, apiClient, currentItem.Id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showEditorInternal(itemId, serverId, template) {
|
function showEditorInternal(itemId, serverId, template) {
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
|
|
||||||
|
@ -400,8 +392,6 @@ function showEditorInternal(itemId, serverId, template) {
|
||||||
|
|
||||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.querySelector('.btnOpenUploadMenu').addEventListener('click', onOpenUploadMenu);
|
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
dlg.classList.add('subtitleEditorDialog');
|
dlg.classList.add('subtitleEditorDialog');
|
||||||
|
|
||||||
|
@ -411,6 +401,8 @@ function showEditorInternal(itemId, serverId, template) {
|
||||||
|
|
||||||
dlg.querySelector('.subtitleSearchForm').addEventListener('submit', onSearchSubmit);
|
dlg.querySelector('.subtitleSearchForm').addEventListener('submit', onSearchSubmit);
|
||||||
|
|
||||||
|
dlg.querySelector('.btnOpenUploadMenu').addEventListener('click', onOpenUploadMenu);
|
||||||
|
|
||||||
const btnSubmit = dlg.querySelector('.btnSubmit');
|
const btnSubmit = dlg.querySelector('.btnSubmit');
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
|
|
|
@ -1,30 +1,28 @@
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||||
import connectionManager from 'connectionManager';
|
import ServerConnections from '../ServerConnections';
|
||||||
import dom from 'dom';
|
import dom from '../../scripts/dom';
|
||||||
import loading from 'loading';
|
import loading from '../../components/loading/loading';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from '../../libraries/scroller';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from '../layoutManager';
|
||||||
import globalize from 'globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
import template from 'text!./subtitleuploader.template.html';
|
import template from './subtitleuploader.template.html';
|
||||||
import 'require';
|
import toast from '../toast/toast';
|
||||||
import 'emby-button';
|
import '../../elements/emby-button/emby-button';
|
||||||
import 'emby-select';
|
import '../../elements/emby-select/emby-select';
|
||||||
import 'formDialogStyle';
|
import '../formdialog.css';
|
||||||
import 'css!./style';
|
import './style.css';
|
||||||
|
|
||||||
var currentItemId;
|
let currentItemId;
|
||||||
var currentServerId;
|
let currentServerId;
|
||||||
var currentFile;
|
let currentFile;
|
||||||
var hasChanges = false;
|
let hasChanges = false;
|
||||||
|
|
||||||
function onFileReaderError(evt) {
|
function onFileReaderError(evt) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
const error = evt.target.error;
|
const error = evt.target.error;
|
||||||
if (error.code !== error.ABORT_ERR) {
|
if (error.code !== error.ABORT_ERR) {
|
||||||
require(['toast'], function (toast) {
|
|
||||||
toast(globalize.translate('MessageFileReadError'));
|
toast(globalize.translate('MessageFileReadError'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +77,7 @@ function onSubmit(e) {
|
||||||
const file = currentFile;
|
const file = currentFile;
|
||||||
|
|
||||||
if (!isValidSubtitleFile(file)) {
|
if (!isValidSubtitleFile(file)) {
|
||||||
require(['toast'], function (toast) {
|
|
||||||
toast(globalize.translate('MessageSubtitleFileTypeAllowed'));
|
toast(globalize.translate('MessageSubtitleFileTypeAllowed'));
|
||||||
});
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +88,7 @@ function onSubmit(e) {
|
||||||
const language = dlg.querySelector('#selectLanguage').value;
|
const language = dlg.querySelector('#selectLanguage').value;
|
||||||
const isForced = dlg.querySelector('#chkIsForced').checked;
|
const isForced = dlg.querySelector('#chkIsForced').checked;
|
||||||
|
|
||||||
connectionManager.getApiClient(currentServerId).uploadItemSubtitle(currentItemId, language, isForced, file).then(function () {
|
ServerConnections.getApiClient(currentServerId).uploadItemSubtitle(currentItemId, language, isForced, file).then(function () {
|
||||||
dlg.querySelector('#uploadSubtitle').value = '';
|
dlg.querySelector('#uploadSubtitle').value = '';
|
||||||
loading.hide();
|
loading.hide();
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
|
@ -133,7 +129,7 @@ function showEditor(options, resolve, reject) {
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
dlg.classList.add('subtitleUploaderDialog');
|
dlg.classList.add('subtitleUploaderDialog');
|
||||||
|
|
||||||
dlg.innerHTML = globalize.translateDocument(template, 'core');
|
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollHelper.centerFocus.on(dlg, false);
|
scrollHelper.centerFocus.on(dlg, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue