diff --git a/data/dm/i18n/en_fr.yml b/data/dm/i18n/en_fr.yml index 4c070c9..1c8f7b9 100644 --- a/data/dm/i18n/en_fr.yml +++ b/data/dm/i18n/en_fr.yml @@ -3,7 +3,6 @@ "Draw": "Egalité" "Start a new game": "Commencer une nouvelle partie" "To invite someone to play, give this url:": "Pour inviter quelqu'un à jouer, donnez cette url:" -"Or challenge the Artificial Intelligence": "Ou défiez l'intelligence artificielle" "Your turn": "A vous de jouer" "Waiting for opponent": "Attente de l'adversaire" "You just added the chess/game widget. Please reload the page to activate it, and this message will never appear again.": "Vous venez d'ajouter le widget chess/game. Veuillez recharger la page pour l'activer, et ce message n'apparaîtra plus jamais." @@ -13,4 +12,7 @@ "Resign this game": "Abandonner cette partie" "To continue later, use this url:": "Pour reprendre la partie plus tard, utilisez cette url:" "Your browser does not support JavaScript.": "Votre navigateur ne supporte pas JavaScript." -"Creating a new game...": "Création d'une nouvelle partie..." \ No newline at end of file +"Creating a new game...": "Création d'une nouvelle partie..." +"Play with a friend": "Jouer avec un ami" +"Play with the machine": "Jouer avec la machine" +"Save": "Enregistrer" \ No newline at end of file diff --git a/modules/dmChessGame/templates/_table.php b/modules/dmChessGame/templates/_table.php index 0c6e21e..68103b1 100644 --- a/modules/dmChessGame/templates/_table.php +++ b/modules/dmChessGame/templates/_table.php @@ -21,15 +21,22 @@ ) ). - _tag('div.dm_chess_separator'). - - _tag('div.dm_chess_permalink', - __('To continue later, use this url:'). - _link($sf_request->getUri())->text($sf_request->getUri())->set('mt10') + _tag('div.dm_chess_table_controls.clearfix', + + _tag('a.dm_chess_permalink_toggle', + __('Save') + ). + + _link('+/dmChessGame/resign') + ->param('player', $player->code) + ->text(__('Resign')) + ->title(__('Resign this game')) + ->set('.dm_chess_give_up') ). - - _tag('div.dm_chess_give_up', - _link('+/dmChessGame/resign')->param('player', $player->code)->text(__('Resign'))->title(__('Resign this game')) + + _tag('div.dm_chess_permalink.none', + __('To continue later, use this url:'). + _tag('span', $sf_request->getUri()) ) ); \ No newline at end of file diff --git a/modules/dmChessGame/templates/_tableNotStarted.php b/modules/dmChessGame/templates/_tableNotStarted.php index 393deed..3612814 100644 --- a/modules/dmChessGame/templates/_tableNotStarted.php +++ b/modules/dmChessGame/templates/_tableNotStarted.php @@ -2,16 +2,18 @@ echo _tag('div.dm_chess_table.dm_chess_table_not_started', - __('To invite someone to play, give this url:'). + _tag('a.button.toggle_join_url', 'Play with a friend'). - _tag('div.dm_chess_join_url', - _link($dm_page)->param('g', $player->Game->code)->getAbsoluteHref() + _tag('div.dm_chess_join_url.none', + _tag('p', __('To invite someone to play, give this url:')). + _tag('span', _link($dm_page)->param('g', $player->Game->code)->getAbsoluteHref()) ). - - _tag('div.dm_chess_separator'). _tag('div.dm_chess_join_ai', - _link('+/dmChessGame/inviteAi')->param('player', $player->code)->text(__('Or challenge the Artificial Intelligence')) + _link('+/dmChessGame/inviteAi') + ->param('player', $player->code) + ->text(__('Play with the machine')) + ->set('.button') ) ); \ No newline at end of file diff --git a/web/css/table.css b/web/css/table.css index 0a8290a..da5c86b 100644 --- a/web/css/table.css +++ b/web/css/table.css @@ -18,7 +18,6 @@ div.dm_chess_join_url { border: 1px solid #D4D4D4; margin: 24px 0; padding: 10px; - font-size: 11px; } div.dm_chess_separator { @@ -31,14 +30,20 @@ div.dm_chess_permalink a.link { display: block; } -div.dm_chess_give_up { +div.dm_chess_table_controls { margin-top: 20px; - text-align: right; -} -div.dm_chess_give_up a.link { color: #888; font-size: 90%; } +div.dm_chess_table_controls a.dm_chess_permalink_toggle { + float: left; +} +div.dm_chess_table_controls a.dm_chess_give_up { + float: right; +} +div.dm_chess_table_controls div.dm_chess_permalink { + margin-top: 1em; +} div.dm_chess_current_player { height: 64px; diff --git a/web/js/ctrl.js b/web/js/ctrl.js index 03e77bb..960bbbb 100644 --- a/web/js/ctrl.js +++ b/web/js/ctrl.js @@ -4,18 +4,28 @@ $(function() { var options = dm_configuration.dm_chess_game; - options.opponent - ? $game.game(options) - : setTimeout(waitForOpponent = function() + if(options.opponent) { - $.ajax({ - url: $.dm.ctrl.getHref('+/dmChessGame/getNbPlayers')+'?game='+options.game.code, - success: function(response) - { - response == 2 ? location.reload() : setTimeout(waitForOpponent, options.beat.delay); - } + $game.game(options); + } + else + { + $('a.toggle_join_url').click(function() + { + $('div.dm_chess_join_url').toggle(100); }); - }, options.beat.delay); + + setTimeout(waitForOpponent = function() + { + $.ajax({ + url: $.dm.ctrl.getHref('+/dmChessGame/getNbPlayers')+'?game='+options.game.code, + success: function(response) + { + response == 2 ? location.reload() : setTimeout(waitForOpponent, options.beat.delay); + } + }); + }, options.beat.delay); + } } else if($waiting = $('div.dm_chess_not_created').orNot()) { diff --git a/web/js/game.js b/web/js/game.js index bbbe0c2..888c0a5 100644 --- a/web/js/game.js +++ b/web/js/game.js @@ -4,6 +4,7 @@ _init: function() { + var self = this; self.title_timeout = null; self.pieceMoving = false @@ -91,7 +92,7 @@ self.restartBeat(); - self.$table.find("div.dm_chess_give_up a").click(function() + self.$table.find("a.dm_chess_give_up").click(function() { if (confirm($(this).attr('title')+' ?')) { @@ -108,6 +109,11 @@ return false; }); + self.$table.find("a.dm_chess_permalink_toggle").click(function() + { + self.$table.find('div.dm_chess_permalink').toggle(100); + }); + self.$table.find("select#dm_chess_level_select").change(function() { $.ajax({