diff --git a/src/Menu/DeleteLink.coffee b/src/Menu/DeleteLink.coffee index b7678e48a..1912733c6 100644 --- a/src/Menu/DeleteLink.coffee +++ b/src/Menu/DeleteLink.coffee @@ -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' diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 6a1d339d9..fc7b0357b 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -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}! ;_;
" + - "Click here to see the reason." + """ + You are banned on #{board}! ;_;
+ Click here to see the reason. + """ else - "You were issued a warning on #{board} as #{$('.nameBlock', tmpDoc).innerHTML}.
" + - "Reason: #{$('.reason', tmpDoc).innerHTML}" - else if err = tmpDoc.getElementById 'errmsg' # error! + """ + You were issued a warning on #{board} as #{$('.nameBlock', resDoc).innerHTML}.
+ 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