-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
222 lines (212 loc) Β· 15.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
ο»Ώ<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tracitor - a Tracery editor</title>
<!-- Main CSS file -->
<link href="CSS/Style.css" rel="stylesheet" />
<!-- JQuery CDN -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- clipboard-polyfill CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard-polyfill/2.8.6/clipboard-polyfill.promise.js"></script>
<!-- Bootstrap CSS CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<!-- Popper JS CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<!-- Bootstrap JavaScript CDN -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<!-- beautifier.io [JS] CDN -->
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.10.3/js/lib/beautify.js"></script>
<!-- SortableJS CDN -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<!-- Tracery file -->
<script defer src="JS/tracery.js"></script>
<!-- Main JS file -->
<script src="JS/Script.js"></script>
</head>
<body>
<!-- Navbar & collapsable content(FAQ) -->
<div class="pos-f-t">
<div class="collapse" id="navbarToggleExternalContent">
<div class="bg-dark p-4">
<div class="accordion" id="navAccordionDiv">
<div class="card bg-dark">
<div class="card-header" id="navAccordionHeadingOne" data-toggle="collapse" data-target="#navAccordionCollapseOne" aria-expanded="true" aria-controls="navAccordionCollapseOne">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
What is this?
</button>
</h2>
</div>
<div id="navAccordionCollapseOne" class="collapse" aria-labelledby="navAccordionHeadingOne" data-parent="#navAccordionDiv">
<div class="card-body bg-light">
<p>An editor for <a href="https://www.tracery.io/" target="_blank">Tracery</a>, made with a simple UI.</p>
</div>
</div>
</div>
<div class="card bg-dark">
<div class="card-header" id="navAccordionHeadingTwo" data-toggle="collapse" data-target="#navAccordionCollapseTwo" aria-expanded="true" aria-controls="navAccordionCollapseTwo">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
How do I use it?
</button>
</h2>
</div>
<div id="navAccordionCollapseTwo" class="collapse" aria-labelledby="navAccordionHeadingTwo" data-parent="#navAccordionDiv">
<div class="card-body bg-light">
<p><b>JSON editor</b><br />
The JSON editor works the same way as <a href="https://www.tracery.io/" target="_blank">Tracery</a> does. Fill in your Tracery grammar JSON object and click on 'π Generate story'. The start symbol for the Tracery grammar is always 'origin', so make sure that you have a symbol called 'origin' that refers to the rest of your symbols for the application to work. The button titled 'π Copy JSON to the clipboard' copies the JSON object to the clipboard for use and/or storage outside of this application.<br /><br />
<b>Simple editor</b><br />
The simple editor works in a similar way to the JSON editor. You create a symbol by giving it a title in the first field and a rules in the second field(separated by commas). To add another symbol, click the button titled 'βοΈ Add another symbol'. Once your symbols are all set up, you can put it all together in the big textarea below the symbol input fields by refering to the symbols by their name(s) surrounded with '#'s, e.g. #animal# for a symbol with the title 'animal'. Finally you click 'π Generate story' to see the result. The button titled 'π Copy JSON to the clipboard' copies the template for your current story to the clipboard for use and/or storage outside of this application. To import a saved story, paste the information in the JSON editor and click on 'π Generate story'.<br /><br />
<b>View generated story</b><br />
Here you will see the result of the generated story that you have created. Click on 'π Copy the story to the clipboard' to copy the story in the textarea. Click on 'π Reroll story' to generate a new random story from the symbols that you have created in either the JSON editor or in the Simple Editor.<br /><br />
For a more extensive explanation on how to use Tracery within this editor, either visit the <a href="https://github.com/galaxykate/tracery/" target="_blank">Tracery Github page</a> or this <a href="http://www.crystalcodepalace.com/traceryTut.html" target="_blank">Tracery turorial</a>.</p>
</div>
</div>
</div>
<div class="card bg-dark">
<div class="card-header" id="navAccordionHeadingThree" data-toggle="collapse" data-target="#navAccordionCollapseThree" aria-expanded="true" aria-controls="navAccordionCollapseThree">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
Where can I learn more about this project?
</button>
</h2>
</div>
<div id="navAccordionCollapseThree" class="collapse" aria-labelledby="navAccordionHeadingThree" data-parent="#navAccordionDiv">
<div class="card-body bg-light">
<p>Either by going to the <a href="https://github.com/theAwesomeFufuman/Tracitor" target="_blank">Github repository</a> for the project, or by sending an email to tracitor[dot]contact[at]gmail[dot]com</p>
</div>
</div>
</div>
<div class="card bg-dark">
<div class="card-header" id="navAccordionHeadingFour" data-toggle="collapse" data-target="#navAccordionCollapseFour" aria-expanded="true" aria-controls="navAccordionCollapseFour">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
Acknowledgments
</button>
</h2>
</div>
<div id="navAccordionCollapseFour" class="collapse" aria-labelledby="navAccordionHeadingFour" data-parent="#navAccordionDiv">
<div class="card-body bg-light">
<p>I would like to thank the authors of the following technologies. Without them, this small project would not be possible.</p>
<ul>
<li>
<a href="https://www.tracery.io/" target="_blank">Tracery</a>
</li>
<li>
<a href="https://github.com/SortableJS/Sortable" target="_blank">SortableJS</a>
</li>
<li>
<a href="https://jquery.com/" target="_blank">JQuery</a>
</li>
<li>
<a href="https://jsonlint.com/" target="_blank">jsonlint.com</a>
</li>
<li>
<a href="https://github.com/lgarron/clipboard-polyfill" target="_blank">clipboard-polyfill</a>
</li>
<li>
<a href="https://getbootstrap.com/" target="_blank">Bootstrap</a>
</li>
<li>
<a href="https://beautifier.io/" target="_blank">beautifier.io</a>
</li>
</ul>
<p>The background image is courtesy of <a href="https://commons.wikimedia.org/wiki/File:Lower_Manhattan_from_Jersey_City_November_2014_panorama_3.jpg" target="_blank">Wikimedia Commons</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<h2><a href="https://github.com/theAwesomeFufuman/Tracitor" target="_blank">Tracitor</a> - a <a href="https://www.tracery.io/" target="_blank">Tracery</a> editor</h2>
</nav>
</div>
<!-- Container for page content & background image -->
<div class="overlay">
<div class="container features">
<div id="accordionRow" class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="accordion" id="accordionDiv">
<div class="card bg-dark">
<div class="card-header" id="jsonEditorHeading" data-toggle="collapse" data-target="#jsonEditorCollapse" aria-expanded="true" aria-controls="jsonEditorCollapse">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
π¨βπ» JSON editor
</button>
</h2>
</div>
<div id="jsonEditorCollapse" class="collapse" aria-labelledby="jsonEditorHeading" data-parent="#accordionDiv">
<div class="card-body">
<!-- Placeholder for jsonEditorTxtArea is set in Script.js -->
<textarea id="jsonEditorTxtArea" class="form-control" rows="10"></textarea>
<button class="btn btn-light btn-block copyBtn symbolsJsonCopyBtn" data-textarea="#jsonEditorTxtArea">π Copy JSON to the clipboard</button>
<button id="jsonEditorGenerateBtn" class="btn btn-light btn-block generateStoryBtn" data-textarea="#jsonEditorTxtArea" data-toggle="collapse" data-target="#resultCollapse">π Generate story</button>
</div>
</div>
</div>
<div class="card bg-dark">
<div class="card-header" id="simpleEditorHeading" data-toggle="collapse" data-target="#simpleEditorCollapse" aria-expanded="true" aria-controls="simpleEditorCollapse">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
π Simple editor
</button>
</h2>
</div>
<div id="simpleEditorCollapse" class="collapse show" aria-labelledby="simpleEditorHeading" data-parent="#accordionDiv">
<div class="card-body">
<button id="addSymbolInputBtn" class="btn btn-light btn-block">βοΈ Add another symbol</button>
<p id="sortableInstruction">
<svg class="bi bi-arrow-up-down" width="2em" height="2em" viewBox="0 0 20 20" fill="#16C60C" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M13 5.5a.5.5 0 01.5.5v9a.5.5 0 01-1 0V6a.5.5 0 01.5-.5z" clip-rule="evenodd"/>
<path fill-rule="evenodd" d="M12.646 4.646a.5.5 0 01.708 0l3 3a.5.5 0 01-.708.708L13 5.707l-2.646 2.647a.5.5 0 01-.708-.708l3-3zm-9 7a.5.5 0 01.708 0L7 14.293l2.646-2.647a.5.5 0 01.708.708l-3 3a.5.5 0 01-.708 0l-3-3a.5.5 0 010-.708z" clip-rule="evenodd"/>
<path fill-rule="evenodd" d="M7 4.5a.5.5 0 01.5.5v9a.5.5 0 01-1 0V5a.5.5 0 01.5-.5z" clip-rule="evenodd"/>
</svg>
All symbols in the list are sortable, drag them around to try it out!</p>
<div id="symbolsInputParentDiv">
<div class="form-group symbolsInputFormGroupDiv">
<textarea class="form-control symbolInput" placeholder="π·οΈ Give this symbol a title, e.g. 'animal'." rows="1"></textarea>
<textarea class="form-control rulesetInput" placeholder="β Enter the word(s) or sentence(s) to randomize in this symbol, separated by commas. E.g. 'deer, fox, rabbit'." rows="1"></textarea>
<button class="btn btn-light btn-block removeSymbolBtn">β Remove this symbol</button>
</div>
</div>
<div class="form-group">
<!-- Placeholder for simpleEditorTxtArea is set in Script.js -->
<textarea id="simpleEditorTxtArea" class="form-control originInput" rows="10"></textarea>
</div>
<button class="btn btn-light btn-block copyBtn symbolsJsonCopyBtn" data-textarea="#jsonEditorTxtArea">π Copy story template(JSON) to the clipboard</button>
<button class="btn btn-light btn-block generateStoryBtn" data-textarea="#jsonEditorTxtArea" data-toggle="collapse" data-target="#resultCollapse">π Generate story</button>
</div>
</div>
</div>
<div class="card bg-dark">
<div class="card-header" id="resultHeading" data-toggle="collapse" data-target="#resultCollapse" aria-expanded="true" aria-controls="resultCollapse">
<h2 class="mb-0">
<button class="btn btn-link" type="button">
π View generated story
</button>
</h2>
</div>
<div id="resultCollapse" class="collapse" aria-labelledby="resultHeading" data-parent="#accordionDiv">
<div class="card-body">
<div id="resultDiv">
<div class="form-group">
<textarea id="resultTxtArea" class="form-control" rows="10"></textarea>
</div>
</div>
<button id="resultCopyBtn" class="btn btn-light btn-block copyBtn" data-textarea="#resultTxtArea">π Copy the story to the clipboard</button>
<button class="btn btn-light btn-block generateStoryBtn" data-textarea="#jsonEditorTxtArea">π Reroll story</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>