Use xhr.responseType = 'document'.
This commit is contained in:
parent
39f30c1d0e
commit
773f2cfe0f
@ -55,21 +55,20 @@ DeleteLink =
|
|||||||
|
|
||||||
link = @
|
link = @
|
||||||
$.ajax $.id('delform').action.replace("/#{g.BOARD}/", "/#{post.board}/"),
|
$.ajax $.id('delform').action.replace("/#{g.BOARD}/", "/#{post.board}/"),
|
||||||
|
responseType: 'document'
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
onload: -> DeleteLink.load link, post, fileOnly, @response
|
onload: -> DeleteLink.load link, post, fileOnly, @response
|
||||||
onerror: -> DeleteLink.error link
|
onerror: -> DeleteLink.error link
|
||||||
,
|
,
|
||||||
form: $.formData form
|
form: $.formData form
|
||||||
load: (link, post, fileOnly, html) ->
|
load: (link, post, fileOnly, resDoc) ->
|
||||||
tmpDoc = d.implementation.createHTMLDocument ''
|
if resDoc.title is '4chan - Banned' # Ban/warn check
|
||||||
tmpDoc.documentElement.innerHTML = html
|
|
||||||
if tmpDoc.title is '4chan - Banned' # Ban/warn check
|
|
||||||
s = 'Banned!'
|
s = 'Banned!'
|
||||||
else if msg = tmpDoc.getElementById 'errmsg' # error!
|
else if msg = resDoc.getElementById 'errmsg' # error!
|
||||||
s = msg.textContent
|
s = msg.textContent
|
||||||
$.on link, 'click', DeleteLink.delete
|
$.on link, 'click', DeleteLink.delete
|
||||||
else
|
else
|
||||||
if tmpDoc.title is 'Updating index...'
|
if resDoc.title is 'Updating index...'
|
||||||
# We're 100% sure.
|
# We're 100% sure.
|
||||||
(post.origin or post).kill fileOnly
|
(post.origin or post).kill fileOnly
|
||||||
s = 'Deleted'
|
s = 'Deleted'
|
||||||
|
|||||||
@ -960,6 +960,7 @@ QR =
|
|||||||
recaptcha_response_field: response
|
recaptcha_response_field: response
|
||||||
|
|
||||||
options =
|
options =
|
||||||
|
responseType: 'document'
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
onload: QR.response
|
onload: QR.response
|
||||||
onerror: ->
|
onerror: ->
|
||||||
@ -1002,20 +1003,23 @@ QR =
|
|||||||
post = QR.posts[0]
|
post = QR.posts[0]
|
||||||
post.unlock()
|
post.unlock()
|
||||||
|
|
||||||
tmpDoc = d.implementation.createHTMLDocument ''
|
resDoc = req.response
|
||||||
tmpDoc.documentElement.innerHTML = req.response
|
if ban = $ '.banType', resDoc # banned/warning
|
||||||
if ban = $ '.banType', tmpDoc # banned/warning
|
board = $('.board', resDoc).innerHTML
|
||||||
board = $('.board', tmpDoc).innerHTML
|
|
||||||
err = $.el 'span', innerHTML:
|
err = $.el 'span', innerHTML:
|
||||||
if ban.textContent.toLowerCase() is 'banned'
|
if ban.textContent.toLowerCase() is 'banned'
|
||||||
"You are banned on #{board}! ;_;<br>" +
|
"""
|
||||||
"Click <a href=//www.4chan.org/banned target=_blank>here</a> to see the reason."
|
You are banned on #{board}! ;_;<br>
|
||||||
|
Click <a href=//www.4chan.org/banned target=_blank>here</a> to see the reason.
|
||||||
|
"""
|
||||||
else
|
else
|
||||||
"You were issued a warning on #{board} as #{$('.nameBlock', tmpDoc).innerHTML}.<br>" +
|
"""
|
||||||
"Reason: #{$('.reason', tmpDoc).innerHTML}"
|
You were issued a warning on #{board} as #{$('.nameBlock', resDoc).innerHTML}.<br>
|
||||||
else if err = tmpDoc.getElementById 'errmsg' # error!
|
Reason: #{$('.reason', resDoc).innerHTML}
|
||||||
|
"""
|
||||||
|
else if err = resDoc.getElementById 'errmsg' # error!
|
||||||
$('a', err)?.target = '_blank' # duplicate image link
|
$('a', err)?.target = '_blank' # duplicate image link
|
||||||
else if tmpDoc.title isnt 'Post successful!'
|
else if resDoc.title isnt 'Post successful!'
|
||||||
err = 'Connection error with sys.4chan.org.'
|
err = 'Connection error with sys.4chan.org.'
|
||||||
else if req.status isnt 200
|
else if req.status isnt 200
|
||||||
err = "Error #{req.statusText} (#{req.status})"
|
err = "Error #{req.statusText} (#{req.status})"
|
||||||
@ -1049,7 +1053,7 @@ QR =
|
|||||||
QR.error err
|
QR.error err
|
||||||
return
|
return
|
||||||
|
|
||||||
h1 = $ 'h1', tmpDoc
|
h1 = $ 'h1', resDoc
|
||||||
QR.cleanNotifications()
|
QR.cleanNotifications()
|
||||||
QR.notifications.push new Notification 'success', h1.textContent, 5
|
QR.notifications.push new Notification 'success', h1.textContent, 5
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user