diff --git a/app/views/game/editor.scala.html b/app/views/game/editor.scala.html
index 0a70b9da52..501d7db4e5 100644
--- a/app/views/game/editor.scala.html
+++ b/app/views/game/editor.scala.html
@@ -1,11 +1,12 @@
@(listMenu: lila.game.ListMenu)(implicit ctx: Context)
@moreCss = {
-@cssVendorTag("chessboardjs/css/chessboardjs-0.1.0.min.css")
+@cssVendorTag("chessboard/css/chessboard-0.1.0.css")
+@cssTag("boardEditor.css")
}
@moreJs = {
+@jsVendorTag("chessboard/js/chessboard-0.1.0.js")
@jsTag("boardEditor.js")
-@jsVendorTag("chessboardjs/js/chessboardjs-0.1.0.min.js")
}
@game.layout(
@@ -14,7 +15,22 @@ menu = game.sideMenu(listMenu, "edit").some,
moreJs = moreJs,
moreCss = moreCss) {
-
@trans.boardEditor
-
+
@trans.boardEditor()
+
+
}
diff --git a/conf/messages b/conf/messages
index d8d76fa8a7..10146b6be1 100644
--- a/conf/messages
+++ b/conf/messages
@@ -241,3 +241,6 @@ tournamentIsStarting=Tournament is starting
nbMinutesPerSidePlusNbSecondsPerMove=%s minutes/side + %s seconds/move
anonymousCanJoin=Anonymous can join
boardEditor=Board editor
+startPosition=Start position
+clearBoard=Clear board
+savePosition=Save position
diff --git a/modules/chess b/modules/chess
index 8575c75138..4b05b5482e 160000
--- a/modules/chess
+++ b/modules/chess
@@ -1 +1 @@
-Subproject commit 8575c75138c073fe88e3ef3fe518926bf0374cbe
+Subproject commit 4b05b5482edc18ac272930699a7b3313ee3fbfe7
diff --git a/modules/i18n/src/main/I18nKeys.scala b/modules/i18n/src/main/I18nKeys.scala
index a9108dc32f..659ff3c1a6 100644
--- a/modules/i18n/src/main/I18nKeys.scala
+++ b/modules/i18n/src/main/I18nKeys.scala
@@ -265,6 +265,9 @@ final class I18nKeys(translator: Translator) {
val nbMinutesPerSidePlusNbSecondsPerMove = new Key("nbMinutesPerSidePlusNbSecondsPerMove")
val anonymousCanJoin = new Key("anonymousCanJoin")
val boardEditor = new Key("boardEditor")
+ val startPosition = new Key("startPosition")
+ val clearBoard = new Key("clearBoard")
+ val savePosition = new Key("savePosition")
- def keys = List(playWithAFriend, inviteAFriendToPlayWithYou, playWithTheMachine, challengeTheArtificialIntelligence, toInviteSomeoneToPlayGiveThisUrl, gameOver, waitingForOpponent, waiting, yourTurn, aiNameLevelAiLevel, level, toggleTheChat, toggleSound, chat, resign, checkmate, stalemate, white, black, createAGame, noGameAvailableRightNowCreateOne, whiteIsVictorious, blackIsVictorious, playWithTheSameOpponentAgain, newOpponent, playWithAnotherOpponent, yourOpponentWantsToPlayANewGameWithYou, joinTheGame, whitePlays, blackPlays, theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim, makeYourOpponentResign, forceResignation, talkInChat, theFirstPersonToComeOnThisUrlWillPlayWithYou, whiteCreatesTheGame, blackCreatesTheGame, whiteJoinsTheGame, blackJoinsTheGame, whiteResigned, blackResigned, whiteLeftTheGame, blackLeftTheGame, shareThisUrlToLetSpectatorsSeeTheGame, youAreViewingThisGameAsASpectator, replayAndAnalyse, computerAnalysisInProgress, theComputerAnalysisYouRequestedIsNowAvailable, theComputerAnalysisHasFailed, viewTheComputerAnalysis, requestAComputerAnalysis, blunders, mistakes, inaccuracies, viewGameStats, flipBoard, threefoldRepetition, claimADraw, offerDraw, draw, nbConnectedPlayers, talkAboutChessAndDiscussLichessFeaturesInTheForum, seeTheGamesBeingPlayedInRealTime, gamesBeingPlayedRightNow, viewAllNbGames, viewNbCheckmates, nbBookmarks, nbPopularGames, nbAnalysedGames, bookmarkedByNbPlayers, viewInFullSize, logOut, signIn, newToLichess, youNeedAnAccountToDoThat, signUp, people, games, forum, xPostedInForumY, chessPlayers, minutesPerSide, variant, timeControl, time, start, username, password, haveAnAccount, allYouNeedIsAUsernameAndAPassword, learnMoreAboutLichess, rank, gamesPlayed, nbGamesWithYou, declineInvitation, cancel, timeOut, drawOfferSent, drawOfferDeclined, drawOfferAccepted, drawOfferCanceled, yourOpponentOffersADraw, accept, decline, playingRightNow, finished, abortGame, gameAborted, standard, unlimited, mode, casual, rated, thisGameIsRated, rematch, rematchOfferSent, rematchOfferAccepted, rematchOfferCanceled, rematchOfferDeclined, cancelRematchOffer, viewRematch, play, inbox, chatRoom, spectatorRoom, composeMessage, sentMessages, noNewMessages, subject, recipient, send, incrementInSeconds, freeOnlineChess, spectators, nbWins, nbLosses, nbDraws, exportGames, color, eloRange, giveNbSeconds, whoIsOnline, allPlayers, premoveEnabledClickAnywhereToCancel, thisPlayerUsesChessComputerAssistance, opening, takeback, proposeATakeback, takebackPropositionSent, takebackPropositionDeclined, takebackPropositionAccepted, takebackPropositionCanceled, yourOpponentProposesATakeback, bookmarkThisGame, toggleBackground, search, advancedSearch, tournament, tournaments, tournamentPoints, viewTournament, freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents, teams, nbMembers, allTeams, newTeam, myTeams, noTeamFound, joinTeam, quitTeam, anyoneCanJoin, aConfirmationIsRequiredToJoin, joiningPolicy, teamLeader, teamBestPlayers, teamRecentMembers, xJoinedTeamY, xCreatedTeamY, averageElo, location, settings, filterGames, reset, apply, leaderboard, pasteTheFenStringHere, pasteThePgnStringHere, fromPosition, continueFromHere, importGame, nbImportedGames, thisIsAChessCaptcha, clickOnTheBoardToMakeYourMove, notACheckmate, colorPlaysCheckmateInOne, retry, reconnecting, onlineFriends, noFriendsOnline, findFriends, favoriteOpponents, follow, following, unfollow, block, blocked, unblock, followsYou, xStartedFollowingY, nbFollowers, nbFollowing, profile, more, memberSince, lastLogin, challengeToPlay, player, list, graph, all, lessThanNbMinutes, xToYMinutes, textIsTooShort, textIsTooLong, required, addToChrome, openTournaments, duration, winner, standing, createANewTournament, join, withdraw, points, wins, losses, winStreak, createdBy, waitingForNbPlayers, tournamentIsStarting, nbMinutesPerSidePlusNbSecondsPerMove, anonymousCanJoin, boardEditor)
+ def keys = List(playWithAFriend, inviteAFriendToPlayWithYou, playWithTheMachine, challengeTheArtificialIntelligence, toInviteSomeoneToPlayGiveThisUrl, gameOver, waitingForOpponent, waiting, yourTurn, aiNameLevelAiLevel, level, toggleTheChat, toggleSound, chat, resign, checkmate, stalemate, white, black, createAGame, noGameAvailableRightNowCreateOne, whiteIsVictorious, blackIsVictorious, playWithTheSameOpponentAgain, newOpponent, playWithAnotherOpponent, yourOpponentWantsToPlayANewGameWithYou, joinTheGame, whitePlays, blackPlays, theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim, makeYourOpponentResign, forceResignation, talkInChat, theFirstPersonToComeOnThisUrlWillPlayWithYou, whiteCreatesTheGame, blackCreatesTheGame, whiteJoinsTheGame, blackJoinsTheGame, whiteResigned, blackResigned, whiteLeftTheGame, blackLeftTheGame, shareThisUrlToLetSpectatorsSeeTheGame, youAreViewingThisGameAsASpectator, replayAndAnalyse, computerAnalysisInProgress, theComputerAnalysisYouRequestedIsNowAvailable, theComputerAnalysisHasFailed, viewTheComputerAnalysis, requestAComputerAnalysis, blunders, mistakes, inaccuracies, viewGameStats, flipBoard, threefoldRepetition, claimADraw, offerDraw, draw, nbConnectedPlayers, talkAboutChessAndDiscussLichessFeaturesInTheForum, seeTheGamesBeingPlayedInRealTime, gamesBeingPlayedRightNow, viewAllNbGames, viewNbCheckmates, nbBookmarks, nbPopularGames, nbAnalysedGames, bookmarkedByNbPlayers, viewInFullSize, logOut, signIn, newToLichess, youNeedAnAccountToDoThat, signUp, people, games, forum, xPostedInForumY, chessPlayers, minutesPerSide, variant, timeControl, time, start, username, password, haveAnAccount, allYouNeedIsAUsernameAndAPassword, learnMoreAboutLichess, rank, gamesPlayed, nbGamesWithYou, declineInvitation, cancel, timeOut, drawOfferSent, drawOfferDeclined, drawOfferAccepted, drawOfferCanceled, yourOpponentOffersADraw, accept, decline, playingRightNow, finished, abortGame, gameAborted, standard, unlimited, mode, casual, rated, thisGameIsRated, rematch, rematchOfferSent, rematchOfferAccepted, rematchOfferCanceled, rematchOfferDeclined, cancelRematchOffer, viewRematch, play, inbox, chatRoom, spectatorRoom, composeMessage, sentMessages, noNewMessages, subject, recipient, send, incrementInSeconds, freeOnlineChess, spectators, nbWins, nbLosses, nbDraws, exportGames, color, eloRange, giveNbSeconds, whoIsOnline, allPlayers, premoveEnabledClickAnywhereToCancel, thisPlayerUsesChessComputerAssistance, opening, takeback, proposeATakeback, takebackPropositionSent, takebackPropositionDeclined, takebackPropositionAccepted, takebackPropositionCanceled, yourOpponentProposesATakeback, bookmarkThisGame, toggleBackground, search, advancedSearch, tournament, tournaments, tournamentPoints, viewTournament, freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents, teams, nbMembers, allTeams, newTeam, myTeams, noTeamFound, joinTeam, quitTeam, anyoneCanJoin, aConfirmationIsRequiredToJoin, joiningPolicy, teamLeader, teamBestPlayers, teamRecentMembers, xJoinedTeamY, xCreatedTeamY, averageElo, location, settings, filterGames, reset, apply, leaderboard, pasteTheFenStringHere, pasteThePgnStringHere, fromPosition, continueFromHere, importGame, nbImportedGames, thisIsAChessCaptcha, clickOnTheBoardToMakeYourMove, notACheckmate, colorPlaysCheckmateInOne, retry, reconnecting, onlineFriends, noFriendsOnline, findFriends, favoriteOpponents, follow, following, unfollow, block, blocked, unblock, followsYou, xStartedFollowingY, nbFollowers, nbFollowing, profile, more, memberSince, lastLogin, challengeToPlay, player, list, graph, all, lessThanNbMinutes, xToYMinutes, textIsTooShort, textIsTooLong, required, addToChrome, openTournaments, duration, winner, standing, createANewTournament, join, withdraw, points, wins, losses, winStreak, createdBy, waitingForNbPlayers, tournamentIsStarting, nbMinutesPerSidePlusNbSecondsPerMove, anonymousCanJoin, boardEditor, startPosition, clearBoard, savePosition)
}
diff --git a/public/javascripts/boardEditor.js b/public/javascripts/boardEditor.js
index 07596264b9..2dd1a0b6e4 100644
--- a/public/javascripts/boardEditor.js
+++ b/public/javascripts/boardEditor.js
@@ -1,8 +1,30 @@
$(function() {
- var board = new ChessBoard('board', {
- draggable: true,
- dropOffBoard: 'trash',
- position: 'start',
- sparePieces: true
+ $('#board_editor').each(function() {
+ var $wrap = $(this);
+ var fen = "";
+
+ function setFen(f) {
+ fen = f;
+ $wrap.find('.fen_string').text(fen);
+ $wrap.find('a.fen_link').each(function() {
+ $(this).attr('href', $(this).attr('href').replace(/fen=[^#]*#/, "fen=" + fen + '#'));
+ });
+ }
+
+ var board = new ChessBoard('chessboard', {
+ draggable: true,
+ dropOffBoard: 'trash',
+ position: 'start',
+ sparePieces: true,
+ pieceTheme: '/assets/vendor/chessboard/img/chesspieces/wikipedia/{piece}.png',
+ onChange: function(oldPos, newPos) {
+ setFen(ChessBoard.objToFen(newPos));
+ }
+ });
+ setFen(board.fen());
+
+ $wrap.find('a.start').on('click', board.start);
+ $wrap.find('a.clear').on('click', board.clear);
+ $wrap.find('a.flip').on('click', board.flip);
});
});
diff --git a/public/stylesheets/boardEditor.css b/public/stylesheets/boardEditor.css
new file mode 100644
index 0000000000..ce8d9712a1
--- /dev/null
+++ b/public/stylesheets/boardEditor.css
@@ -0,0 +1,24 @@
+#board_editor {
+ position: relative;
+}
+#chessboard {
+ width: 392px;
+}
+#chessboard_side {
+ position: absolute;
+ left: 424px;
+ top: 95px;
+ width: 356px;
+}
+#board_editor p.fen_string {
+ font-family: monospace;
+}
+#chessboard_side p {
+ margin-bottom: 2em;
+ text-align: center;
+}
+#board_editor a.button.big {
+ display: block;
+ text-align: center;
+ margin-bottom: 1em;
+}
diff --git a/todo b/todo
index 7b03187325..d888017aa6 100644
--- a/todo
+++ b/todo
@@ -71,6 +71,7 @@ opera bug http://postimg.org/image/zcv8hse8n/full/
customize sound notifications http://imgur.com/70WVyb5
show friend game results on timeline
profile tweaks proposed by clarkey http://i.imgur.com/C57qoRC.jpg
+bullet < 3 min
---