summaryrefslogtreecommitdiff
path: root/js/ajax.js
diff options
context:
space:
mode:
authorSimon McFarlane <simon@piston.pw>2015-05-26 23:31:47 -0700
committerSimon McFarlane <simon@piston.pw>2015-05-29 01:34:53 -0700
commit4b40f69a4e6d190f6d342875bd084c2a6c9d8b0f (patch)
treefcc5dc9efa24afcb0bda3740b59f0c4e81c42f62 /js/ajax.js
parent2ac451ecb7aaae1ed1402425b8df6a5cb9831f2b (diff)
parentd20149b57929c27da87a7d9603d85717da15c5bc (diff)
Merge remote-tracking branch 'upstream/master' into vichan-merge
Diffstat (limited to 'js/ajax.js')
-rw-r--r--js/ajax.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/js/ajax.js b/js/ajax.js
index 4501cef2..56f0df5c 100644
--- a/js/ajax.js
+++ b/js/ajax.js
@@ -107,6 +107,7 @@ $(window).ready(function() {
}, 'html');
}
$(form).find('input[type="submit"]').val(_('Posted...'));
+ $(document).trigger("ajax_after_post", post_response);
} else {
alert(_('An unknown error occured when posting!'));
$(form).find('input[type="submit"]').val(submit_txt);
@@ -114,17 +115,10 @@ $(window).ready(function() {
}
},
error: function(xhr, status, er) {
- // An error occured
- do_not_ajax = true;
- $(form).find('input[type="submit"]').each(function() {
- var $replacement = $('<input type="hidden">');
- $replacement.attr('name', $(this).attr('name'));
- $replacement.val(submit_txt);
- $(this)
- .after($replacement)
- .replaceWith($('<input type="button">').val(submit_txt));
- });
- $(form).submit();
+ console.log(xhr);
+ alert(_('The server took too long to submit your post. Your post was probably still submitted. If it wasn\'t, we might be experiencing issues right now -- please try your post again later. Error information: ') + "<div><textarea>" + JSON.stringify(xhr) + "</textarea></div>");
+ $(form).find('input[type="submit"]').val(submit_txt);
+ $(form).find('input[type="submit"]').removeAttr('disabled');
},
data: formData,
cache: false,
@@ -140,6 +134,7 @@ $(window).ready(function() {
};
setup_form($('form[name="post"]'));
$(window).on('quick-reply', function() {
+ $('form#quick-reply').off('submit');
setup_form($('form#quick-reply'));
});
});