diff --git a/4chan_x.user.js b/4chan_x.user.js index eb4452cca..3542bd3ae 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2116,6 +2116,7 @@ }; opts = { form: $.formData(post), + responseType: 'document', upCallbacks: { onload: function() { return QR.status({ @@ -2131,10 +2132,14 @@ }; return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts); }, - response: function(html) { + response: function(response) { var bs, doc, err, msg, persona, postNumber, reply, thread, _, _ref; - doc = d.implementation.createHTMLDocument(''); - doc.documentElement.innerHTML = html; + if ($.engine === 'presto') { + doc = d.implementation.createHTMLDocument(''); + doc.documentElement.innerHTML = response; + } else { + doc = response; + } if (doc.title === '4chan - Banned') { bs = $$('b', doc); err = $.el('span', { @@ -3743,13 +3748,18 @@ return DeleteButton.error(self); } }, { - form: $.formData(form) + form: $.formData(form), + responseType: 'document' }); }, - load: function(self, html) { + load: function(self, response) { var doc, msg, s; - doc = d.implementation.createHTMLDocument(''); - doc.documentElement.innerHTML = html; + if ($.engine === 'presto') { + doc = d.implementation.createHTMLDocument(''); + doc.documentElement.innerHTML = response; + } else { + doc = response; + } if (doc.title === '4chan - Banned') { s = 'Banned!'; } else if (msg = doc.getElementById('errmsg')) { diff --git a/script.coffee b/script.coffee index 07b9bd8f9..41c310479 100644 --- a/script.coffee +++ b/script.coffee @@ -1605,6 +1605,7 @@ QR = textContent: 'Connection error, or you are banned.' opts = form: $.formData post + responseType: 'document' upCallbacks: onload: -> # Upload done, waiting for response. @@ -1615,9 +1616,12 @@ QR = QR.ajax = $.ajax $.id('postForm').parentNode.action, callbacks, opts - response: (html) -> - doc = d.implementation.createHTMLDocument '' - doc.documentElement.innerHTML = html + response: (response) -> + if $.engine is 'presto' + doc = d.implementation.createHTMLDocument '' + doc.documentElement.innerHTML = response + else + doc = response if doc.title is '4chan - Banned' # Ban/warn check bs = $$ 'b', doc err = $.el 'span', @@ -2937,11 +2941,15 @@ DeleteButton = onerror: -> DeleteButton.error self }, { form: $.formData form + responseType: 'document' } - load: (self, html) -> - doc = d.implementation.createHTMLDocument '' - doc.documentElement.innerHTML = html + load: (self, response) -> + if $.engine is 'presto' + doc = d.implementation.createHTMLDocument '' + doc.documentElement.innerHTML = response + else + doc = response if doc.title is '4chan - Banned' # Ban/warn check s = 'Banned!' else if msg = doc.getElementById 'errmsg' # error!