Merge branch 'master' into tourneyMithril

* master:
  simplify analysis view code
  analysis board: allow going back to initial position
  use FEN enpassant flag - fixes #190
  tweak order of variants in AI game setup
  tweak analysis back button behavior - resolves #191
  resync correspondence clocks on takeback
  fix takeback last move time - resolves #192
  bs "bosanski jezik" translation #11657. Author: gus_fring.
  nb "Norsk bokmål" translation #11656. Author: phaedrus_.
  vastly simplify JS clock
  expose analysis chessground - fixes #181
  lobby playing mithril key - fixes #194
  tweak lobby variant separator
  Swap j, k key bindings to be consistent with vi

Conflicts:
	public/javascripts/big.js
This commit is contained in:
Thibault Duplessis 2015-01-05 09:50:49 +01:00
commit c97ccd1427
13 changed files with 38 additions and 25 deletions

View file

@ -43,8 +43,9 @@ trait SetupHelper { self: I18nHelper =>
variantTuple(Variant.FromPosition)
def translatedVariantChoicesWithFenAndKingOfTheHill(implicit ctx: Context) =
translatedVariantChoicesWithFen(ctx) :+
variantTuple(Variant.KingOfTheHill)
translatedVariantChoices(ctx) :+
variantTuple(Variant.KingOfTheHill) :+
variantTuple(Variant.FromPosition)
def translatedVariantChoicesWithVariantsAndFen(implicit ctx: Context) =
translatedVariantChoicesWithVariants :+

View file

@ -88,6 +88,7 @@ oneDay=Jedan dan
nbDays=%s dana
nbHours=%s sati
time=Vrijeme
rating=Rejting
username=Korisničko ime
password=Lozinka
haveAnAccount=Već imate račun?

View file

@ -88,6 +88,7 @@ oneDay=Én dag
nbDays=%s dager
nbHours=%s timer
time=Tid
rating=Rating
username=Brukernavn
password=Passord
haveAnAccount=Har du en konto?

@ -1 +1 @@
Subproject commit 0cefcae7c8ed7a9f26b07d109c398079178a35ce
Subproject commit e0989842735e58803c2ac20b2548c4d8f8c03ac2

View file

@ -29,11 +29,14 @@ object Rewind {
castleLastMoveTime = CastleLastMoveTime(
castles = rewindedHistory.castles,
lastMove = rewindedHistory.lastMove,
lastMoveTime = Some(nowSeconds - game.createdAt.getSeconds.toInt),
lastMoveTime = Some(((nowMillis - game.createdAt.getMillis) / 100).toInt),
check = if (rewindedSituation.check) rewindedSituation.kingPos else None),
binaryMoveTimes = BinaryFormat.moveTime write (game.moveTimes take rewindedGame.turns),
status = game.status,
clock = game.clock map (_.takeback))
Progress(game, newGame, newGame.clock.map(Event.Clock.apply).toList)
Progress(game, newGame, List(
newGame.clock.map(Event.Clock.apply),
newGame.correspondenceClock.map(Event.CorrespondenceClock.apply)
).flatten)
}
}

View file

@ -80,6 +80,7 @@ trait Positional { self: Config =>
case sit@SituationPlus(Situation(board, _), _) => game.copy(
variant = Variant.FromPosition,
castleLastMoveTime = game.castleLastMoveTime.copy(
lastMove = board.history.lastMove,
castles = board.history.castles
),
turns = sit.turns)

View file

@ -1063,7 +1063,7 @@ lichess.storage = {
var startTournamentClock = function() {
$("div.game_tournament div.clock").each(function() {
$(this).clock({
time: $(this).data("time")
time: parseFloat($(this).data("time"))
});
});
};
@ -1374,7 +1374,6 @@ lichess.storage = {
_show: function() {
this.$time.html(this._formatDate(new Date(this.options.time)));
},
_formatDate: function(date) {
var minutes = this._prefixInteger(date.getUTCMinutes(), 2);
var seconds = this._prefixInteger(date.getSeconds(), 2);
@ -1388,7 +1387,6 @@ lichess.storage = {
return b(minutes) + ':' + b(seconds);
}
},
_prefixInteger: function(num, length) {
return (num / Math.pow(10, length)).toFixed(length).substr(2);
}

View file

@ -25,14 +25,15 @@ module.exports = {
prev: function(ctrl) {
var p = ctrl.vm.path;
var len = p.length;
if (len == 1) {
if (p[0].ply == 1) return;
if (len === 1) {
if (p[0].ply === 0) return;
p[0].ply--;
} else {
if (p[len - 1].ply > p[len - 2].ply) p[len - 1].ply--;
else {
p.pop();
p[len - 2].variation = null;
if (p[len - 2].ply > 1) p[len - 2].ply--;
}
}
ctrl.jump(p);

View file

@ -23,11 +23,11 @@ module.exports = function(ctrl) {
control.next(ctrl);
m.redraw();
}));
k.bind(['up', 'j'], preventing(function() {
k.bind(['up', 'k'], preventing(function() {
control.first(ctrl);
m.redraw();
}));
k.bind(['down', 'k'], preventing(function() {
k.bind(['down', 'j'], preventing(function() {
control.last(ctrl);
m.redraw();
}));

View file

@ -24,3 +24,7 @@ module.exports = function(element, config, router, i18n, onChange) {
}
};
};
// lol, that's for the rest of lichess to access mithril
// without having to include it a second time
window.Chessground = require('chessground');

View file

@ -270,20 +270,22 @@ function buttons(ctrl) {
m('div.jumps.hint--bottom', {
'data-hint': 'Tip: use your keyboard arrow keys!'
}, [
['first', 'W', control.first],
['first', 'W', control.first, ],
['prev', 'Y', control.prev],
['next', 'X', control.next],
['last', 'V', control.last]
].map(function(b) {
var enabled = true;
return m('a', {
class: 'button ' + b[0] + ' ' + classSet({
disabled: (ctrl.broken || !enabled),
glowing: ctrl.vm.late && b[0] === 'last'
}),
'data-icon': b[1],
onclick: enabled ? partial(b[2], ctrl) : null
});
return {
tag: 'a',
attrs: {
class: 'button ' + b[0] + ' ' + classSet({
disabled: ctrl.broken,
glowing: ctrl.vm.late && b[0] === 'last'
}),
'data-icon': b[1],
onclick: partial(b[2], ctrl)
}
};
})),
m('a.button.hint--bottom', flipAttrs, m('span[data-icon=B]')),
ctrl.data.inGame ? null : m('a.button.hint--bottom', {

View file

@ -13,8 +13,9 @@ module.exports = function(ctrl) {
return m('div#now_playing',
ctrl.data.nowPlaying.map(function(pov) {
return m('a', {
key: pov.id,
href: '/' + pov.fullId,
class: (pov.isMyTurn ? 'my_turn' : '')
class: pov.isMyTurn ? 'my_turn' : ''
}, [
m('span', {
class: 'mini_board mini_board_' + pov.id + ' parse_fen is2d',

View file

@ -37,11 +37,11 @@ module.exports = {
next(ctrl);
m.redraw();
}));
k.bind(['up', 'j'], preventing(function() {
k.bind(['up', 'k'], preventing(function() {
ctrl.replay.jump(1);
m.redraw();
}));
k.bind(['down', 'k'], preventing(function() {
k.bind(['down', 'j'], preventing(function() {
ctrl.replay.jump(ctrl.data.game.moves.length);
m.redraw();
}));