summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-21 18:04:44 +0300
committerAndrew Dolgov <[email protected]>2021-02-21 18:04:44 +0300
commit861a632ac7c283c55dfd947ed0152d9846fa2ac0 (patch)
treec501c81cb1d705bb1a553373e8e02888c96fbcdd /js
parentc6b7a7f8d0eaeb11f76dbc70714d740eeac180f1 (diff)
move published opml JS code to pref helpers
Diffstat (limited to 'js')
-rw-r--r--js/CommonDialogs.js58
-rw-r--r--js/PrefHelpers.js57
2 files changed, 57 insertions, 58 deletions
diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js
index a100a546d..321ddf6d3 100644
--- a/js/CommonDialogs.js
+++ b/js/CommonDialogs.js
@@ -587,64 +587,6 @@ const CommonDialogs = {
dialog.show();
},
- publishedOPML: function() {
-
- Notify.progress("Loading, please wait...", true);
-
- xhr.json("backend.php", {op: "pref-feeds", method: "getOPMLKey"}, (reply) => {
- try {
- const dialog = new fox.SingleUseDialog({
- title: __("Public OPML URL"),
- regenOPMLKey: function() {
- if (confirm(__("Replace current OPML publishing address with a new one?"))) {
- Notify.progress("Trying to change address...", true);
-
- xhr.json("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => {
- if (reply) {
- const new_link = reply.link;
- const target = this.domNode.querySelector('.generated_url');
-
- if (new_link && target) {
- target.href = new_link;
- target.innerHTML = new_link;
-
- Notify.close();
-
- } else {
- Notify.error("Could not change feed URL.");
- }
- }
- });
- }
- return false;
- },
- content: `
- <header>${__("Your Public OPML URL is:")}</header>
- <section>
- <div class='panel text-center'>
- <a class='generated_url' href="${App.escapeHtml(reply.link)}" target='_blank'>${App.escapeHtml(reply.link)}</a>
- </div>
- </section>
- <footer class='text-center'>
- <button dojoType='dijit.form.Button' onclick="return App.dialogOf(this).regenOPMLKey()">
- ${__('Generate new URL')}
- </button>
- <button dojoType='dijit.form.Button' type='submit' class='alt-primary'>
- ${__('Close this window')}
- </button>
- </footer>
- `
- });
-
- dialog.show();
-
- Notify.close();
-
- } catch (e) {
- App.Error.report(e);
- }
- });
- },
generatedFeed: function(feed, is_cat, search = "") {
Notify.progress("Loading, please wait...", true);
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index d27e0e071..62f6d91b1 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -347,5 +347,62 @@ const Helpers = {
console.log("export");
window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm"));
},
+ publish: function() {
+ Notify.progress("Loading, please wait...", true);
+
+ xhr.json("backend.php", {op: "pref-feeds", method: "getOPMLKey"}, (reply) => {
+ try {
+ const dialog = new fox.SingleUseDialog({
+ title: __("Public OPML URL"),
+ regenOPMLKey: function() {
+ if (confirm(__("Replace current OPML publishing address with a new one?"))) {
+ Notify.progress("Trying to change address...", true);
+
+ xhr.json("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => {
+ if (reply) {
+ const new_link = reply.link;
+ const target = this.domNode.querySelector('.generated_url');
+
+ if (new_link && target) {
+ target.href = new_link;
+ target.innerHTML = new_link;
+
+ Notify.close();
+
+ } else {
+ Notify.error("Could not change feed URL.");
+ }
+ }
+ });
+ }
+ return false;
+ },
+ content: `
+ <header>${__("Your Public OPML URL is:")}</header>
+ <section>
+ <div class='panel text-center'>
+ <a class='generated_url' href="${App.escapeHtml(reply.link)}" target='_blank'>${App.escapeHtml(reply.link)}</a>
+ </div>
+ </section>
+ <footer class='text-center'>
+ <button dojoType='dijit.form.Button' onclick="return App.dialogOf(this).regenOPMLKey()">
+ ${__('Generate new URL')}
+ </button>
+ <button dojoType='dijit.form.Button' type='submit' class='alt-primary'>
+ ${__('Close this window')}
+ </button>
+ </footer>
+ `
+ });
+
+ dialog.show();
+
+ Notify.close();
+
+ } catch (e) {
+ App.Error.report(e);
+ }
+ });
+ },
}
};