make homepage timeline lighter

This commit is contained in:
Thibault Duplessis 2014-12-29 13:56:38 +01:00
parent b465f3f028
commit d4141d563f
4 changed files with 19 additions and 25 deletions

View file

@ -1,7 +1,9 @@
@(entries: List[lila.timeline.Entry])(implicit ctx: Context)
@entries.map { entry =>
<div class="entry">
@timeline.entry(entry)
<div class="entries">
@entries.map { entry =>
<div class="entry">
@timeline.entry(entry)
</div>
}
</div>
}

View file

@ -1233,22 +1233,10 @@ var storage = {
});
function startLobby(element, cfg) {
var $timeline = $("#timeline");
var $newposts = $("div.new_posts");
var nbPlayersElement = document.getElementById('site_baseline span');
var nbRoundsEl = document.getElementById('site_baseline span');
var lobby;
function resizeTimeline() {
if ($timeline.length) {
var pos = $timeline.offset().top,
max = $('#lichess').offset().top + 536;
while (pos + $timeline.outerHeight() > max) {
$timeline.find('div.entry:last').remove();
}
}
}
resizeTimeline();
lichess.socket = new lichess.StrongSocket(
'/lobby/socket/v1',
cfg.data.version, {
@ -1259,10 +1247,9 @@ var storage = {
events: {
reload_timeline: function() {
$.ajax({
url: $timeline.data('href'),
url: $("#timeline").data('href'),
success: function(html) {
$timeline.html(html);
resizeTimeline();
$('#timeline').html(html);
$('body').trigger('lichess.content_loaded');
}
});
@ -1290,15 +1277,15 @@ var storage = {
}, Math.round(Math.random() * 5000));
},
nbr: function(e) {
if (nbPlayersElement && e) {
var prev = parseInt(nbPlayersElement.textContent, 10);
if (nbRoundsEl && e) {
var prev = parseInt(nbRoundsEl.textContent, 10);
var k = 5;
var interv = 2000 / k;
$.fp.range(k).forEach(function(it) {
setTimeout(function() {
var val = Math.round(((prev * (k - 1 - it)) + (e * (it + 1))) / k);
if (val != prev) {
nbPlayersElement.textContent = val;
nbRoundsEl.textContent = val;
prev = val;
}
}, Math.round(it * interv));

View file

@ -252,7 +252,7 @@ body.dark div.content_box .loader:after {
background-color: #2b2b2b;
}
body.dark #timeline,
body.dark #timeline > .entry {
body.dark #timeline .entry {
border-color: #2b2b2b;
}
body.dark #site_header div.side_menu a.active,

View file

@ -608,7 +608,11 @@ div.game_config div.color_submits button.random span {
width: 230px;
font-size: 0.9em;
}
#timeline > .entry {
#timeline .entries {
height: 400px;
overflow: hidden;
}
#timeline .entry {
padding-bottom: 8px;
border-bottom: 1px solid #e4e4e4;
margin-bottom: 8px;
@ -629,6 +633,7 @@ div.game_config div.color_submits button.random span {
padding-left: 0;
}
#timeline .links {
margin-top: 10px;
width: 100%;
}
#timeline .links a {