-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
361 lines (315 loc) · 11.4 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js" integrity="sha512-csNcFYJniKjJxRWRV1R7fvnXrycHP6qDR21mgz1ZP55xY5d+aHLfo9/FcGDQLfn2IfngbAHd8LdfsagcCqgTcQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<meta charset="utf-8">
<title>text studio</title>
<link rel="stylesheet" href="css/simulator.css">
<style media="screen">
h1 {
font-size: 2.5rem;
scale: 1 1.5;
}
h2 {
font-size: 2rem;
}
h1, h2 {
margin: 0;
font-family: serif;
}
header {
margin-bottom: 1rem;
}
#timeline {
position: relative;
overflow: visible;
display: flex;
flex-direction: column;
}
.track {
position: relative;
width: 100%;
height: 1.5rem;
border-bottom: 1px solid var(--lightergray);
}
.track .track-selector {
position: absolute;
left: 0;
top: 50%;
translate: -100% -50%;
height: inherit;
width: .5rem;
height: .5rem;
border-radius: 50%;
}
.track.selected .track-selector {
background: orange;
}
.track.locked .clip {
pointer-events: none;
}
.track.locked .track-selector {
background: gray;
}
.track.mute {
opacity: .3;
}
/* clip */
.track .clip {
position: absolute;
height: inherit;
background: lightgray;
opacity: .5;
border-radius: 5px;
overflow: hidden;
cursor: grab;
}
body:not(.resizing) .track .clip:hover {
background: var(--lightergray);
}
.track .clip.selected {
background: orange !important;
}
body.dragging .track .clip:not(.dragging) {
pointer-events: none;
}
body.joining .track .clip:not(.selected) {
background: red;
cursor: pointer;
}
.resize-handle {
position: absolute;
height: inherit;
width: 3px;
cursor: ew-resize;
right: 0;
}
.resize-handle:first-child {
left: 0;
}
body.recording #playhead {
border-color: red;
}
body.recording #playhead::before {
background: red;
}
#timeline-ruler {
height: .75rem;
width: 100%;
background-image: linear-gradient(90deg, black 0px, black 1px, var(--lightergray) 1px, var(--lightergray) 100%);
background-size: 0 100%;
}
.timeline-event {
position: absolute;
height: inherit;
width: 1px;
pointer-events: none;
}
.timeline-event.keydown {
background: black;
}
.timeline-event.keyup {
background: white;
}
.box {
width: max-content;
padding: .5rem;
border: 1px solid black;
height: fit-content;
}
#component-log, #inspector, #global-settings {
pointer-events: auto;
padding: .5rem;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
}
#component-log {
max-height: 18rem;
overflow-y: scroll;
width: 100%;
}
#component-log div:first-child {
margin-bottom: .5rem;
}
#component-log button {
color: black;
text-align: left;
font-family: monospace;
font-size: inherit;
}
#component-log button.trimmed {
border-color: lightgray;
color: lightgray;
}
#inspector {
width: 65rem;
height: fit-content;
}
#inspector > div {
display: none;
white-space: pre;
}
#inspector.track #track-inspector {
display: block;
}
#inspector.clip #clip-inspector {
display: block;
}
#inspector.event #event-inspector {
display: block;
}
#inspector::before {
margin-bottom: .5rem;
}
#event-inspector [name='listening'] {
display: none;
}
#inspector.listening #event-inspector [name='listening'] {
display: inline;
}
input {
line-height: inherit;
font-family: inherit;
font-size: inherit;
}
.visualizer {
width: 100%;
height: 3rem;
/* border-bottom: 1px solid var(--text); */
box-sizing: border-box;
display: grid;
grid-template-columns: repeat(26, 1fr);
}
.visualizer > div {
text-align: center;
background: lightgray;
align-self: end;
color: transparent;
height: 0%;
}
body.recording .visualizer > div {
background: black;
}
.output.recording {
color: red;
}
.output.recording .caret {
background: red;
}
.output.recording .caret:empty::before {
color: red;
}
body.dragging, body.dragging * {
cursor: grabbing !important;
}
body.resizing, body.resizing * {
cursor: ew-resize;
}
.gone {
display: none;
}
.monospace {
font-family: monospace;
font-size: inherit;
}
a[target="_blank"]::after {
content: "↗"
}
@supports ( -moz-appearance:none ) {
#firefox-warning {
display: block !important;
}
}
</style>
</head>
<body class="flex column">
<div style="position: absolute; top: .5rem; right: .5rem;">
<a href="https://github.com/quewon/studio#live-text-recording-studio" target="_blank">guide</a>
<a href="https://github.com/quewon/studio" target="_blank">github</a>
</div>
<header class="noclick noselect">
<h2 style="margin-bottom: 0; margin-left: 1.5rem; font-style: italic;">quewon's</h2>
<h1>live text recording studio</h1>
</header>
<div id="timeline-controls" class="flex" class="noselect">
<button onclick="createTrack()">+ track</button>
<button onclick="currentTrack.toggleRecording(event)" id="record" title="start capturing keyboard input">record</button>
<button onclick="setPlayheadTime(0)" name="tostart" title="move playhead to the start of the track"></button>
<button onclick="togglePlaying()" id="play">play</button>
<button onclick="setPlayheadTime(totalTime)" name="toend" title="move playhead to the end of the track"></button>
<div class="grow"></div>
<button onclick="this.nextElementSibling.click()">import</button>
<input class="gone" type="file" name="avatar" accept="text/plain, .txtrec, .txtstudio" onchange="readFile(this)">
<button onclick="toggleGone(ui.exportSettings, this)">export</button>
<button onclick="toggleGone(ui.globalSettings, this)">settings</button>
</div>
<div id="timeline-info" class="noclick noselect"></div>
<div id="timeline">
<div id="timeline-ruler"></div>
<div id="playhead"></div>
</div>
<div class="flex">
<div id="export-settings" class="box gone">
EXPORT<br><br>
<button onclick="createProjectFile()">export project</button>
<button onclick="createRecordingFile()">export recording</button>
</div>
<div id="global-settings" class="box gone">
SETTINGS<br><br>
<button name="startRecordOnInput">start recording on keydown</button>
<button name="printConversation">print conversation</button>
<button name="monospacedOutput">terminal style</button>
<button name="assembleHangul">한글 인풋 지원 | hangul input support</button>
<br><br>
thanks to <a href="https://github.com/e-/Hangul.js" target="_blank">Hangul.js</a>!
<span id="firefox-warning" class="gone"><br><br>파이어폭스는 한글 키입력을 못 읽는 듯합니다. 다른 브라우저를 사용하길 권합니다 :(</span>
</div>
</div>
<div id="inspector-container" class="flex">
<div id="component-log" class="monospace box flex column"></div>
<div id="inspector" class="box">
<div id="track-inspector">TRACK INSPECTOR
<div class="flex wrap">
<button name="mute">mute</button> <button name="lock">lock</button>
</div>
PLAYHEAD: <input type="number" name="playhead" value="0"> ms
(numbers here are more accurate.)
<button disabled name="delete">delete track</button></div>
<div id="clip-inspector">CLIP INSPECTOR
<div class="flex wrap">
<button onclick="setPlayheadTime(clipSelected.startTime + clipSelected.trimStart)" title="move playhead to start of clip">|←</button> <button onclick="setPlayheadTime(clipSelected.startTime + clipSelected.trimStart + clipSelected.trimmedTime)" title="move playhead to end of clip">→|</button> <button onclick="clipSelected.setStartTime(playheadTime - clipSelected.trimStart)">move to playhead</button> <button onclick="clipSelected.split(playheadTime)" title="split clip at playhead">split</button> <button name="duplicate" title="duplicate clip at playhead">duplicate</button><button onclick="prepareJoin(this)" title="start merging clips together" name="join">merge mode</button>
</div>
TIMESTAMP: <input type="number" name="timestamp" value="0"> ms
LENGTH: <span name="length"></span> ms
TRIM START: <input type="number" name="trim-start" value="0"> ms
TRIM LENGTH: <input type="number" name="trim-length" value="0"> ms
<button name="delete">delete clip</button></div>
<div id="event-inspector">EVENT INSPECTOR
<div class="flex wrap">
<button onclick="setPlayheadTime(eventBeingEdited.clip.startTime + eventBeingEdited.localTimeStamp)" title="move playhead to event location">↓</button> <button onclick="clipSelected.split(eventBeingEdited.clip.startTime + eventBeingEdited.localTimeStamp)" title="events on the boundary end up on the left clip">split clip here</button>
</div>
TYPE: <button class="monospace" name="keydown" checked>keydown</button> <button class="monospace" name="keyup">keyup</button>
CODE: <span name="code">a</span>
KEY: <span name="key">a</span> <button name="listen">listen</button> <span name="listening"><i>listening...</i></span>
LOCAL TIMESTAMP: <input type="number" name="local" value="0"> ms
GLOBAL TIMESTAMP: <input type="number" name="global" value="0"> ms
<button name="delete">delete event</button></div>
</div>
</div>
</body>
<script type="text/javascript" src="js/hangul.min.js"></script>
<script type="text/javascript" src="js/toolbox.js"></script>
<script type="text/javascript" src="js/simulator.js"></script>
<script type="text/javascript" src="js/engine/event.js"></script>
<script type="text/javascript" src="js/engine/clip.js"></script>
<script type="text/javascript" src="js/engine/track.js"></script>
<script type="text/javascript" src="js/engine/ui.js"></script>
<script type="text/javascript" src="js/engine/inspector.js"></script>
<script type="text/javascript" src="js/engine/data.js"></script>
<script type="text/javascript" src="js/engine/engine.js"></script>
</html>