1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix multiplication of event listeners

This commit is contained in:
Dmitry Lyzo 2020-12-10 11:27:51 +03:00
parent 3992265189
commit 6a6eae96e6
2 changed files with 96 additions and 100 deletions

View file

@ -56,75 +56,73 @@ function showSaveMessage(recordingPathChanged) {
}
}
export default function () {
$(document).on('pageinit', '#liveTvSettingsPage', function () {
const page = this;
$('.liveTvSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
$('#btnSelectRecordingPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
$('#txtRecordingPath', page).val(path);
}
picker.close();
},
validateWriteable: true
});
});
});
$('#btnSelectMovieRecordingPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
$('#txtMovieRecordingPath', page).val(path);
}
picker.close();
},
validateWriteable: true
});
});
});
$('#btnSelectSeriesRecordingPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
$('#txtSeriesRecordingPath', page).val(path);
}
picker.close();
},
validateWriteable: true
});
});
});
$('#btnSelectPostProcessorPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
if (path) {
$('#txtPostProcessor', page).val(path);
}
picker.close();
$(document).on('pageinit', '#liveTvSettingsPage', function () {
const page = this;
$('.liveTvSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
$('#btnSelectRecordingPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
$('#txtRecordingPath', page).val(path);
}
});
picker.close();
},
validateWriteable: true
});
});
}).on('pageshow', '#liveTvSettingsPage', function () {
loading.show();
const page = this;
ApiClient.getNamedConfiguration('livetv').then(function (config) {
loadPage(page, config);
});
});
}
$('#btnSelectMovieRecordingPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
$('#txtMovieRecordingPath', page).val(path);
}
picker.close();
},
validateWriteable: true
});
});
});
$('#btnSelectSeriesRecordingPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
$('#txtSeriesRecordingPath', page).val(path);
}
picker.close();
},
validateWriteable: true
});
});
});
$('#btnSelectPostProcessorPath', page).on('click.selectDirectory', function () {
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
const picker = new directoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
if (path) {
$('#txtPostProcessor', page).val(path);
}
picker.close();
}
});
});
});
}).on('pageshow', '#liveTvSettingsPage', function () {
loading.show();
const page = this;
ApiClient.getNamedConfiguration('livetv').then(function (config) {
loadPage(page, config);
});
});