toggle analysis comments with keyboard
parent
b9728e9d5b
commit
f32d659d17
|
@ -32,8 +32,7 @@ i18n: @round.jsI18n()
|
|||
<ul>
|
||||
<li><strong>h</strong>/<strong>l</strong> or <strong>←</strong>/<strong>→</strong> move backward/forward</li>
|
||||
<li><strong>j</strong>/<strong>k</strong> or <strong>↑</strong>/<strong>↓</strong> go to start/end</li>
|
||||
<li><strong>i</strong>/<strong>o</strong> go to previous/next mistake</li>
|
||||
<li><strong>p</strong> show/hide comments</li>
|
||||
<li><strong>c</strong> show/hide comments</li>
|
||||
</ul>
|
||||
You can also scroll over the board to move in the game.
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,8 @@ module.exports = function(cfg, router, i18n, onChange) {
|
|||
path: initialPath,
|
||||
pathStr: treePath.write(initialPath),
|
||||
situation: null,
|
||||
continue: false
|
||||
continue: false,
|
||||
comments: true
|
||||
};
|
||||
|
||||
var situationCache = {};
|
||||
|
|
|
@ -30,4 +30,13 @@ module.exports = function(ctrl) {
|
|||
control.last(ctrl);
|
||||
m.redraw();
|
||||
}));
|
||||
k.bind('c', preventing(function() {
|
||||
ctrl.vm.comments = !ctrl.vm.comments;
|
||||
if (!ctrl.vm.comments && ctrl.vm.path.length > 1) {
|
||||
path = [ctrl.vm.path[0]];
|
||||
path[0].variation = null;
|
||||
ctrl.jump(path);
|
||||
}
|
||||
m.redraw();
|
||||
}));
|
||||
};
|
||||
|
|
|
@ -78,6 +78,7 @@ function renderOpening(ctrl, opening) {
|
|||
}
|
||||
|
||||
function renderMeta(ctrl, move, path) {
|
||||
if (!ctrl.vm.comments) return;
|
||||
var opening = ctrl.data.game.opening;
|
||||
opening = (move && opening && opening.size == move.ply) ? renderOpening(ctrl, opening) : null;
|
||||
if (!move || (!opening && !move.comments.length && !move.variations.length)) return;
|
||||
|
|
Loading…
Reference in New Issue