diff --git a/app/controllers/Round.scala b/app/controllers/Round.scala index bbda4e943a..cb26aa4d6e 100644 --- a/app/controllers/Round.scala +++ b/app/controllers/Round.scala @@ -80,10 +80,12 @@ object Round extends LilaController with TheftPrevention { } private def join(pov: Pov)(implicit ctx: Context): Fu[SimpleResult] = - GameRepo initialFen pov.gameId zip env.version(pov.gameId) map { - case (fen, version) ⇒ Ok(html.setup.join( - pov, version, Env.setup.friendConfigMemo get pov.game.id, fen)) - } + GameRepo initialFen pov.gameId zip + env.version(pov.gameId) zip + ((pov.player.userId orElse pov.opponent.userId) ?? UserRepo.byId) map { + case ((fen, version), opponent) ⇒ Ok(html.setup.join( + pov, opponent, version, Env.setup.friendConfigMemo get pov.game.id, fen)) + } def tableWatcher(gameId: String, color: String) = Open { implicit ctx ⇒ OptionOk(GameRepo.pov(gameId, color)) { html.round.table.watch(_) } diff --git a/app/views/setup/join.scala.html b/app/views/setup/join.scala.html index be879d671b..584ceb47c4 100644 --- a/app/views/setup/join.scala.html +++ b/app/views/setup/join.scala.html @@ -1,4 +1,4 @@ -@(pov: Pov, version: Int, config: Option[lila.setup.FriendConfig], initialFen: Option[String])(implicit ctx: Context) +@(pov: Pov, opponentUser: Option[User], version: Int, config: Option[lila.setup.FriendConfig], initialFen: Option[String])(implicit ctx: Context) @import pov._ @@ -11,7 +11,11 @@ signedJs = routes.Round.signedJs(pov.gameId).toString.some) {
@trans.variant(): @variantName(c.variant)
diff --git a/public/javascripts/big.js b/public/javascripts/big.js
index 96ec150cde..a40b10134b 100644
--- a/public/javascripts/big.js
+++ b/public/javascripts/big.js
@@ -361,17 +361,32 @@ var storage = {
}
},
challengeReminder: function(data) {
- if (!storage.get('challenge-refused-' + data.id) && !$('div.lichess_overboard.joining').length) {
+ if (!storage.get('challenge-refused-' + data.id)) {
+ var $overboard = $('div.lichess_overboard.joining');
+ var declineListener = function($a, callback) {
+ return $a.click(function() {
+ $.post($(this).attr("href"));
+ storage.set('challenge-refused-' + data.id, 1);
+ $('#challenge_reminder').remove();
+ if ($.isFunction(callback)) callback();
+ return false;
+ });
+ };
+ if ($overboard.length) {
+ if (!$overboard.find('a.decline').length)
+ $overboard.find('form').append(
+ declineListener($(data.html).find('a.decline'), function() {
+ location.href = "/";
+ })
+ );
+ return;
+ }
$('#challenge_reminder').each(function() {
clearTimeout($(this).data('timeout'));
$(this).remove();
});
- $('#notifications').append(data.html).find("a.decline").click(function() {
- $.post($(this).attr("href"));
- storage.set('challenge-refused-' + data.id, 1);
- $('#challenge_reminder').remove();
- return false;
- });
+ $('#notifications').append($(data.html));
+ declineListener($('#notifications a.decline'));
$('#challenge_reminder').data('timeout', setTimeout(function() {
$('#challenge_reminder').remove();
}, 3000));
@@ -2582,9 +2597,9 @@ var storage = {
clearShortcutSquares("A", "1234567");
var $game = $("#GameBoard");
$game.mousewheel(function(event) {
- if(event.deltaY == 1) {
+ if (event.deltaY == 1) {
$('#forwardButton').click();
- } else if(event.deltaY == -1) {
+ } else if (event.deltaY == -1) {
$('#backButton').click();
}
event.stopPropagation();
diff --git a/public/stylesheets/board.css b/public/stylesheets/board.css
index 27b6c1cf97..1038c58b1b 100644
--- a/public/stylesheets/board.css
+++ b/public/stylesheets/board.css
@@ -151,8 +151,6 @@ div.lichess_overboard a.close:hover {
}
div.lichess_overboard p.explanations {
margin-top: 1em;
- border-top: 1px solid #ccc;
- padding-top:1em;
font-size: 12px;
line-height: 1.4em;
text-align: left;
diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css
index 98dd21ee8c..e00c1e4160 100644
--- a/public/stylesheets/common.css
+++ b/public/stylesheets/common.css
@@ -1851,6 +1851,10 @@ div.lichess_overboard.joining input.submit {
margin-top: 1em;
padding: 0.6em 1em;
}
+div.lichess_overboard.joining a.decline {
+ display: block;
+ margin-top: 1em;
+}
div.lichess_overboard.joining .mini_board {
margin: 10px auto;
}
diff --git a/public/stylesheets/dark.css b/public/stylesheets/dark.css
index 61432094a2..a4b4bdc058 100644
--- a/public/stylesheets/dark.css
+++ b/public/stylesheets/dark.css
@@ -9,7 +9,7 @@ body.dark input, body.dark textarea {
background: #1a1a1a;
color: #8a8a8a;
}
-body.dark #top, body.dark #nb_connected_players, body.dark #reconnecting, body.dark #connecting, 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.undergame_box, body.dark div.game_more div.more_top, 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.lichess_overboard p.explanations, 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 #hooks_table th, body.dark #hooks_table td, body.dark #hooks_wrap > div.tabs > a, body.dark #hooks_chart > div.grid {
+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.undergame_box, body.dark div.game_more div.more_top, 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 #hooks_table th, body.dark #hooks_table td, body.dark #hooks_wrap > div.tabs > a, body.dark #hooks_chart > div.grid {
border-color: #3d3d3d;
}
body.dark #timeline, body.dark #timeline > .entry {
@@ -93,9 +93,6 @@ body.dark #site_header div.side_menu a.active {
background: #2b2b2b;
box-shadow: -3px 0 5px #505050;
}
-body.dark .mini_board {
- box-shadow: none;
-}
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;
}