rm watcher.addlink

This commit is contained in:
James Campos 2011-05-06 23:53:50 -07:00
parent 6e85e7f173
commit 5c58d3f031
2 changed files with 23 additions and 27 deletions

View File

@ -1488,8 +1488,9 @@
}), 1000);
},
refresh: function(watched) {
var board, div, favicon, id, props, watchedBoard, _i, _j, _len, _len2, _ref, _ref2, _ref3;
_ref = $$('#watcher > div:not(.move)');
var board, dialog, div, favicon, id, link, props, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3;
dialog = $('#watcher');
_ref = $$('div:not(.move)', dialog);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
div = _ref[_i];
$.remove(div);
@ -1498,7 +1499,14 @@
_ref2 = watched[board];
for (id in _ref2) {
props = _ref2[id];
watcher.addLink(props, $('#watcher'));
div = $.el('div');
x = $.el('a', {
textContent: 'X'
});
$.bind(x, 'click', watcher.cb.x);
link = $.el('a', props);
$.append(div, x, $.tn(' '), link);
$.append(dialog, div);
}
}
watchedBoard = watched[g.BOARD] || {};
@ -1515,17 +1523,6 @@
$.setValue('watcher.lastUpdated', Date.now());
return watcher.lastUpdated = Date.now();
},
addLink: function(props, dialog) {
var div, link, x;
div = $.el('div');
x = $.el('a', {
textContent: 'X'
});
$.bind(x, 'click', watcher.cb.x);
link = $.el('a', props);
$.append(div, x, $.tn(' '), link);
return $.append(dialog, div);
},
cb: {
toggle: function(e) {
return watcher.toggle(e.target.parentNode);

View File

@ -1180,15 +1180,24 @@ watcher =
setInterval (->
if watcher.lastUpdated < $.getValue 'watcher.lastUpdated', 0
watcher.refresh($.getValue 'watched', {})
watcher.refresh $.getValue 'watched', {}
), 1000
refresh: (watched) ->
for div in $$ '#watcher > div:not(.move)'
dialog = $ '#watcher'
for div in $$ 'div:not(.move)', dialog
$.remove div
for board of watched
for id, props of watched[board]
watcher.addLink props, $ '#watcher'
div = $.el 'div'
x = $.el 'a',
textContent: 'X'
$.bind x, 'click', watcher.cb.x
link = $.el 'a', props
$.append div, x, $.tn(' '), link
$.append dialog, div
watchedBoard = watched[g.BOARD] or {}
for favicon in $$ 'img.favicon'
id = favicon.nextSibling.name
@ -1199,16 +1208,6 @@ watcher =
$.setValue 'watcher.lastUpdated', Date.now()
watcher.lastUpdated = Date.now()
addLink: (props, dialog) ->
div = $.el 'div'
x = $.el 'a',
textContent: 'X'
$.bind x, 'click', watcher.cb.x
link = $.el 'a', props
$.append div, x, $.tn(' '), link
$.append dialog, div
cb:
toggle: (e) ->
watcher.toggle e.target.parentNode