Do the threading first. Better watcher selector.

This commit is contained in:
Nicolas Stepien 2011-07-20 19:25:45 +02:00
parent 3b2b50a230
commit 7178f5e480
2 changed files with 15 additions and 17 deletions

View File

@ -1696,14 +1696,14 @@
}; };
watcher = { watcher = {
init: function() { init: function() {
var dialog, favicon, html, input, inputs, _i, _len; var favicon, html, input, inputs, _i, _len;
html = '<div class=move>Thread Watcher</div>'; html = '<div class=move>Thread Watcher</div>';
dialog = ui.dialog('watcher', { watcher.dialog = ui.dialog('watcher', {
top: '50px', top: '50px',
left: '0px' left: '0px'
}, html); }, html);
$.append(d.body, dialog); $.append(d.body, watcher.dialog);
inputs = $$('form > input[value=delete], div.thread > input[value=delete]'); inputs = $$('.op input');
for (_i = 0, _len = inputs.length; _i < _len; _i++) { for (_i = 0, _len = inputs.length; _i < _len; _i++) {
input = inputs[_i]; input = inputs[_i];
favicon = $.el('img', { favicon = $.el('img', {
@ -1720,10 +1720,9 @@
}); });
}, },
refresh: function() { 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', {}); watched = $.getValue('watched', {});
dialog = $('#watcher'); _ref = $$('div:not(.move)', watcher.dialog);
_ref = $$('div:not(.move)', dialog);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
div = _ref[_i]; div = _ref[_i];
$.rm(div); $.rm(div);
@ -1739,7 +1738,7 @@
$.bind(x, 'click', watcher.cb.x); $.bind(x, 'click', watcher.cb.x);
link = $.el('a', props); link = $.el('a', props);
$.append(div, x, $.tn(' '), link); $.append(div, x, $.tn(' '), link);
$.append(dialog, div); $.append(watcher.dialog, div);
} }
} }
watchedBoard = watched[g.BOARD] || {}; watchedBoard = watched[g.BOARD] || {};
@ -2703,6 +2702,7 @@
Recaptcha.init(); Recaptcha.init();
$.bind(form, 'submit', qr.submit); $.bind(form, 'submit', qr.submit);
} }
threading.init();
if ($.config('Auto Noko')) { if ($.config('Auto Noko')) {
$('.postarea form').action += '?auto_noko'; $('.postarea form').action += '?auto_noko';
} }
@ -2757,7 +2757,6 @@
if ($.config('Keybinds')) { if ($.config('Keybinds')) {
keybinds.init(); keybinds.init();
} }
threading.init();
if (g.REPLY) { if (g.REPLY) {
if ($.config('Thread Updater')) { if ($.config('Thread Updater')) {
updater.init(); updater.init();

View File

@ -1385,11 +1385,11 @@ updater =
watcher = watcher =
init: -> init: ->
html = '<div class=move>Thread Watcher</div>' html = '<div class=move>Thread Watcher</div>'
dialog = ui.dialog 'watcher', top: '50px', left: '0px', html watcher.dialog = ui.dialog 'watcher', top: '50px', left: '0px', html
$.append d.body, dialog $.append d.body, watcher.dialog
#add watch buttons #add watch buttons
inputs = $$ 'form > input[value=delete], div.thread > input[value=delete]' inputs = $$ '.op input'
for input in inputs for input in inputs
favicon = $.el 'img', favicon = $.el 'img',
className: 'favicon' className: 'favicon'
@ -1403,8 +1403,7 @@ watcher =
refresh: -> refresh: ->
watched = $.getValue 'watched', {} watched = $.getValue 'watched', {}
dialog = $ '#watcher' for div in $$ 'div:not(.move)', watcher.dialog
for div in $$ 'div:not(.move)', dialog
$.rm div $.rm div
for board of watched for board of watched
for id, props of watched[board] for id, props of watched[board]
@ -1415,7 +1414,7 @@ watcher =
link = $.el 'a', props link = $.el 'a', props
$.append div, x, $.tn(' '), link $.append div, x, $.tn(' '), link
$.append dialog, div $.append watcher.dialog, div
watchedBoard = watched[g.BOARD] or {} watchedBoard = watched[g.BOARD] or {}
for favicon in $$ 'img.favicon' for favicon in $$ 'img.favicon'
@ -2099,6 +2098,8 @@ main =
$.bind form, 'submit', qr.submit $.bind form, 'submit', qr.submit
#major features #major features
threading.init()
if $.config 'Auto Noko' if $.config 'Auto Noko'
$('.postarea form').action += '?auto_noko' $('.postarea form').action += '?auto_noko'
@ -2153,8 +2154,6 @@ main =
if $.config 'Keybinds' if $.config 'Keybinds'
keybinds.init() keybinds.init()
threading.init()
if g.REPLY if g.REPLY
if $.config 'Thread Updater' if $.config 'Thread Updater'
updater.init() updater.init()