From 83b0738b04d1af07614164d66f8aa11d2465f539 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 12 Feb 2021 08:22:00 +0300 Subject: opml import: no more iframe, use client dialog --- js/PrefHelpers.js | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'js/PrefHelpers.js') diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index f9cb450e5..6fabc48df 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -220,9 +220,42 @@ const Helpers = { } else { Notify.progress("Importing, please wait...", true); - Element.show("upload_iframe"); + const xhr = new XMLHttpRequest(); - return true; + xhr.open( 'POST', 'backend.php', true ); + xhr.onload = function () { + Notify.close(); + + const dialog = new dijit.Dialog({ + title: __("OPML Import"), + style: "width: 600px", + onCancel: function () { + window.location.reload(); + }, + execute: function () { + window.location.reload(); + }, + content: ` +
+ ${__("If you have imported labels and/or filters, you might need to reload preferences to see your new data.")} +
+
+ ${xhr.responseText} +
+ + ` + }); + + dialog.show(); + }; + + xhr.send(new FormData($("opml_import_form"))); + + return false; } }, onImportComplete: function(iframe) { -- cgit v1.2.3-54-g00ecf