diff --git a/4chan_x.user.js b/4chan_x.user.js index de50674ef..81bddb99f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2079,6 +2079,13 @@ req: 'response', html: this.response }); + }, + onerror: function() { + return qr.message.send({ + req: 'status', + ready: true, + banned: true + }); } }; opts = { @@ -2104,17 +2111,7 @@ 'Content-Type': 'multipart/form-data;boundary=' + boundary }; } - try { - return qr.ajax = $.ajax(url, callbacks, opts); - } catch (e) { - if (e.name === 'NETWORK_ERR') { - return qr.message.send({ - req: 'status', - ready: true, - banned: true - }); - } - } + return qr.ajax = $.ajax(url, callbacks, opts); } } }; diff --git a/script.coffee b/script.coffee index 5b97558aa..7eaaff73d 100644 --- a/script.coffee +++ b/script.coffee @@ -1747,6 +1747,9 @@ qr = qr.message.send req: 'response' html: @response + onerror: -> + # CORS disabled error: redirecting to banned page ;_; + qr.message.send req: 'status', ready: true, banned: true opts = form: form type: 'post' @@ -1763,12 +1766,7 @@ qr = opts.headers = 'Content-Type': 'multipart/form-data;boundary=' + boundary - try - qr.ajax = $.ajax url, callbacks, opts - catch e - # CORS disabled error: redirecting to banned page ;_; - if e.name is 'NETWORK_ERR' - qr.message.send req: 'status', ready: true, banned: true + qr.ajax = $.ajax url, callbacks, opts Options = init: ->