preload user tooltips
This commit is contained in:
parent
221f71acdc
commit
64fb5fe4e3
|
@ -22,26 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@if(!ctx.pref.isBlindfold) {
|
|
||||||
@playing.map { pov =>
|
|
||||||
@gameFen(pov)
|
|
||||||
<div class="game_legend">
|
|
||||||
@playerText(pov.opponent, withRating = true)
|
|
||||||
@pov.game.clock.map { c =>
|
|
||||||
• @c.config.show
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ctx.userId.map { myId =>
|
@ctx.userId.map { myId =>
|
||||||
@crosstable.filter(_.nonEmpty).map { cross =>
|
|
||||||
<a class="score hint--bottom" href="@routes.User.games(u.username, "me")#games" data-hint="@trans.nbGames.plural(cross.nbGames, cross.nbGames.localize)">
|
|
||||||
@trans.yourScore {
|
|
||||||
<strong>@cross.showScore(myId)</strong> - <strong>@cross.showOpponentScore(myId)</strong>
|
|
||||||
}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if(myId != u.id && u.enabled) {
|
@if(myId != u.id && u.enabled) {
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<a class="button hint--bottom" data-hint="@trans.watchGames()" href="@routes.User.tv(u.username)">
|
<a class="button hint--bottom" data-hint="@trans.watchGames()" href="@routes.User.tv(u.username)">
|
||||||
|
@ -58,11 +39,28 @@
|
||||||
@relation.mini(u.id, blocked, followable, rel)
|
@relation.mini(u.id, blocked, followable, rel)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@crosstable.filter(_.nonEmpty).map { cross =>
|
||||||
|
<a class="score hint--bottom" href="@routes.User.games(u.username, "me")#games" data-hint="@trans.nbGames.plural(cross.nbGames, cross.nbGames.localize)">
|
||||||
|
@trans.yourScore {
|
||||||
|
<strong>@cross.showScore(myId)</strong> - <strong>@cross.showOpponentScore(myId)</strong>
|
||||||
|
}
|
||||||
|
</a>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@if(isGranted(_.UserSpy)) {
|
@if(isGranted(_.UserSpy)) {
|
||||||
<div class="mod_info_box">
|
<div class="mod_info_box">
|
||||||
@if(u.lameOrTroll || u.disabled) { <span class="mod_marks">@userMarks(u, None)</span> }
|
@if(u.lameOrTroll || u.disabled) { <span class="mod_marks">@userMarks(u, None)</span> }
|
||||||
<p>@trans.nbGames.plural(u.count.game, u.count.game.localize), @momentFromNow(u.createdAt)</p>
|
<p>@trans.nbGames.plural(u.count.game, u.count.game.localize), @momentFromNow(u.createdAt)</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@if(!ctx.pref.isBlindfold) {
|
||||||
|
@playing.map { pov =>
|
||||||
|
@gameFen(pov)
|
||||||
|
<div class="game_legend">
|
||||||
|
@playerText(pov.opponent, withRating = true)
|
||||||
|
@pov.game.clock.map { c =>
|
||||||
|
• @c.config.show
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -276,6 +276,7 @@ group.radio input:checked + label {
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
#powerTip > .title {
|
#powerTip > .title {
|
||||||
|
height: 62px;
|
||||||
padding: 5px 3px;
|
padding: 5px 3px;
|
||||||
border-bottom: 1px solid #c0c0c0;
|
border-bottom: 1px solid #c0c0c0;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +360,7 @@ group.radio input:checked + label {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-bottom: 1px solid #c0c0c0;
|
border-top: 1px solid #c0c0c0;
|
||||||
padding: 3px 0;
|
padding: 3px 0;
|
||||||
}
|
}
|
||||||
#powerTip > .info .title {
|
#powerTip > .info .title {
|
||||||
|
|
|
@ -107,10 +107,12 @@ lichess.powertip = (function() {
|
||||||
return el && el.contains(contained);
|
return el && el.contains(contained);
|
||||||
};
|
};
|
||||||
|
|
||||||
var onPowertipPreRender = function(id) {
|
var onPowertipPreRender = function(id, preload) {
|
||||||
return function() {
|
return function() {
|
||||||
|
var url = ($(this).data('href') || $(this).attr('href')).replace(/\?.+$/, '');
|
||||||
|
if (preload) preload(url);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: ($(this).data('href') || $(this).attr('href')).replace(/\?.+$/, '') + '/mini',
|
url: url + '/mini',
|
||||||
success: function(html) {
|
success: function(html) {
|
||||||
$('#' + id).html(html);
|
$('#' + id).html(html);
|
||||||
lichess.pubsub.emit('content_loaded')();
|
lichess.pubsub.emit('content_loaded')();
|
||||||
|
@ -129,9 +131,17 @@ lichess.powertip = (function() {
|
||||||
placement: pos,
|
placement: pos,
|
||||||
mouseOnToPopup: true,
|
mouseOnToPopup: true,
|
||||||
closeDelay: 200
|
closeDelay: 200
|
||||||
}).on({
|
}).data('powertip', ' ').on({
|
||||||
powerTipPreRender: onPowertipPreRender('powerTip')
|
powerTipRender: onPowertipPreRender('powerTip', function(url) {
|
||||||
}).data('powertip', lichess.spinnerHtml);
|
var u = url.substr(3);
|
||||||
|
var preload = '<div class="title"><span class="user_link offline">' + $(el).html() + '</span></div><div class="actions">' +
|
||||||
|
'<a class="button" href="/@/' + u + '/tv"><i data-icon="1"></i></a>' +
|
||||||
|
'<a class="button" href="/inbox/new?user=' + u + '"><i data-icon="c"></i></a>' +
|
||||||
|
'<a class="button" href="/?user=' + u + '#friend"><i data-icon="U"></i></a>' +
|
||||||
|
'<a class="button relation" disabled></a></div>';
|
||||||
|
$('#powerTip').html(preload);
|
||||||
|
})
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var gamePowertip = function(el) {
|
var gamePowertip = function(el) {
|
||||||
|
|
Loading…
Reference in a new issue