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 = {
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')) {

View File

@ -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!