refine lobby hooks & seeks

This commit is contained in:
Thibault Duplessis 2015-03-27 22:54:18 +01:00
parent ab1fa6076a
commit 0e5efdcc4c
4 changed files with 21 additions and 3 deletions

View file

@ -5,8 +5,12 @@
<div class="menu">
<section>
<h2>Play</h2>
<a href="/">@trans.realTime()</a>
<a href="/?time=realTime#hook">@trans.realTime()</a>
@if(ctx.isAuth) {
<a href="/?time=correspondence#hook">@trans.correspondence()</a>
} else {
<span title="@trans.youNeedAnAccountToDoThat()" class="disabled">@trans.correspondence()</span>
}
<a href="@routes.Tournament.home">@trans.tournament()</a>
<a href="@routes.Tv.index">Lichess TV</a>
</section>

View file

@ -1502,7 +1502,6 @@ lichess.storage = {
});
function startLobby(element, cfg) {
var $newposts = $("div.new_posts");
var nbRoundSpread = $.spreadNumber(
document.querySelector('#site_baseline span'),
4,
@ -1544,6 +1543,7 @@ lichess.storage = {
$('body').trigger('lichess.content_loaded');
},
reload_forum: function() {
var $newposts = $("div.new_posts");
setTimeout(function() {
$.ajax({
url: $newposts.data('url'),
@ -1853,6 +1853,15 @@ lichess.storage = {
$(this).attr("href", $(this).attr("href") + location.search);
}).click();
}
if (location.hash === '#hook') {
if (/time=realTime/.test(location.search))
lobby.setTab('real_time');
else if (/time=correspondence/.test(location.search))
lobby.setTab('seeks');
}
window.history.replaceState(null, null, '/');
};
///////////////////

View file

@ -1081,6 +1081,11 @@ body.fpmenu #fpmenu {
display: block;
padding: 9px 0;
}
#fpmenu section .disabled {
opacity: 0.5;
display: block;
padding: 9px 0;
}
#fpmenu .footer {
width: 100%;
padding: 35px 0;

View file

@ -23,7 +23,7 @@ function renderSeek(ctrl, seek) {
};
function createSeek(ctrl) {
if (ctrl.data.seeks.length < 8)
if (ctrl.data.me && ctrl.data.seeks.length < 8)
return m('div.create',
m('a.button', {
href: '/?time=correspondence#hook',