show hooks as soon as possible

This commit is contained in:
Thibault Duplessis 2013-06-08 23:54:49 +02:00
parent d3c8fc18d2
commit f2419d89d6
2 changed files with 8 additions and 15 deletions

View file

@ -2030,9 +2030,10 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
}
}
resizeTimeline();
addHooks(lichess_preload.pool);
renderTimeline(lichess_preload.timeline);
_.each(lichess_preload.pool, addHook);
lichess.socket = new strongSocket("/lobby/socket", lichess_preload.version, $.extend(true, lichess.socketDefaults, {
events: {
game_entry: function(e) {
@ -2093,13 +2094,6 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
drawHooks();
}
function addHooks(hooks) {
_.each(hooks, function(h) {
pool.push(h);
});
drawHooks();
}
function addHook(hook) {
if (!isRegistered && hook.mode == "Rated") return;
hook.action = hook.uid == lichess_sri ? "cancel" : "join";
@ -2128,14 +2122,14 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
$wrap.find('.' + hook.id).filter(':visible').hide();
hidden++;
} else {
var $h = $wrap.find('.' + hook.id);
visible++;
if (!$h.length) {
if (!$hooks.find('div.' + hook.id).length) {
$(_.shuffle($hooks.find('>div:empty'))[0]).html($(renderHook(hook)).fadeIn(animation));
$canvas.append($(renderPlot(hook)).fadeIn(animation));
} else {
$h.not(':visible').fadeIn(animation);
}
if (!$canvas.find('> span.' + hook.id).length) {
$canvas.append($(renderPlot(hook)).fadeIn(animation));
}
$wrap.find('.' + hook.id).not(':visible').fadeIn(animation);
}
if (hook.action != 'cancel') seen.push(hash);
});

1
todo
View file

@ -69,7 +69,6 @@ second realtime board on homepage (right)
show friend games in homepage board
allow to filter anon
add fast tooltips to plots
from position castle blocks http://en.lichess.org/rdbx7laaczj8
---