Try to get some better errors out of QR.req.onerror

Conflicts:
	builds/4chan-X.user.js
	builds/crx/script.js
	src/General/css/layout.css
This commit is contained in:
Zixaphir 2014-01-19 15:18:57 -07:00
parent 3a61ecafff
commit a993b440dc
4 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.3.2 - 2014-01-18 * 4chan X - Version 1.3.2 - 2014-01-19
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -22,7 +22,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.3.2 - 2014-01-18 * 4chan X - Version 1.3.2 - 2014-01-19
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -6212,11 +6212,14 @@
responseType: 'document', responseType: 'document',
withCredentials: true, withCredentials: true,
onload: QR.response, onload: QR.response,
onerror: function() { onerror: function(err, url, line) {
delete QR.req; delete QR.req;
post.unlock(); post.unlock();
QR.cooldown.auto = false; QR.cooldown.auto = false;
QR.status(); QR.status();
console.log(err);
console.log(url);
console.log(line);
return QR.error($.el('span', { return QR.error($.el('span', {
innerHTML: "4chan X encountered an error while posting. \n[<a href=\"//4chan.org/banned\" target=_blank>Banned?</a>] [<a href=\"https://github.com/seaweedchan/4chan-x/wiki/Frequently-Asked-Questions#what-does-4chan-x-encountered-an-error-while-posting-please-try-again-mean\" target=_blank>More info</a>]" innerHTML: "4chan X encountered an error while posting. \n[<a href=\"//4chan.org/banned\" target=_blank>Banned?</a>] [<a href=\"https://github.com/seaweedchan/4chan-x/wiki/Frequently-Asked-Questions#what-does-4chan-x-encountered-an-error-while-posting-please-try-again-mean\" target=_blank>More info</a>]"
})); }));

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* 4chan X - Version 1.3.2 - 2014-01-18 * 4chan X - Version 1.3.2 - 2014-01-19
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -6203,11 +6203,14 @@
responseType: 'document', responseType: 'document',
withCredentials: true, withCredentials: true,
onload: QR.response, onload: QR.response,
onerror: function() { onerror: function(err, url, line) {
delete QR.req; delete QR.req;
post.unlock(); post.unlock();
QR.cooldown.auto = false; QR.cooldown.auto = false;
QR.status(); QR.status();
console.log(err);
console.log(url);
console.log(line);
return QR.error($.el('span', { return QR.error($.el('span', {
innerHTML: "4chan X encountered an error while posting. \n[<a href=\"//4chan.org/banned\" target=_blank>Banned?</a>] [<a href=\"https://github.com/seaweedchan/4chan-x/wiki/Frequently-Asked-Questions#what-does-4chan-x-encountered-an-error-while-posting-please-try-again-mean\" target=_blank>More info</a>]" innerHTML: "4chan X encountered an error while posting. \n[<a href=\"//4chan.org/banned\" target=_blank>Banned?</a>] [<a href=\"https://github.com/seaweedchan/4chan-x/wiki/Frequently-Asked-Questions#what-does-4chan-x-encountered-an-error-while-posting-please-try-again-mean\" target=_blank>More info</a>]"
})); }));

View File

@ -590,13 +590,15 @@ QR =
responseType: 'document' responseType: 'document'
withCredentials: true withCredentials: true
onload: QR.response onload: QR.response
onerror: -> onerror: (err, url, line) ->
# Connection error, or # Connection error, or www.4chan.org/banned
# www.4chan.org/banned
delete QR.req delete QR.req
post.unlock() post.unlock()
QR.cooldown.auto = false QR.cooldown.auto = false
QR.status() QR.status()
console.log err
console.log url
console.log line
QR.error $.el 'span', QR.error $.el 'span',
innerHTML: """ innerHTML: """
4chan X encountered an error while posting. 4chan X encountered an error while posting.