1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 15:25:59 +00:00

opml import: no more iframe, use client dialog

This commit is contained in:
Andrew Dolgov
2021-02-12 08:22:00 +03:00
parent 3134d71b8f
commit 83b0738b04
3 changed files with 42 additions and 32 deletions

View File

@@ -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) {