mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add sync settings page
This commit is contained in:
parent
6b91120cb9
commit
b43195c9aa
8 changed files with 119 additions and 30 deletions
|
@ -8,4 +8,11 @@
|
|||
$('.lnkLanguagePreferences', page).attr('href', 'mypreferenceslanguages.html?userId=' + userId);
|
||||
$('.lnkHomeScreenPreferences', page).attr('href', 'mypreferenceshome.html?userId=' + userId);
|
||||
$('.lnkMyProfile', page).attr('href', 'myprofile.html?userId=' + userId);
|
||||
$('.lnkSync', page).attr('href', 'mysyncsettings.html?userId=' + userId);
|
||||
|
||||
if (AppInfo.supportsSyncPathSetting) {
|
||||
page.querySelector('.lnkSync').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.lnkSync').classList.add('hide');
|
||||
}
|
||||
});
|
|
@ -11,7 +11,6 @@
|
|||
$('#selectBackdrop', page).val(appStorage.getItem('enableBackdrops-' + user.Id) || '').selectmenu("refresh");
|
||||
|
||||
page.querySelector('.chkEnableFullScreen').checked = AppSettings.enableFullScreen();
|
||||
page.querySelector('.chkSyncToExternalCard').checked = AppSettings.enableSyncToExternalStorage();
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
@ -28,8 +27,6 @@
|
|||
appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val());
|
||||
appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val());
|
||||
|
||||
AppSettings.enableSyncToExternalStorage(page.querySelector('.chkSyncToExternalCard').checked);
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
|
||||
|
@ -61,15 +58,6 @@
|
|||
|
||||
$('.displayPreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
$('.btnSelectSyncPath', page).on('click', function () {
|
||||
|
||||
require(['nativedirectorychooser'], function () {
|
||||
NativeDirectoryChooser.chooseDirectory().done(function (path) {
|
||||
$('#txtSyncPath', page).val(path);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}).on('pageshowready', "#displayPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
@ -96,12 +84,6 @@
|
|||
} else {
|
||||
$('.fldFullscreen', page).hide();
|
||||
}
|
||||
|
||||
if (AppInfo.supportsSyncPathSetting) {
|
||||
$('.syncSettingsSection', page).show();
|
||||
} else {
|
||||
$('.syncSettingsSection', page).hide();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery, window, document);
|
64
dashboard-ui/scripts/mysyncsettings.js
Normal file
64
dashboard-ui/scripts/mysyncsettings.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
(function ($, window, document) {
|
||||
|
||||
function loadForm(page, user) {
|
||||
|
||||
page.querySelector('.chkSyncToExternalCard').checked = AppSettings.enableSyncToExternalStorage();
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function saveUser(page, user) {
|
||||
|
||||
AppSettings.enableSyncToExternalStorage(page.querySelector('.chkSyncToExternalCard').checked);
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
||||
var page = $(this).parents('.page')[0];
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
|
||||
saveUser(page, user);
|
||||
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#syncPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('form').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
$('.btnSelectSyncPath', page).on('click', function () {
|
||||
|
||||
require(['nativedirectorychooser'], function () {
|
||||
NativeDirectoryChooser.chooseDirectory().done(function (path) {
|
||||
$('#txtSyncPath', page).val(path);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}).on('pageshowready', "#syncPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
|
||||
loadForm(page, user);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window, document);
|
Loading…
Add table
Add a link
Reference in a new issue