summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-01-28 12:45:49 +0300
committerAndrew Dolgov <[email protected]>2017-01-28 12:45:49 +0300
commit24c7e4132d4212e996de251c6e0fb313ea34b4c3 (patch)
tree04d0b5fd86331ae91c1f68f51c16cb432e6a0333 /js
parent80fbc1fdc43746ee210a9aaaa5e01c6603f8e665 (diff)
subscribe dialog: do not report errors via alert()
fetch_file_contents: reset all globals on start, return error message body when not using curl subscribe_to_feed: report if cloudflare is in the error message
Diffstat (limited to 'js')
-rwxr-xr-xjs/functions.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/js/functions.js b/js/functions.js
index 63ff4121b..db18ac6dd 100755
--- a/js/functions.js
+++ b/js/functions.js
@@ -804,6 +804,15 @@ function quickAddFeed() {
id: "feedAddDlg",
title: __("Subscribe to Feed"),
style: "width: 600px",
+ show_error: function(msg) {
+ var elem = $("fadd_error_message");
+
+ elem.innerHTML = msg;
+
+ if (!Element.visible(elem))
+ new Effect.Appear(elem);
+
+ },
execute: function() {
if (this.validate()) {
console.log(dojo.objectToQuery(this.attr('value')));
@@ -811,6 +820,7 @@ function quickAddFeed() {
var feed_url = this.attr('value').feed;
Element.show("feed_add_spinner");
+ Element.hide("fadd_error_message");
new Ajax.Request("backend.php", {
parameters: dojo.objectToQuery(this.attr('value')),
@@ -841,10 +851,10 @@ function quickAddFeed() {
updateFeedList();
break;
case 2:
- alert(__("Specified URL seems to be invalid."));
+ dialog.show_error(__("Specified URL seems to be invalid."));
break;
case 3:
- alert(__("Specified URL doesn't seem to contain any feeds."));
+ dialog.show_error(__("Specified URL doesn't seem to contain any feeds."));
break;
case 4:
feeds = rc['feeds'];
@@ -868,16 +878,16 @@ function quickAddFeed() {
break;
case 5:
- alert(__("Couldn't download the specified URL: %s").
+ dialog.show_error(__("Couldn't download the specified URL: %s").
replace("%s", rc['message']));
break;
case 6:
- alert(__("XML validation failed: %s").
+ dialog.show_error(__("XML validation failed: %s").
replace("%s", rc['message']));
break;
break;
case 0:
- alert(__("You are already subscribed to this feed."));
+ dialog.show_error(__("You are already subscribed to this feed."));
break;
}