Fix warning.

This commit is contained in:
Nicolas Stepien 2012-12-14 18:13:15 +01:00
parent 9f18c25805
commit 5ffb6168cb
3 changed files with 14 additions and 12 deletions

View File

@ -2609,13 +2609,13 @@
return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts);
},
response: function(html) {
var bs, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1;
var ban, board, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1;
doc = d.implementation.createHTMLDocument('');
doc.documentElement.innerHTML = html;
if (doc.title === '4chan - Banned') {
bs = $$('b', doc);
if (ban = $('.banType', doc)) {
board = $('.board', doc).innerHTML;
err = $.el('span', {
innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".<br>Warning reason: " + bs[1].innerHTML : "You are banned! ;_;<br>Please click <a href=//www.4chan.org/banned target=_blank>HERE</a> to see the reason."
innerHTML: ban.textContent.toLowerCase() === 'banned' ? ("You are banned on " + board + "! ;_;<br>") + "Click <a href=//www.4chan.org/banned target=_blank>here</a> to see the reason." : ("You were issued a warning on " + board + " as " + ($('.nameBlock', doc).innerHTML) + ".<br>") + ("Reason: " + ($('.reason', doc).innerHTML))
});
} else if (err = doc.getElementById('errmsg')) {
if ((_ref = $('a', err)) != null) {

View File

@ -2,6 +2,7 @@ master
- Mayhem
Fix selection quoting on Opera.
Fix history bug with Persistent QR enabled on Chrome.
Fix posting warning not displaying the reason.
2.37.0
- noface

View File

@ -2058,14 +2058,15 @@ QR =
response: (html) ->
doc = d.implementation.createHTMLDocument ''
doc.documentElement.innerHTML = html
if doc.title is '4chan - Banned' # Ban/warn check
bs = $$ 'b', doc
err = $.el 'span',
innerHTML:
if /^You were issued a warning/.test $('.boxcontent', doc).textContent.trim()
"You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.<br>Warning reason: #{bs[1].innerHTML}"
else
"You are banned! ;_;<br>Please click <a href=//www.4chan.org/banned target=_blank>HERE</a> to see the reason."
if ban = $ '.banType', doc # banned/warning
board = $('.board', doc).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."
else
"You were issued a warning on #{board} as #{$('.nameBlock', doc).innerHTML}.<br>" +
"Reason: #{$('.reason', doc).innerHTML}"
else if err = doc.getElementById 'errmsg' # error!
$('a', err)?.target = '_blank' # duplicate image link
else unless msg = $ 'b', doc