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: ->
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.'
$('#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