From 41bf1934adb5951dbd97519b6dbb162fb22263f8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 8 Oct 2011 23:18:23 +0200 Subject: [PATCH] Handle bans with the updater. --- 4chan_x.user.js | 11 ++++++++--- script.coffee | 12 ++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2238bd7e9..ad8177618 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1994,17 +1994,22 @@ Favicon.update(); return; } - id = Number(((_ref2 = $('td[id]', updater.br.previousElementSibling)) != null ? _ref2.id : void 0) || 0); - arr = []; + updater.timer.textContent = '-' + conf['Interval']; body = $.el('body', { innerHTML: this.responseText }); + if ($('title', body).textContent === '4chan - Banned') { + updater.count.textContent = 'banned'; + updater.count.className = 'error'; + return; + } replies = $$('.reply', body); + id = Number(((_ref2 = $('td[id]', updater.br.previousElementSibling)) != null ? _ref2.id : void 0) || 0); + arr = []; while ((reply = replies.pop()) && (reply.id > id)) { arr.push(reply.parentNode.parentNode.parentNode); } scroll = conf['Scrolling'] && updater.focus && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20); - updater.timer.textContent = '-' + conf['Interval']; if (conf['Verbose']) { updater.count.textContent = '+' + arr.length; if (arr.length === 0) { diff --git a/script.coffee b/script.coffee index 6ec3bde6e..55ec87894 100644 --- a/script.coffee +++ b/script.coffee @@ -1499,18 +1499,22 @@ updater = Favicon.update() return - id = Number $('td[id]', updater.br.previousElementSibling)?.id or 0 + updater.timer.textContent = '-' + conf['Interval'] - arr = [] body = $.el 'body', innerHTML: @responseText + if $('title', body).textContent is '4chan - Banned' + updater.count.textContent = 'banned' + updater.count.className = 'error' + return + replies = $$ '.reply', body + id = Number $('td[id]', updater.br.previousElementSibling)?.id or 0 + arr = [] while (reply = replies.pop()) and (reply.id > id) arr.push reply.parentNode.parentNode.parentNode #table scroll = conf['Scrolling'] && updater.focus && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20) - - updater.timer.textContent = '-' + conf['Interval'] if conf['Verbose'] updater.count.textContent = '+' + arr.length if arr.length is 0