+}
+
+var onSnapEnd = function(source, target) {
+ var pseudogame = new Chess(current_display_fen());
+ var move = pseudogame.move({
+ from: source,
+ to: target,
+ promotion: 'q' // NOTE: always promote to a queen for example simplicity
+ });
+
+ make_move(pseudogame.history({ verbose: true }).pop().san);
+}
+
+var onpopstate = function() {
+ var old_moves = game.history({ verbose: true }).map(function(x) { return x.san; });
+ var new_moves = document.location.search.replace(/^\?/, "").split(",");