From eb59ecd63dd941c5bb30566f0718e593ec62ec50 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 7 May 2011 14:56:42 -0700 Subject: [PATCH] tweak auto watch reply --- 4chan_x.js | 19 ++++++++----------- script.coffee | 13 ++++++------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index edc3e6582..63842c7b6 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -71,6 +71,7 @@ '404 Redirect': [true, 'Redirect dead threads'], 'Anonymize': [false, 'Make everybody anonymous'], 'Auto Watch': [true, 'Automatically watch threads that you start'], + 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'], 'Comment Expansion': [true, 'Expand too long comments'], 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], 'Image Auto-Gif': [false, 'Animate gif thumbnails'], @@ -91,8 +92,7 @@ 'Thread Navigation': [true, 'Navigate to previous / next thread'], 'Thread Updater': [true, 'Update threads'], 'Thread Watcher': [true, 'Bookmark threads'], - 'Unread Count': [true, 'Show unread post count in tab title'], - 'Watch on Reply': [false, 'Automatically watch threads you reply to'] + 'Unread Count': [true, 'Show unread post count in tab title'] }, textarea: { flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url='].join('\n') @@ -1023,20 +1023,17 @@ return _results; }, submit: function(e) { - var form, isQR, recaptcha, span, thread, threads, value, _i, _len; + var form, id, isQR, op, recaptcha, span; form = e.target; isQR = form.parentNode.id === 'qr'; - if ($.config('Watch on Reply') && $.config('Thread Watcher')) { + if ($.config('Auto Watch Reply') && $.config('Thread Watcher')) { if (g.REPLY && $('img.favicon').src === Favicon.empty) { watcher.watch(null, g.THREAD_ID); } else { - value = $('input[name=resto]').value; - threads = $$('div.op'); - for (_i = 0, _len = threads.length; _i < _len; _i++) { - thread = threads[_i]; - if (thread.id === value && $('img.favicon', thread).src === Favicon.empty) { - watcher.watch(thread, value); - } + id = $('input[name=resto]').value; + op = d.getElementById(id); + if ($('img.favicon', op).src === Favicon.empty) { + watcher.watch(op, id); } } } diff --git a/script.coffee b/script.coffee index 892b2e7e8..c50272e40 100644 --- a/script.coffee +++ b/script.coffee @@ -15,6 +15,7 @@ config = '404 Redirect': [true, 'Redirect dead threads'] 'Anonymize': [false, 'Make everybody anonymous'] 'Auto Watch': [true, 'Automatically watch threads that you start'] + 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] 'Comment Expansion': [true, 'Expand too long comments'] 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] 'Image Auto-Gif': [false, 'Animate gif thumbnails'] @@ -36,7 +37,6 @@ config = 'Thread Updater': [true, 'Update threads'] 'Thread Watcher': [true, 'Bookmark threads'] 'Unread Count': [true, 'Show unread post count in tab title'] - 'Watch on Reply': [false, 'Automatically watch threads you reply to'] textarea: flavors: [ 'http://regex.info/exif.cgi?url=' @@ -776,15 +776,14 @@ qr = form = e.target isQR = form.parentNode.id == 'qr' - if $.config('Watch on Reply') and $.config('Thread Watcher') + if $.config('Auto Watch Reply') and $.config('Thread Watcher') if g.REPLY and $('img.favicon').src is Favicon.empty watcher.watch null, g.THREAD_ID else - value = $('input[name=resto]').value - threads = $$ 'div.op' - for thread in threads - if thread.id is value and $('img.favicon', thread).src is Favicon.empty - watcher.watch thread, value + id = $('input[name=resto]').value + op = d.getElementById id + if $('img.favicon', op).src is Favicon.empty + watcher.watch op, id if isQR if span = @nextSibling