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
});
if ($('title', doc).textContent === '4chan - Banned') {
QR.status({
ready: true,
banned: true
QR.message.receive({
req: 'banned'
});
return;
}
@ -1995,6 +1994,16 @@
return QR.response(data.html);
case 'status':
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:
return QR.message.post(data);
}
@ -2063,9 +2072,7 @@
},
onerror: function() {
return QR.message.send({
req: 'status',
ready: true,
banned: true
req: 'banned'
});
}
};
@ -3816,9 +3823,7 @@
case 'www.4chan.org':
if (path === '/banned') {
QR.message.send({
req: 'status',
ready: true,
banned: true
req: 'banned'
});
}
return;

View File

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