Skip to content

Commit

Permalink
Merge branch 'master' into tree-parts
Browse files Browse the repository at this point in the history
* master:
  secure embedded JS
  reduce JSON size a little
  fix analysis ceval gauge
  Resolve #1494 using winning odds eval gauge
  fixes #1874
  don't show studies to everyone yet
  ta "தமிழ்" translation #16484. Author: V1chess.
  • Loading branch information
ornicar committed May 12, 2016
2 parents 74f39d7 + bcfc2b4 commit e937dad
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
5 changes: 4 additions & 1 deletion app/templating/AssetHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ trait AssetHelper { self: I18nHelper =>
s"""<script src="${static.fold(staticUrl(path), path)}?v=$assetVersion"></script>"""
}

def embedJs(js: String): Html = Html(s"""<script>/* <![CDATA[ */ $js /* ]]> */</script>""")
def embedJs(js: String): Html = Html {
val escaped = js.replace("</script", "<|script")
s"""<script>$escaped</script>"""
}
def embedJs(js: Html): Html = embedJs(js.body)
}
2 changes: 1 addition & 1 deletion app/views/user/show.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1 class="lichess_title"><span@if(isOnline(u.id)) { class="connected" title="On
<a class="intertab">@splitNumber(nb + " Blockers")</a>
}
<a href="@routes.UserTournament.path(u.username, "recent")" class="intertab tournament_stats" data-toints="@u.toints">@splitNumber(u.toints + " " + trans.tournamentPoints())</a>
@if(info.nbStudies > 0) {
@if(isGranted(_.Beta) && info.nbStudies > 0) {
<a href="@routes.Study.byOwner(u.username)" class="intertab">@splitNumber(info.nbStudies + " studies")</a>
}
<a class="intertab" href="@routes.ForumPost.search("user:" + u.username, 1)">@splitNumber(trans.nbForumPosts(info.nbPosts))</a>
Expand Down
2 changes: 1 addition & 1 deletion conf/base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ net {
ip = "5.196.91.160"
asset {
domain = ${net.domain}
version = 913
version = 914
}
}
forcedev = false
Expand Down
1 change: 1 addition & 0 deletions modules/i18n/messages/messages.ta
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ randomColor=ஏதாவது ஒரு நிறம்
createAGame=ஆட்டமொன்றை உருவாக்கு
whiteIsVictorious=வெள்ளை வென்றது
blackIsVictorious=கருப்பு வென்றது
threeChecks=மூன்று காசோலைகளை
newOpponent=புது எதிராளி
yourOpponentWantsToPlayANewGameWithYou=நும் எதிராளி நும்மோடு புது ஆட்டமாட விரும்புகிறார்
joinTheGame=ஆட்டத்திலே சேர்
Expand Down
5 changes: 1 addition & 4 deletions modules/study/src/main/JsonView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ final class JsonView(lightUser: LightUser.Getter) {
studyWrites.writes(study) ++ Json.obj("chapters" -> chapters.map(chapterMetadataWrites.writes))

private implicit val lightUserWrites = OWrites[LightUser] { u =>
Json.obj(
"id" -> u.id,
"name" -> u.name,
"title" -> u.title)
Json.obj("id" -> u.id, "name" -> u.name, "title" -> u.title).noNull
}

private[study] implicit val memberRoleWrites = Writes[StudyMember.Role] { r =>
Expand Down
3 changes: 0 additions & 3 deletions public/stylesheets/analyse.css
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,6 @@ body.dark .explorer_box .black {
position: relative;
padding: 2px 7px;
}
.lichess_ground .replay turn > move {
min-width: 40%;
}
.lichess_ground .replay move.current {
background: rgba(191, 231, 255, 0.7);
}
Expand Down
10 changes: 5 additions & 5 deletions ui/analyse/src/ceval/cevalView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ var classSet = require('chessground').util.classSet;

var gaugeLast = 0;
var gaugeTicks = [];
for (var i = 1; i < 10; i++) gaugeTicks.push(m(i === 5 ? 'tick.zero' : 'tick', {
for (var i = 1; i < 8; i++) gaugeTicks.push(m(i === 4 ? 'tick.zero' : 'tick', {
style: {
height: (i * 10) + '%'
height: (i * 12.5) + '%'
}
}));

Expand All @@ -17,12 +17,12 @@ module.exports = {
var eval, evs = ctrl.currentEvals();
if (evs) {
if (defined(evs.fav.cp))
eval = Math.min(Math.max(evs.fav.cp / 100, -5), 5);
eval = 2 / (1 + Math.exp(-0.005 * evs.fav.cp)) - 1;
else
eval = evs.fav.mate > 0 ? 5 : -5;
eval = evs.fav.mate > 0 ? 1 : -1;
gaugeLast = eval;
} else eval = gaugeLast;
var height = 100 - (eval + 5) * 10;
var height = 100 - (eval + 1) * 50;
return m('div', {
class: classSet({
eval_gauge: true,
Expand Down

0 comments on commit e937dad

Please sign in to comment.