From 7178f5e4800a2b6ec908203c8c90b798f05f69c8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 20 Jul 2011 19:25:45 +0200 Subject: [PATCH] Do the threading first. Better watcher selector. --- 4chan_x.user.js | 17 ++++++++--------- script.coffee | 15 +++++++-------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 859857e7c..491ff86c1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1696,14 +1696,14 @@ }; watcher = { init: function() { - var dialog, favicon, html, input, inputs, _i, _len; + var favicon, html, input, inputs, _i, _len; html = '
Thread Watcher
'; - dialog = ui.dialog('watcher', { + watcher.dialog = ui.dialog('watcher', { top: '50px', left: '0px' }, html); - $.append(d.body, dialog); - inputs = $$('form > input[value=delete], div.thread > input[value=delete]'); + $.append(d.body, watcher.dialog); + inputs = $$('.op input'); for (_i = 0, _len = inputs.length; _i < _len; _i++) { input = inputs[_i]; favicon = $.el('img', { @@ -1720,10 +1720,9 @@ }); }, refresh: function() { - var board, dialog, div, favicon, id, link, props, watched, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3, _results; + var board, div, favicon, id, link, props, watched, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3, _results; watched = $.getValue('watched', {}); - dialog = $('#watcher'); - _ref = $$('div:not(.move)', dialog); + _ref = $$('div:not(.move)', watcher.dialog); for (_i = 0, _len = _ref.length; _i < _len; _i++) { div = _ref[_i]; $.rm(div); @@ -1739,7 +1738,7 @@ $.bind(x, 'click', watcher.cb.x); link = $.el('a', props); $.append(div, x, $.tn(' '), link); - $.append(dialog, div); + $.append(watcher.dialog, div); } } watchedBoard = watched[g.BOARD] || {}; @@ -2703,6 +2702,7 @@ Recaptcha.init(); $.bind(form, 'submit', qr.submit); } + threading.init(); if ($.config('Auto Noko')) { $('.postarea form').action += '?auto_noko'; } @@ -2757,7 +2757,6 @@ if ($.config('Keybinds')) { keybinds.init(); } - threading.init(); if (g.REPLY) { if ($.config('Thread Updater')) { updater.init(); diff --git a/script.coffee b/script.coffee index bcf3f7087..47b37fa4f 100644 --- a/script.coffee +++ b/script.coffee @@ -1385,11 +1385,11 @@ updater = watcher = init: -> html = '
Thread Watcher
' - dialog = ui.dialog 'watcher', top: '50px', left: '0px', html - $.append d.body, dialog + watcher.dialog = ui.dialog 'watcher', top: '50px', left: '0px', html + $.append d.body, watcher.dialog #add watch buttons - inputs = $$ 'form > input[value=delete], div.thread > input[value=delete]' + inputs = $$ '.op input' for input in inputs favicon = $.el 'img', className: 'favicon' @@ -1403,8 +1403,7 @@ watcher = refresh: -> watched = $.getValue 'watched', {} - dialog = $ '#watcher' - for div in $$ 'div:not(.move)', dialog + for div in $$ 'div:not(.move)', watcher.dialog $.rm div for board of watched for id, props of watched[board] @@ -1415,7 +1414,7 @@ watcher = link = $.el 'a', props $.append div, x, $.tn(' '), link - $.append dialog, div + $.append watcher.dialog, div watchedBoard = watched[g.BOARD] or {} for favicon in $$ 'img.favicon' @@ -2099,6 +2098,8 @@ main = $.bind form, 'submit', qr.submit #major features + threading.init() + if $.config 'Auto Noko' $('.postarea form').action += '?auto_noko' @@ -2153,8 +2154,6 @@ main = if $.config 'Keybinds' keybinds.init() - threading.init() - if g.REPLY if $.config 'Thread Updater' updater.init()