diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index e6b1822c2..60c3e2a84 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -369,35 +369,6 @@ const CommonDialogs = { dialog.show(); }, - genUrlChangeKey: function(feed, is_cat) { - if (confirm(__("Generate new syndication address for this feed?"))) { - - Notify.progress("Trying to change address...", true); - - const query = {op: "pref-feeds", method: "regenFeedKey", id: feed, is_cat: is_cat}; - - xhrJson("backend.php", query, (reply) => { - const new_link = reply.link; - const e = $('gen_feed_url'); - - if (new_link) { - e.innerHTML = e.innerHTML.replace(/&key=.*$/, - "&key=" + new_link); - - e.href = e.href.replace(/&key=.*$/, - "&key=" + new_link); - - new Effect.Highlight(e); - - Notify.close(); - - } else { - Notify.error("Could not change feed URL."); - } - }); - } - return false; - }, publishedOPML: function() { Notify.progress("Loading, please wait...", true); @@ -406,15 +377,40 @@ const CommonDialogs = { 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); + + xhrJson("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; + + new Effect.Highlight(target); + + Notify.close(); + + } else { + Notify.error("Could not change feed URL."); + } + } + }); + } + return false; + }, content: `
${__("Your Public OPML URL is:")}
- ${reply.link} + ${App.escapeHtml(reply.link)}