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