summaryrefslogtreecommitdiff
path: root/functions.js
diff options
context:
space:
mode:
Diffstat (limited to 'functions.js')
-rw-r--r--functions.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/functions.js b/functions.js
index f3ae1965e..f3756051f 100644
--- a/functions.js
+++ b/functions.js
@@ -2216,3 +2216,48 @@ function quickAddCat(select) {
exception_error("quickAddCat", e);
}
}
+
+function genUrlChangeKey(feed, is_cat) {
+
+ try {
+ var ok = confirm(__("Generate new syndication address for this feed?"));
+
+ if (ok) {
+
+ notify_progress("Trying to change address...", true);
+
+ var query = "?op=rpc&subop=regenFeedKey&id=" + param_escape(feed) +
+ "&is_cat=" + param_escape(is_cat);
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ var new_link = transport.responseXML.getElementsByTagName("link")[0];
+
+ var e = $('gen_feed_url');
+
+ if (new_link) {
+
+ new_link = new_link.firstChild.nodeValue;
+
+ e.innerHTML = e.innerHTML.replace(/\&key=.*$/,
+ "&key=" + new_link);
+
+ e.href = e.href.replace(/\&key=.*$/,
+ "&key=" + new_link);
+
+ new Effect.Highlight(e);
+
+ notify('');
+
+ } else {
+ notify_error("Could not change feed URL.");
+ }
+ } });
+ }
+ } catch (e) {
+ exception_error("genUrlChangeKey", e);
+ }
+ return false;
+}
+