lol hack to avoid loading chessground twice on play/watch pages

pull/185/head
Thibault Duplessis 2014-12-22 23:34:13 +01:00
parent 29ffe3871b
commit 4d82fb6679
6 changed files with 16 additions and 7 deletions

View File

@ -11,7 +11,8 @@ robots: Boolean = true,
moreCss: Html = Html(""),
moreJs: Html = Html(""),
zen: Boolean = false,
openGraph: Map[Symbol, String] = Map.empty)(body: Html)(implicit ctx: Context)
openGraph: Map[Symbol, String] = Map.empty,
chessground: Boolean = true)(body: Html)(implicit ctx: Context)
<!doctype html>
<html lang="@lang.language">
<head>
@ -271,7 +272,7 @@ openGraph: Map[Symbol, String] = Map.empty)(body: Html)(implicit ctx: Context)
</div>
}
@jQueryTag
@jsTag("vendor/chessground.min.js")
@if(chessground) {@jsTag("vendor/chessground.min.js")}
@jsTag("deps.min.js")
@momentjsTag
@powertipTag

View File

@ -1,4 +1,4 @@
@(title: String, side: Html, chat: Option[Html] = None, underchat: Option[Html] = None, robots: Boolean = true, moreJs: Html = Html(""), active: Option[lila.app.ui.SiteMenu.Elem] = None, openGraph: Map[Symbol, String] = Map.empty, moreCss: Html = Html(""))(body: Html)(implicit ctx: Context)
@(title: String, side: Html, chat: Option[Html] = None, underchat: Option[Html] = None, robots: Boolean = true, moreJs: Html = Html(""), active: Option[lila.app.ui.SiteMenu.Elem] = None, openGraph: Map[Symbol, String] = Map.empty, moreCss: Html = Html(""), chessground: Boolean = true)(body: Html)(implicit ctx: Context)
@base.layout(
title = title,
@ -9,4 +9,5 @@ underchat = underchat,
robots = robots,
openGraph = openGraph,
moreJs = moreJs,
moreCss = moreCss)(body)
moreCss = moreCss,
chessground = chessground)(body)

View File

@ -23,7 +23,8 @@ side = views.html.game.side(pov, tour, withTourStanding = true),
chat = pov.game.hasChat.option(base.chatDom(trans.chatRoom.str(), ctx.isAuth)),
underchat = views.html.game.watchers().some,
moreJs = moreJs,
openGraph = povOpenGraph(pov)) {
openGraph = povOpenGraph(pov),
chessground = false) {
<div class="round cg-512">@miniBoardContent</div>
<div class="crosstable" style="display:none">
@cross.map { c =>

View File

@ -23,7 +23,8 @@ side = views.html.game.side(pov, tour, withTourStanding = false, userTv = userTv
chat = base.chatDom(trans.spectatorRoom.str()).some,
underchat = views.html.game.watchers().some,
moreJs = moreJs,
openGraph = povOpenGraph(pov)) {
openGraph = povOpenGraph(pov),
chessground = false) {
<div class="round cg-512">@miniBoardContent</div>
<div class="crosstable" style="display:none">
@cross.map { c =>

View File

@ -21,7 +21,8 @@ side = side(pov, games, streams),
underchat = game.watchers().some,
active = siteMenu.tv.some,
moreJs = moreJs,
moreCss = cssTag("tv.css")) {
moreCss = cssTag("tv.css"),
chessground = false) {
<div class="round cg-512">
@miniBoardContent
</div>

View File

@ -16,3 +16,7 @@ module.exports = function(opts) {
moveOn: controller.moveOn
};
};
// lol, that's for the rest of lichess to access mithril
// without having to include it a second time
window.Chessground = require('chessground');