restore original friends box

This commit is contained in:
Thibault Duplessis 2014-02-01 20:34:56 +01:00
parent 19a47a822f
commit 5dfaf2cfd4
5 changed files with 118 additions and 17 deletions

View file

@ -160,6 +160,20 @@ data-accept-languages="@acceptLanguages.mkString(",")">
</div>
</div>
}
@ctx.me.map { me =>
<div id="friend_box" data-preload="@ctx.friends">
<div class="title">@trans.onlineFriends() - <strong class="online"> </strong>/<span class="total"> </span></div>
<div class="content_wrap">
<div class="content list"></div>
<div class="nobody">
<span>@trans.noFriendsOnline()</span>
<a class="find button" href="@routes.Relation.suggest(me.username)">
<span class="s16 tup">@trans.findFriends()</span>
</a>
</div>
</div>
</div>
}
@jsTag("deps.min.js")
@signedJs.fold(jsTagCompiled("big.js"))(js => jsAt(js, false))
@moreJs

View file

@ -322,15 +322,15 @@ var storage = {
socket: null,
socketDefaults: {
events: {
// following_onlines: function(data) {
// $('#friend_box').friends("set", data);
// },
// following_enters: function(name) {
// $('#friend_box').friends('enters', name);
// },
// following_leaves: function(name) {
// $('#friend_box').friends('leaves', name);
// },
following_onlines: function(data) {
$('#friend_box').friends("set", data);
},
following_enters: function(name) {
$('#friend_box').friends('enters', name);
},
following_leaves: function(name) {
$('#friend_box').friends('leaves', name);
},
n: function(e) {
var $tag = $('#nb_connected_players > strong');
if ($tag.length && e) {
@ -494,6 +494,8 @@ var storage = {
lichess.socket.send($(this).data('msg'), $(this).data('data'));
});
$('#friend_box').friends();
$('body').on('click', 'div.relation_actions a.relation', function() {
var $a = $(this).addClass('processing');
$.ajax({
@ -509,8 +511,9 @@ var storage = {
function userPowertips() {
var header = document.getElementById('site_header');
$('a.ulpt').removeClass('ulpt').each(function() {
var placement = $(this).data('placement') || ($.contains(header, this) ? 'e' : 'w');
$(this).powerTip({
placement: $.contains(header, this) ? 'e' : 'w',
placement: placement,
mouseOnToPopup: true,
closeDelay: 200
}).on({
@ -1507,6 +1510,47 @@ var storage = {
}
});
$.widget("lichess.friends", {
_create: function() {
var self = this;
self.$list = self.element.find("div.list");
self.$title = self.element.find('.title').click(function() {
self.element.find('.content_wrap').toggle(100, function() {
storage.set('friends-hide', $(this).is(':visible') ? 0 : 1);
});
});
if (storage.get('friends-hide') == 1) self.$title.click();
self.$nbOnline = self.$title.find('.online');
self.$nbTotal = self.$title.find('.total');
self.$nobody = self.element.find("div.nobody");
self.set(self.element.data('preload'));
},
repaint: function() {
this.users = _.uniq(this.users);
this.$nbOnline.text(this.users.length);
this.$nbTotal.text(this.nb);
this.$nobody.toggle(this.users.length === 0);
this.$list.html(_.map(this.users, this._renderUser).join(""));
$('body').trigger('lichess.content_loaded');
},
set: function(data) {
this.nb = data.nb;
this.users = data.us;
this.repaint();
},
enters: function(user) {
this.users.push(user);
this.repaint();
},
leaves: function(user) {
this.users = _.without(this.users, user);
this.repaint();
},
_renderUser: function(user) {
return '<a class="ulpt" data-placement="nw" href="/@/' + user + '">' + user + '</a>';
}
});
$.widget("lichess.chat", {
_create: function() {
this.options = $.extend({

File diff suppressed because one or more lines are too long

View file

@ -1359,6 +1359,49 @@ a#sound_state.unavailable {
bottom: 0.2em;
right: 0.3em;
}
#friend_box {
position: fixed;
bottom: 0px;
right: 0px;
background: #fff;
border: 1px solid #ccc;
border-right: 0;
min-width: 150px;
}
#friend_box .title {
cursor: pointer;
padding: 3px 5px;
border-bottom: 1px solid #ccc;
border-radius: 4px 4px 0 0;
}
#friend_box .content a {
padding: 3px 5px;
text-decoration: none;
display: block;
max-height: 100px;
overflow-y:auto;
}
#friend_box .content a:hover {
background: #F0F0F0;
}
#friend_box .nobody {
text-align: center;
display: none;
padding: 3px 5px;
font-style: italic;
}
#friend_box .nobody span {
display: block;
margin: 5px;
}
#friend_box a.find {
display: none;
margin: 7px;
font-style: normal;
}
#friend_box div.nobody:hover a.find {
display: block;
}
span.s16.clock {
background-position: 0 -224px;
padding-bottom: 1px;

View file

@ -12,7 +12,7 @@ body.dark input, body.dark textarea, body.dark div.analysis_menu > a.active {
body.dark div.analysis_menu > a.active {
border-bottom-color: #1a1a1a;
}
body.dark #reconnecting, body.dark .mini_board, body.dark #nb_connected_players, body.dark div.lichess_chat_top, body.dark div.lichess_chat .lichess_messages, body.dark div.undertable_top, body.dark div.undertable_inner, body.dark div.undertable td, body.dark div.lichess_table .lichess_button, body.dark div.lichess_chat form input, body.dark div.lichess_board_wrap, body.dark #translation_call, body.dark div.footer_wrap, body.dark div.game_config .optional_config, body.dark .ui-state-default, body.dark .ui-widget-content, body.dark div.lichess_goodies div.box, body.dark div.lichess_table, body.dark div.lichess_separator, body.dark div.clock, body.dark .button, body.dark #GameText, body.dark #tournament_side, body.dark #GameBoard table.boardTable, body.dark div.shortcuts .title, body.dark div.content_box, body.dark div.content_box_top, body.dark div.content_box_top a, body.dark div.content_box_inter, body.dark div.content_box_inter a.active, body.dark #site_header div.side_menu a.active, body.dark div.game_row, body.dark form.search_user_form input, body.dark div.user_show div.boxed_data, body.dark #lichess_forum div.post, body.dark #lichess_forum textarea, body.dark #lichess_forum form.wide input, body.dark #lichess_message tr, body.dark #lichess_message div.thread_message, body.dark #lichess_message textarea, body.dark #lichess_message input, body.dark .content_box form input, body.dark div.progressbar, body.dark form.translation_form div.messages, body.dark form.translation_form input, body.dark div.locale_menu a, body.dark #adv_chart, body.dark #top .dropdown, body.dark div.search_status, body.dark table.slist, body.dark table.slist thead th, body.dark #notifications > div, body.dark form.wide input[type="text"], body.dark form.wide textarea, body.dark #team .team-left, body.dark #team .team-right, body.dark #team h2, body.dark .leaderboard_title, body.dark div.user_show div.mod_zone, body.dark div.user_show div.user-infos, body.dark div.game_config input[type="text"], body.dark #powerTip, body.dark #powerTip > .title, body.dark #powerTip > .actions a, body.dark #hooks_table th, body.dark #hooks_table td, body.dark #hooks_wrap > div.tabs > a, body.dark #hooks_chart > div.grid, body.dark div.analysis_menu, body.dark div.analysis_menu > a {
body.dark #reconnecting, body.dark .mini_board, body.dark #nb_connected_players, body.dark div.lichess_chat_top, body.dark div.lichess_chat .lichess_messages, body.dark div.undertable_top, body.dark div.undertable_inner, body.dark div.undertable td, body.dark div.lichess_table .lichess_button, body.dark div.lichess_chat form input, body.dark div.lichess_board_wrap, body.dark #translation_call, body.dark div.footer_wrap, body.dark div.game_config .optional_config, body.dark .ui-state-default, body.dark .ui-widget-content, body.dark div.lichess_goodies div.box, body.dark div.lichess_table, body.dark div.lichess_separator, body.dark div.clock, body.dark .button, body.dark #GameText, body.dark #tournament_side, body.dark #GameBoard table.boardTable, body.dark div.shortcuts .title, body.dark div.content_box, body.dark div.content_box_top, body.dark div.content_box_top a, body.dark div.content_box_inter, body.dark div.content_box_inter a.active, body.dark #site_header div.side_menu a.active, body.dark div.game_row, body.dark form.search_user_form input, body.dark div.user_show div.boxed_data, body.dark #lichess_forum div.post, body.dark #lichess_forum textarea, body.dark #lichess_forum form.wide input, body.dark #lichess_message tr, body.dark #lichess_message div.thread_message, body.dark #lichess_message textarea, body.dark #lichess_message input, body.dark .content_box form input, body.dark div.progressbar, body.dark form.translation_form div.messages, body.dark form.translation_form input, body.dark div.locale_menu a, body.dark #adv_chart, body.dark #top .dropdown, body.dark div.search_status, body.dark table.slist, body.dark table.slist thead th, body.dark #notifications > div, body.dark form.wide input[type="text"], body.dark form.wide textarea, body.dark #team .team-left, body.dark #team .team-right, body.dark #team h2, body.dark .leaderboard_title, body.dark #friend_box, body.dark #friend_box .title, body.dark div.user_show div.mod_zone, body.dark div.user_show div.user-infos, body.dark div.game_config input[type="text"], body.dark #powerTip, body.dark #powerTip > .title, body.dark #powerTip > .actions a, body.dark #hooks_table th, body.dark #hooks_table td, body.dark #hooks_wrap > div.tabs > a, body.dark #hooks_chart > div.grid, body.dark div.analysis_menu, body.dark div.analysis_menu > a {
border-color: #3d3d3d;
}
body.dark #timeline, body.dark #timeline > .entry {
@ -46,7 +46,7 @@ body.dark #site_title span.extension, body.dark div.sub_ratings h3 {
body.dark #GameText a:hover, body.dark #hooks_wrap a.filter:hover, body.dark #hooks_wrap a.filter.active {
background: #000;
}
body.dark div.lichess_chat .lichess_messages, body.dark div.undertable_inner, body.dark div.lichess_goodies div.box, body.dark div.undertable td, body.dark div.lichess_table, body.dark div.lichess_table_wrap div.clock, body.dark div.footer_wrap {
body.dark div.lichess_chat .lichess_messages, body.dark div.undertable_inner, body.dark div.lichess_goodies div.box, body.dark div.undertable td, body.dark div.lichess_table, body.dark div.lichess_table_wrap div.clock, body.dark #friend_box .content a:hover, body.dark div.footer_wrap {
background: #242424;
}
body.dark #hooks_table tr:nth-child(even) td {
@ -93,7 +93,7 @@ body.dark #site_header div.side_menu a.active {
background: #2b2b2b;
box-shadow: -3px 0 5px #505050;
}
body.dark div.game_row:nth-child(odd), body.dark #lichess_forum table.forum_table tr:nth-child(odd), body.dark #lichess_message tr:nth-child(even), body.dark div.user_show div.boxed_data, body.dark div.content_box_inter, body.dark #GameText tr:nth-child(even), body.dark table.slist tbody tr:nth-child(even), body.dark #team .forum li:nth-child(odd), body.dark table.translations tbody tr:nth-child(odd), body.dark form.translation_form div.message:nth-child(even), body.dark div.content_box table.datatable tr:nth-child(odd), body.dark div.game_config .optional_config, body.dark div.search_status, body.dark #powerTip {
body.dark div.game_row:nth-child(odd), body.dark #lichess_forum table.forum_table tr:nth-child(odd), body.dark #lichess_message tr:nth-child(even), body.dark div.user_show div.boxed_data, body.dark div.content_box_inter, body.dark #GameText tr:nth-child(even), body.dark table.slist tbody tr:nth-child(even), body.dark #team .forum li:nth-child(odd), body.dark table.translations tbody tr:nth-child(odd), body.dark form.translation_form div.message:nth-child(even), body.dark div.content_box table.datatable tr:nth-child(odd), body.dark div.game_config .optional_config, body.dark div.search_status, body.dark #friend_box, body.dark #powerTip {
background: #343434;
}
body.dark #lichess_forum table.forum_table thead tr:nth-child(odd) {
@ -132,7 +132,7 @@ body.dark div.lichess_table_wrap div.clock.running.emerg, body.dark div.lichess_
color: #d0d0d0;
}
/* soft inactive gradient */
body.dark #top a.signin, body.dark #powerTip > .actions a, body.dark div.lichess_chat_top, body.dark div.undertable_top, body.dark .button, body.dark .button:visited, body.dark .ui-state-default, body.dark div.content_box_top, body.dark #translation_call, body.dark #notifications > div, body.dark div.locale_menu a, body.dark table.slist thead {
body.dark #top a.signin, body.dark #powerTip > .actions a, body.dark div.lichess_chat_top, body.dark #friend_box .title, body.dark div.undertable_top, body.dark .button, body.dark .button:visited, body.dark .ui-state-default, body.dark div.content_box_top, body.dark #translation_call, body.dark #notifications > div, body.dark div.locale_menu a, body.dark table.slist thead {
background: #2a2a2a;
background: linear-gradient(to bottom, #2a2a2a, #202020);
}