QR and Delete Button responseType: document.

This commit is contained in:
Nicolas Stepien 2012-06-20 22:30:15 +02:00
parent 32433cf6d9
commit b126ffadab
2 changed files with 31 additions and 13 deletions

View File

@ -2116,6 +2116,7 @@
}; };
opts = { opts = {
form: $.formData(post), form: $.formData(post),
responseType: 'document',
upCallbacks: { upCallbacks: {
onload: function() { onload: function() {
return QR.status({ return QR.status({
@ -2131,10 +2132,14 @@
}; };
return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts); 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; var bs, doc, err, msg, persona, postNumber, reply, thread, _, _ref;
doc = d.implementation.createHTMLDocument(''); if ($.engine === 'presto') {
doc.documentElement.innerHTML = html; doc = d.implementation.createHTMLDocument('');
doc.documentElement.innerHTML = response;
} else {
doc = response;
}
if (doc.title === '4chan - Banned') { if (doc.title === '4chan - Banned') {
bs = $$('b', doc); bs = $$('b', doc);
err = $.el('span', { err = $.el('span', {
@ -3743,13 +3748,18 @@
return DeleteButton.error(self); return DeleteButton.error(self);
} }
}, { }, {
form: $.formData(form) form: $.formData(form),
responseType: 'document'
}); });
}, },
load: function(self, html) { load: function(self, response) {
var doc, msg, s; var doc, msg, s;
doc = d.implementation.createHTMLDocument(''); if ($.engine === 'presto') {
doc.documentElement.innerHTML = html; doc = d.implementation.createHTMLDocument('');
doc.documentElement.innerHTML = response;
} else {
doc = response;
}
if (doc.title === '4chan - Banned') { if (doc.title === '4chan - Banned') {
s = 'Banned!'; s = 'Banned!';
} else if (msg = doc.getElementById('errmsg')) { } else if (msg = doc.getElementById('errmsg')) {

View File

@ -1605,6 +1605,7 @@ QR =
textContent: 'Connection error, or you are banned.' textContent: 'Connection error, or you are banned.'
opts = opts =
form: $.formData post form: $.formData post
responseType: 'document'
upCallbacks: upCallbacks:
onload: -> onload: ->
# Upload done, waiting for response. # Upload done, waiting for response.
@ -1615,9 +1616,12 @@ QR =
QR.ajax = $.ajax $.id('postForm').parentNode.action, callbacks, opts QR.ajax = $.ajax $.id('postForm').parentNode.action, callbacks, opts
response: (html) -> response: (response) ->
doc = d.implementation.createHTMLDocument '' if $.engine is 'presto'
doc.documentElement.innerHTML = html doc = d.implementation.createHTMLDocument ''
doc.documentElement.innerHTML = response
else
doc = response
if doc.title is '4chan - Banned' # Ban/warn check if doc.title is '4chan - Banned' # Ban/warn check
bs = $$ 'b', doc bs = $$ 'b', doc
err = $.el 'span', err = $.el 'span',
@ -2937,11 +2941,15 @@ DeleteButton =
onerror: -> DeleteButton.error self onerror: -> DeleteButton.error self
}, { }, {
form: $.formData form form: $.formData form
responseType: 'document'
} }
load: (self, html) -> load: (self, response) ->
doc = d.implementation.createHTMLDocument '' if $.engine is 'presto'
doc.documentElement.innerHTML = html doc = d.implementation.createHTMLDocument ''
doc.documentElement.innerHTML = response
else
doc = response
if doc.title is '4chan - Banned' # Ban/warn check if doc.title is '4chan - Banned' # Ban/warn check
s = 'Banned!' s = 'Banned!'
else if msg = doc.getElementById 'errmsg' # error! else if msg = doc.getElementById 'errmsg' # error!