forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
139 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "public/vendor/pgn4web"] | ||
path = public/vendor/pgn4web | ||
url = git:https://github.com/ornicar/pgn4web.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@(title: String, goodies: Option[Html] = None, moreCss: Html = Html(""), moreJs: Html = Html(""))(body: Html)(implicit ctx: Context) | ||
|
||
@base.layout( | ||
title = title, | ||
goodies = goodies, | ||
active = siteMenu.game.some, | ||
moreCss = moreCss, | ||
moreJs = moreJs)(body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
@(pov: Pov, info: lila.analyse.GameInfo)(implicit ctx: Context) | ||
|
||
@import pov._ | ||
|
||
@moreCss = { | ||
@cssVendorTag("pgn4web/fonts/pgn4web-fonts.css") | ||
@cssTag("analyse.css") | ||
} | ||
|
||
@moreJs = { | ||
@jsVendorTag("pgn4web/pgn4web.js") | ||
@jsTag("analyse.js") | ||
} | ||
|
||
@goodies = { | ||
<div class="lichess_goodies"> | ||
<br /> | ||
<div class="box"> | ||
@if(game.isBeingPlayed) { | ||
<a class="link" href="@routes.Round.watcher(gameId, color.name)"> | ||
@trans.playingRightNow() | ||
</a> | ||
} else { | ||
@game.updatedAt.map(showDate) | ||
} | ||
@if(game.finishedOrAborted) { | ||
<br />@gameEndStatus(game) | ||
} | ||
<br /> | ||
<br /> | ||
<div id="player_links"> | ||
@List(opponent, player).map { p => | ||
<div> | ||
@p.aiLevel.map { l => | ||
@trans.aiNameLevelAiLevel(aiName, l) | ||
}.getOrElse { | ||
@playerLink(p) | ||
} | ||
</div> | ||
} | ||
</div> | ||
<br /> | ||
@trans.variant() - @variantName(game.variant)<br /> | ||
@trans.timeControl() - @clockName(game.clock)<br /> | ||
@if(game.rated) { | ||
@trans.thisGameIsRated()<br /> | ||
} | ||
@trans.opening() - | ||
@info.opening.map { o => | ||
<a href="http:https://www.chessgames.com/perl/[email protected]">@o.code @o.name</a><br /> | ||
}.getOrElse { "Unknown" } | ||
</div> | ||
<br /> | ||
<a class="rotate_board" href="@routes.Analyse.replay(gameId, (!color).name)">@trans.flipBoard()</a><br /> | ||
<br /> | ||
Export PGN: | ||
<textarea id="pgnText" readonly="readonly">@Html(info.pgn)</textarea> | ||
</div> | ||
} | ||
|
||
@analyse.layout( | ||
title = trans.replayAndAnalyse() + " " + gameId, | ||
goodies = goodies.some, | ||
moreCss = moreCss, | ||
moreJs = moreJs) { | ||
<div class="analyse clearfix"> | ||
<div class="board_wrap"> | ||
<div id="GameBoard"@color.fold("", " class='flip'")></div> | ||
<div id="GameButtons"></div> | ||
</div> | ||
<div class="moves_wrap"> | ||
<h1>@trans.replayAndAnalyse()</h1> | ||
<div id="GameText"></div> | ||
</div> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
jQuery(function() { | ||
SetImagePath("/vendor/pgn4web/lichess/64"); // use "" path if images are in the same folder as this javascript file | ||
SetImageType("png"); | ||
SetImagePath("/assets/vendor/pgn4web/lichess/64"); // use "" path if images are in the same folder as this javascript file | ||
SetImageType("png"); | ||
}); | ||
|
||
function customFunctionOnPgnGameLoad() { | ||
var $text = $('#ShowPgnText'); | ||
var html = '<table><tbody><tr>'; | ||
$text.find('span.move').remove(); | ||
$text.find('>span').each(function(it) { | ||
if (0 == it%2) { | ||
html += '</tr><tr><th>' + (it/2+1) + '.</th>'; | ||
} | ||
html += '<td>' + this.innerHTML + '</td>'; | ||
}); | ||
html += '</tr></tbody></table>'; | ||
$text.html(html).find('tr:empty').remove(); | ||
var $text = $('#ShowPgnText'); | ||
var html = '<table><tbody><tr>'; | ||
$text.find('span.move').remove(); | ||
$text.find('>span').each(function(it) { | ||
if (0 == it%2) { | ||
html += '</tr><tr><th>' + (it/2+1) + '.</th>'; | ||
} | ||
html += '<td>' + this.innerHTML + '</td>'; | ||
}); | ||
html += '</tr></tbody></table>'; | ||
$text.html(html).find('tr:empty').remove(); | ||
|
||
$('div.lichess_goodies a.rotate_board').click(function() { | ||
$('#GameBoard').toggleClass('flip'); | ||
$('#player_links div:first').appendTo($('#player_links')); | ||
redrawBoardMarks(); | ||
return false; | ||
}); | ||
redrawBoardMarks(); | ||
$('div.lichess_goodies a.rotate_board').click(function() { | ||
$('#GameBoard').toggleClass('flip'); | ||
$('#player_links div:first').appendTo($('#player_links')); | ||
redrawBoardMarks(); | ||
return false; | ||
}); | ||
redrawBoardMarks(); | ||
} | ||
|
||
function redrawBoardMarks() { | ||
jQuery.displayBoardMarks($('#GameBoard'), ! $('#GameBoard').hasClass('flip')); | ||
jQuery.displayBoardMarks($('#GameBoard'), ! $('#GameBoard').hasClass('flip')); | ||
} |
Submodule pgn4web
added at
8255c1