From a2e6d2da24a259ae9fa10d820df6142e524c387a Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 20 Jul 2011 14:05:28 -0700 Subject: [PATCH] IRC Updating --- 4chan_x.user.js | 10 ++++++---- script.coffee | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c800a412a..c7972c2b2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -89,6 +89,7 @@ }, Monitoring: { 'Thread Updater': [true, 'Update threads'], + 'IRC Updating': [false, 'Scroll updated posts into view'], 'Unread Count': [true, 'Show unread post count in tab title'], 'Post in Title': [true, 'Show the op\'s post in the tab title'], 'Thread Stats': [true, 'Display reply and image count'], @@ -1617,7 +1618,7 @@ } }, update: function(e) { - var arr, body, br, id, input, replies, reply, _i, _len, _ref, _ref2, _results; + var arr, body, br, id, input, replies, reply, _i, _len, _ref, _ref2; if (this.status === 404) { updater.timer.textContent = ''; updater.count.textContent = 404; @@ -1653,11 +1654,12 @@ updater.count.className = 'new'; } } - _results = []; while (reply = arr.pop()) { - _results.push($.before(br, reply)); + $.before(br, reply); + } + if ($.config('IRC Updating')) { + return scrollTo(0, d.body.scrollHeight); } - return _results; } }, timeout: function() { diff --git a/script.coffee b/script.coffee index b25dba969..6e4b4b10b 100644 --- a/script.coffee +++ b/script.coffee @@ -23,6 +23,7 @@ config = 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] Monitoring: 'Thread Updater': [true, 'Update threads'] + 'IRC Updating': [false, 'Scroll updated posts into view'] 'Unread Count': [true, 'Show unread post count in tab title'] 'Post in Title': [true, 'Show the op\'s post in the tab title'] 'Thread Stats': [true, 'Display reply and image count'] @@ -1348,9 +1349,11 @@ updater = else updater.count.className = 'new' - #XXX add replies in correct order so /b/acklinks resolve + #XXX add replies in correct order so backlinks resolve while reply = arr.pop() $.before br, reply + if $.config 'IRC Updating' + scrollTo 0, d.body.scrollHeight timeout: -> n = Number updater.timer.textContent