From df228633c894095b67b29531bc17e8448186358e Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Thu, 3 Jul 2014 16:21:56 -0500 Subject: [PATCH] fixed restart link at end of game --- src/player.coffee | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/player.coffee b/src/player.coffee index deb9586..9704cf7 100644 --- a/src/player.coffee +++ b/src/player.coffee @@ -65,11 +65,13 @@ class Player checkGameOver: -> if @container.find('a:not(.disabled):not(.external)').length == 0 @container.append @converter.makeHtml '## The End\n\nYou have reached the end of this story. Click here to start over.' - $('#restart').click -> - @container.empty() - player = new Player @story, @id - $("##{@id}").data 'player', player + $('#restart').data('info', [@id, @story]).click -> + info = $(this).data 'info' + $("##{info[0]}").empty() + player = new Player info[1], info[0] + $("##{info[0]}").data 'player', player player.play() + return false handleHref: (href) -> match = matchHref href