move published opml JS code to pref helpers
This commit is contained in:
parent
c6b7a7f8d0
commit
861a632ac7
|
@ -1043,7 +1043,7 @@ class Pref_Feeds extends Handler_Protected {
|
||||||
<?= __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") ?>
|
<?= __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button dojoType='dijit.form.Button' class='alt-primary' onclick="return CommonDialogs.publishedOPML()">
|
<button dojoType='dijit.form.Button' class='alt-primary' onclick="return Helpers.OPML.publish()">
|
||||||
<?= __('Display published OPML URL') ?>
|
<?= __('Display published OPML URL') ?>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
|
@ -587,64 +587,6 @@ const CommonDialogs = {
|
||||||
|
|
||||||
dialog.show();
|
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 = "") {
|
generatedFeed: function(feed, is_cat, search = "") {
|
||||||
|
|
||||||
Notify.progress("Loading, please wait...", true);
|
Notify.progress("Loading, please wait...", true);
|
||||||
|
|
|
@ -347,5 +347,62 @@ const Helpers = {
|
||||||
console.log("export");
|
console.log("export");
|
||||||
window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm"));
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue