fixed restart link at end of game

This commit is contained in:
Rudis Muiznieks 2014-07-03 16:21:56 -05:00
parent f342b4f1fa
commit df228633c8
1 changed files with 6 additions and 4 deletions

View File

@ -65,11 +65,13 @@ class Player
checkGameOver: -> checkGameOver: ->
if @container.find('a:not(.disabled):not(.external)').length == 0 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. <a id="restart" href="">Click here</a> to start over.' @container.append @converter.makeHtml '## The End\n\nYou have reached the end of this story. <a id="restart" href="">Click here</a> to start over.'
$('#restart').click -> $('#restart').data('info', [@id, @story]).click ->
@container.empty() info = $(this).data 'info'
player = new Player @story, @id $("##{info[0]}").empty()
$("##{@id}").data 'player', player player = new Player info[1], info[0]
$("##{info[0]}").data 'player', player
player.play() player.play()
return false
handleHref: (href) -> handleHref: (href) ->
match = matchHref href match = matchHref href