This repository was archived by the owner on Feb 22, 2022. It is now read-only.
Commit a765535 Rudis Muiznieks
committed
1 parent 5794db2 commit a765535 Copy full SHA for a765535
File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
class Player
2
- constructor : (@story , @id ) ->
2
+ constructor : (
3
+ @story ,
4
+ @id ,
5
+ @startText = " Click to start..." ,
6
+ @endText = ' ## The End\n\n You have reached the end of this story. <a id="restart" href="">Click here</a> to start over.'
7
+ ) ->
3
8
@converter = new Markdown.Converter ()
4
9
@container = $ (" ##{ @id } " )
5
10
@container .addClass (' ficdown' ).data ' player' , this
@@ -11,7 +16,7 @@ class Player
11
16
scene .id = " s#{ ++ i} " for scene in scenes for key, scenes of @story .scenes
12
17
13
18
play : ->
14
- @container .html @converter .makeHtml " ##{ @story .name } \n\n #{ @story .description } \n\n [Click to start... ](/#{ @story .firstScene } )"
19
+ @container .html @converter .makeHtml " ##{ @story .name } \n\n #{ @story .description } \n\n [#{ @startText } ](/#{ @story .firstScene } )"
15
20
@ wireLinks ()
16
21
17
22
wireLinks : ->
@@ -64,7 +69,7 @@ class Player
64
69
65
70
checkGameOver : ->
66
71
if @container .find (' a:not(.disabled):not(.external)' ).length == 0
67
- @container .append @converter .makeHtml ' ## The End \n\n You have reached the end of this story. <a id="restart" href="">Click here</a> to start over. '
72
+ @container .append @converter .makeHtml @endText
68
73
$ (' #restart' ).data (' info' , [@id , @story ]).click ->
69
74
info = $ (this ).data ' info'
70
75
$ (" ##{ info[0 ]} " ).empty ()
You can’t perform that action at this time.
0 commit comments