diff options
author | Christian Weiske <[email protected]> | 2010-11-09 22:42:03 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-10 07:16:45 +0300 |
commit | 5eeb387497a6a35115d41a20a9a9f8f82531975b (patch) | |
tree | daf5e1a5767c9cabc6890b162ac9af21865c89d2 /functions.js | |
parent | 9a8ce9561dafe155f282ddb2e78d6a6730b8863a (diff) |
Implement the last part of #276: show the list of available feeds in the frontend and let the user select one of them (refs #276)
Diffstat (limited to 'functions.js')
-rw-r--r-- | functions.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/functions.js b/functions.js index 62ecd135d..e4deab47a 100644 --- a/functions.js +++ b/functions.js @@ -1322,9 +1322,31 @@ function subscribeToFeed() { break; case 2: case 3: - case 4: alert(__("Can't subscribe to the specified URL.")); break; + case 4: + new Ajax.Request("backend.php", { + parameters: 'op=rpc&subop=extractfeedurls&url=' + encodeURIComponent(feed_url), + onComplete: function(transport) { + var result = transport.responseXML.getElementsByTagName('urls')[0]; + var feeds = JSON.parse(result.firstChild.nodeValue); + var select = document.getElementById("faad_feeds_container_select"); + + while (select.hasChildNodes()) { + select.removeChild(elem.firstChild); + } + var count = 0; + for (var feedUrl in feeds) { + select.insert(new Option(feeds[feedUrl], feedUrl, false)); + count++; + } + if (count > 5) count = 5; + select.size = count; + + Effect.Appear('fadd_feeds_container', {duration : 0.5}); + } + }); + break; case 0: alert(__("You are already subscribed to this feed.")); break; |