Skip to content

Commit 1eeb172

Browse files
committed
Write page title
1 parent 27ebad7 commit 1eeb172

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

storyteller/scripted.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
! Script Editor
2+
3+
script ScriptEditor
4+
5+
div Body
6+
div Container
7+
div Buttons
8+
div ContentDiv
9+
textarea ContentEditor
10+
span Status
11+
button Save
12+
variable File
13+
variable Content
14+
variable Current
15+
16+
set the title to `Script Editor`
17+
18+
create Body
19+
create Container in Body
20+
set the style of Container to `width:70%;margin:0 auto;background #ffe`
21+
22+
create Buttons in Container
23+
set the style of Buttons to `text-align:center`
24+
25+
create Save in Buttons
26+
set the text of Save to `Save`
27+
create Status in Buttons
28+
set the style of Status to `position:absolute;float:right;padding-left:2em;color:green`
29+
30+
create ContentDiv in Container
31+
set the style of ContentDiv to `width:100%;height:95%;border:1px solid lightgray`
32+
33+
create ContentEditor in ContentDiv
34+
set the style of ContentEditor to `width:100%;height:100%`
35+
36+
codemirror init basic profile `/codemirror-ecs.js`
37+
require css `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/dialog/dialog.css`
38+
require js `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/dialog/dialog.js`
39+
require js `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/search/search.js`
40+
require js `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/search/searchcursor.js`
41+
require js `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/search/jump-to-line.js`
42+
43+
put empty into Current
44+
45+
on click Save
46+
begin
47+
codemirror close ContentEditor
48+
put the content of ContentEditor into Content
49+
if Content is not Current
50+
begin
51+
rest post Content to `save/storyteller.txt`
52+
put Content into Current
53+
set the content of Status to `Script saved`
54+
fork to ResetStatus
55+
end
56+
else
57+
begin
58+
set the content of Status to `Nothing has changed`
59+
fork to ResetStatus
60+
end
61+
codemirror attach to ContentEditor
62+
end
63+
64+
SelectFile:
65+
put `storyteller.txt` into File
66+
rest get Content from `/` cat File
67+
put Content into Current
68+
set the content of Status to `Script '` cat File cat `' loaded`
69+
fork to ResetStatus
70+
set the title to File
71+
72+
codemirror attach to ContentEditor
73+
codemirror set content of ContentEditor to Content
74+
stop
75+
76+
ResetStatus:
77+
wait 2
78+
set the content of Status to ``
79+
stop

storyteller/storyteller.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
create TitleDiv in Content
105105
create ButtonBar in Content
106106
create TopicText in Content
107+
108+
rest get Title from `/stories/title.txt`
109+
set the title to Title
107110

108111
gosub to SetupTheme
109112
gosub to CreateButtons

0 commit comments

Comments
 (0)