Watcher listing optimizations. Append all the DIVs at once, copy the textContent for the title instead of saving it twice.
This commit is contained in:
parent
7dd32aba23
commit
0baa452a01
@ -2115,28 +2115,31 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
var board, div, favicon, id, link, props, watched, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3, _results;
|
var board, div, favicon, frag, id, link, props, watched, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3, _results;
|
||||||
watched = $.get('watched', {});
|
watched = $.get('watched', {});
|
||||||
_ref = $$('div:not(.move)', watcher.dialog);
|
frag = d.createDocumentFragment();
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
||||||
div = _ref[_i];
|
|
||||||
$.rm(div);
|
|
||||||
}
|
|
||||||
for (board in watched) {
|
for (board in watched) {
|
||||||
_ref2 = watched[board];
|
_ref = watched[board];
|
||||||
for (id in _ref2) {
|
for (id in _ref) {
|
||||||
props = _ref2[id];
|
props = _ref[id];
|
||||||
div = $.el('div');
|
|
||||||
x = $.el('a', {
|
x = $.el('a', {
|
||||||
textContent: 'X',
|
textContent: 'X',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
});
|
});
|
||||||
$.on(x, 'click', watcher.cb.x);
|
$.on(x, 'click', watcher.cb.x);
|
||||||
link = $.el('a', props);
|
link = $.el('a', props);
|
||||||
|
link.title = link.textContent;
|
||||||
|
div = $.el('div');
|
||||||
$.add(div, x, $.tn(' '), link);
|
$.add(div, x, $.tn(' '), link);
|
||||||
$.add(watcher.dialog, div);
|
$.add(frag, div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ref2 = $$('div:not(.move)', watcher.dialog);
|
||||||
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||||
|
div = _ref2[_i];
|
||||||
|
$.rm(div);
|
||||||
|
}
|
||||||
|
$.add(watcher.dialog, frag);
|
||||||
watchedBoard = watched[g.BOARD] || {};
|
watchedBoard = watched[g.BOARD] || {};
|
||||||
_ref3 = $$('img.favicon');
|
_ref3 = $$('img.favicon');
|
||||||
_results = [];
|
_results = [];
|
||||||
@ -2183,8 +2186,7 @@
|
|||||||
text = getTitle(thread);
|
text = getTitle(thread);
|
||||||
props = {
|
props = {
|
||||||
href: "/" + g.BOARD + "/res/" + id,
|
href: "/" + g.BOARD + "/res/" + id,
|
||||||
textContent: text,
|
textContent: text
|
||||||
title: text
|
|
||||||
};
|
};
|
||||||
watched = $.get('watched', {});
|
watched = $.get('watched', {});
|
||||||
watched[_name = g.BOARD] || (watched[_name] = {});
|
watched[_name = g.BOARD] || (watched[_name] = {});
|
||||||
|
|||||||
@ -1696,19 +1696,23 @@ watcher =
|
|||||||
|
|
||||||
refresh: ->
|
refresh: ->
|
||||||
watched = $.get 'watched', {}
|
watched = $.get 'watched', {}
|
||||||
for div in $$ 'div:not(.move)', watcher.dialog
|
frag = d.createDocumentFragment()
|
||||||
$.rm div
|
|
||||||
for board of watched
|
for board of watched
|
||||||
for id, props of watched[board]
|
for id, props of watched[board]
|
||||||
div = $.el 'div'
|
|
||||||
x = $.el 'a',
|
x = $.el 'a',
|
||||||
textContent: 'X'
|
textContent: 'X'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.on x, 'click', watcher.cb.x
|
$.on x, 'click', watcher.cb.x
|
||||||
link = $.el 'a', props
|
link = $.el 'a', props
|
||||||
|
link.title = link.textContent
|
||||||
|
|
||||||
|
div = $.el 'div'
|
||||||
$.add div, x, $.tn(' '), link
|
$.add div, x, $.tn(' '), link
|
||||||
$.add watcher.dialog, div
|
$.add frag, div
|
||||||
|
|
||||||
|
for div in $$ 'div:not(.move)', watcher.dialog
|
||||||
|
$.rm div
|
||||||
|
$.add watcher.dialog, frag
|
||||||
|
|
||||||
watchedBoard = watched[g.BOARD] or {}
|
watchedBoard = watched[g.BOARD] or {}
|
||||||
for favicon in $$ 'img.favicon'
|
for favicon in $$ 'img.favicon'
|
||||||
@ -1745,7 +1749,6 @@ watcher =
|
|||||||
props =
|
props =
|
||||||
href: "/#{g.BOARD}/res/#{id}"
|
href: "/#{g.BOARD}/res/#{id}"
|
||||||
textContent: text
|
textContent: text
|
||||||
title: text
|
|
||||||
|
|
||||||
watched = $.get 'watched', {}
|
watched = $.get 'watched', {}
|
||||||
watched[g.BOARD] or= {}
|
watched[g.BOARD] or= {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user