reload analysis view when a move is played - fixes #something

pull/1291/head
Thibault Duplessis 2015-12-06 17:59:19 +07:00
parent f35857e159
commit bcc8c749ad
2 changed files with 11 additions and 1 deletions

View File

@ -64,6 +64,7 @@ module.exports = function(cfg, saveUrl) {
fixAll();
var reloadToLastPly = function() {
loading(true);
if (window.history.replaceState) window.history.replaceState(null, null, '#last');
location.reload();
};
@ -141,6 +142,7 @@ module.exports = function(cfg, saveUrl) {
loading: loading,
onMyTurn: cfg.onMyTurn,
findStartingWithStep: findStartingWithStep,
playAndSave: playAndSave
playAndSave: playAndSave,
reloadToLastPly: reloadToLastPly
};
};

View File

@ -7,6 +7,10 @@ module.exports = function(send, ctrl) {
var anaDestsCache = {};
setTimeout(function() {
send("startWatching", ctrl.data.game.id);
}, 1000);
var handlers = {
step: function(data) {
ctrl.addStep(data.step, data.path);
@ -25,6 +29,10 @@ module.exports = function(send, ctrl) {
destsFailure: function(data) {
console.log(data);
clearTimeout(anaDestsTimeout);
},
fen: function(e) {
if (ctrl.forecast && e.id === ctrl.data.game.id)
ctrl.forecast.reloadToLastPly();
}
};