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); return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts);
}, },
response: function(html) { 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 = d.implementation.createHTMLDocument('');
doc.documentElement.innerHTML = html; doc.documentElement.innerHTML = html;
if (doc.title === '4chan - Banned') { if (ban = $('.banType', doc)) {
bs = $$('b', doc); board = $('.board', doc).innerHTML;
err = $.el('span', { 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')) { } else if (err = doc.getElementById('errmsg')) {
if ((_ref = $('a', err)) != null) { if ((_ref = $('a', err)) != null) {

View File

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

View File

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