From 6fc4c02c4e152ac8c5faf962bf3a3813d88cd2e2 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 18 Oct 2014 15:31:48 +0200 Subject: ajax.js: add ajax_after_post event --- js/ajax.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/ajax.js') diff --git a/js/ajax.js b/js/ajax.js index 4501cef2..61d83df2 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); -- cgit v1.3 From 4083c92dbe641f81c1b92fa33dd111199d5654b0 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 8 Nov 2014 16:56:41 -0800 Subject: Stop double posting AJAX bug --- js/ajax.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/ajax.js') diff --git a/js/ajax.js b/js/ajax.js index 61d83df2..663f4426 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -141,6 +141,7 @@ $(window).ready(function() { }; setup_form($('form[name="post"]')); $(window).on('quick-reply', function() { + $('form#quick-reply').off('submit'); setup_form($('form#quick-reply')); }); }); -- cgit v1.3 From d3cc27ff5cf598ead9d0045077f69ec73bb470c6 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 17 Nov 2014 05:23:41 -0800 Subject: Handle XHR errors better --- js/ajax.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'js/ajax.js') diff --git a/js/ajax.js b/js/ajax.js index 663f4426..1b2bf2c0 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -115,17 +115,7 @@ $(window).ready(function() { } }, error: function(xhr, status, er) { - // An error occured - do_not_ajax = true; - $(form).find('input[type="submit"]').each(function() { - var $replacement = $(''); - $replacement.attr('name', $(this).attr('name')); - $replacement.val(submit_txt); - $(this) - .after($replacement) - .replaceWith($('').val(submit_txt)); - }); - $(form).submit(); + alert(_('The server returned an error or truncated response -- your post was probably still submitted. If it wasn\'t, 8chan.co might be experiencing issues right now -- please try your post again later.')); }, data: formData, cache: false, -- cgit v1.3 From 0f1d506586c2553852cb88204a3e529abace6f78 Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 11 Mar 2015 02:58:03 -0700 Subject: Change this message again Conflicts: js/ajax.js --- js/ajax.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/ajax.js') diff --git a/js/ajax.js b/js/ajax.js index 1b2bf2c0..56f0df5c 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -115,7 +115,10 @@ $(window).ready(function() { } }, error: function(xhr, status, er) { - alert(_('The server returned an error or truncated response -- your post was probably still submitted. If it wasn\'t, 8chan.co might be experiencing issues right now -- please try your post again later.')); + 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: ') + "
"); + $(form).find('input[type="submit"]').val(submit_txt); + $(form).find('input[type="submit"]').removeAttr('disabled'); }, data: formData, cache: false, -- cgit v1.3