Add a ban error link to the QR if you're/when you get banned.

This commit is contained in:
Nicolas Stepien 2012-03-26 04:12:24 +02:00
parent 7ac8f016f3
commit d03d6e9db6
2 changed files with 24 additions and 12 deletions

View File

@ -1907,9 +1907,8 @@
innerHTML: html innerHTML: html
}); });
if ($('title', doc).textContent === '4chan - Banned') { if ($('title', doc).textContent === '4chan - Banned') {
QR.status({ QR.message.receive({
ready: true, req: 'banned'
banned: true
}); });
return; return;
} }
@ -1995,6 +1994,16 @@
return QR.response(data.html); return QR.response(data.html);
case 'status': case 'status':
return QR.status(data); return QR.status(data);
case 'banned':
QR.error('You are banned.', $.el('a', {
href: 'http://www.4chan.org/banned',
target: '_blank',
textContent: 'You are banned.'
}));
return QR.status({
ready: true,
banned: true
});
default: default:
return QR.message.post(data); return QR.message.post(data);
} }
@ -2063,9 +2072,7 @@
}, },
onerror: function() { onerror: function() {
return QR.message.send({ return QR.message.send({
req: 'status', req: 'banned'
ready: true,
banned: true
}); });
} }
}; };
@ -3816,9 +3823,7 @@
case 'www.4chan.org': case 'www.4chan.org':
if (path === '/banned') { if (path === '/banned') {
QR.message.send({ QR.message.send({
req: 'status', req: 'banned'
ready: true,
banned: true
}); });
} }
return; return;

View File

@ -1592,7 +1592,7 @@ QR =
doc = $.el 'a', innerHTML: html doc = $.el 'a', innerHTML: html
# Check for ban. # Check for ban.
if $('title', doc).textContent is '4chan - Banned' if $('title', doc).textContent is '4chan - Banned'
QR.status ready: true, banned: true QR.message.receive req: 'banned'
return return
unless b = $ 'td b', doc unless b = $ 'td b', doc
err = 'Connection error with sys.4chan.org.' err = 'Connection error with sys.4chan.org.'
@ -1676,6 +1676,13 @@ QR =
QR.response data.html QR.response data.html
when 'status' when 'status'
QR.status data QR.status data
when 'banned'
QR.error 'You are banned.', $.el 'a',
href: 'http://www.4chan.org/banned'
target: '_blank'
textContent: 'You are banned.'
# Disable iframe reloading
QR.status ready: true, banned: true
else else
QR.message.post data # Reply object: we're posting QR.message.post data # Reply object: we're posting
@ -1736,7 +1743,7 @@ QR =
html: @response html: @response
onerror: -> onerror: ->
# CORS disabled error: redirecting to banned page ;_; # CORS disabled error: redirecting to banned page ;_;
QR.message.send req: 'status', ready: true, banned: true QR.message.send req: 'banned'
opts = opts =
form: form form: form
type: 'post' type: 'post'
@ -3166,7 +3173,7 @@ Main =
return return
when 'www.4chan.org' when 'www.4chan.org'
if path is '/banned' if path is '/banned'
QR.message.send req: 'status', ready: true, banned: true QR.message.send req: 'banned'
return return
when 'images.4chan.org' when 'images.4chan.org'
$.ready -> Redirect.init() if d.title is '4chan - 404' $.ready -> Redirect.init() if d.title is '4chan - 404'