diff options
author | Andrew Dolgov <[email protected]> | 2021-02-12 08:22:00 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-12 08:22:00 +0300 |
commit | 83b0738b04d1af07614164d66f8aa11d2465f539 (patch) | |
tree | b283daba7d8d3917a2ecb9366771161a42eb483b /js/PrefHelpers.js | |
parent | 3134d71b8faa96326e1cf11b949343952155c837 (diff) |
opml import: no more iframe, use client dialog
Diffstat (limited to 'js/PrefHelpers.js')
-rw-r--r-- | js/PrefHelpers.js | 37 |
1 files changed, 35 insertions, 2 deletions
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: ` + <div class='alert alert-info'> + ${__("If you have imported labels and/or filters, you might need to reload preferences to see your new data.")} + </div> + <div class='panel panel-scrollable'> + ${xhr.responseText} + </div> + <footer class='text-center'> + <button dojoType='dijit.form.Button' type='submit' class='alt-primary'> + ${__('Close this window')} + </button> + </footer> + ` + }); + + dialog.show(); + }; + + xhr.send(new FormData($("opml_import_form"))); + + return false; } }, onImportComplete: function(iframe) { |