From e9c6f0bb743548071f5999b210fa5a8496647fae Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 26 Nov 2018 22:29:41 -1000 Subject: chess moves: link to branches in full view --- lib/render-msg.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/render-msg.js b/lib/render-msg.js index 39550ac..7d50ef8 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -1435,10 +1435,16 @@ RenderMsg.prototype.chessMoveFull = function (cb) { var fen = c.fen && c.fen.length === 2 ? c.pgnMove : c.fen var game = parseChess(fen) var piece = game && lookupPiece(game.board, c.dest) - self.link(self.c.root, function (err, rootLink) { + var done = multicb({pluck: 1, spread: true}) + self.link(self.c.root, done()) + self.links(self.c.branch, done()) + done(function (err, rootLink, branchLinks) { if (err) return cb(err) self.wrap([ - h('div', h('small', '> ', rootLink)), + rootLink ? h('div', h('small', h('span.symbol', '→'), ' ', rootLink)) : '', + branchLinks.map(function (a, i) { + return h('div', h('small', h('span.symbol', '  ↳'), ' ', a)) + }), h('p', // 'player ', (c.ply || ''), ' ', 'moved ', (piece ? [renderChessSymbol(piece), ' '] : ''), -- cgit v1.2.3