From 28dd255c30c7bdb528ec1fde2391705fbc9b4cf6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 8 Mar 2021 16:54:11 +0300 Subject: show user css editor before xhr is completed --- js/PrefHelpers.js | 102 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 46 deletions(-) (limited to 'js/PrefHelpers.js') diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index fdf282090..651e3f609 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -239,60 +239,70 @@ const Helpers = { }, Prefs: { customizeCSS: function() { - xhr.json("backend.php", {op: "pref-prefs", method: "customizeCSS"}, (reply) => { - - const dialog = new fox.SingleUseDialog({ - title: __("Customize stylesheet"), - apply: function() { - xhr.post("backend.php", this.attr('value'), () => { - Element.show("css_edit_apply_msg"); - App.byId("user_css_style").innerText = this.attr('value'); - }); - }, - execute: function () { - Notify.progress('Saving data...', true); + const dialog = new fox.SingleUseDialog({ + title: __("Customize stylesheet"), + apply: function() { + xhr.post("backend.php", this.attr('value'), () => { + Element.show("css_edit_apply_msg"); + App.byId("user_css_style").innerText = this.attr('value'); + }); + }, + execute: function () { + Notify.progress('Saving data...', true); - xhr.post("backend.php", this.attr('value'), () => { - window.location.reload(); - }); - }, - content: ` -
- ${__("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here.")} -
+ xhr.post("backend.php", this.attr('value'), () => { + window.location.reload(); + }); + }, + content: ` +
+ ${__("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here.")} +
- ${App.FormFields.hidden_tag('op', 'rpc')} - ${App.FormFields.hidden_tag('method', 'setpref')} - ${App.FormFields.hidden_tag('key', 'USER_STYLESHEET')} + ${App.FormFields.hidden_tag('op', 'rpc')} + ${App.FormFields.hidden_tag('method', 'setpref')} + ${App.FormFields.hidden_tag('key', 'USER_STYLESHEET')} -