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