-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
177 lines (167 loc) · 7.54 KB
/
Copy pathindex.html
File metadata and controls
177 lines (167 loc) · 7.54 KB
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
<!DOCTYPE html>
<link rel="stylesheet" href="style.css">
<script type="module" src="input.js"></script>
<script type="module" src="kanata_wasm.js"></script>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<head>
<title>Kanata simulator</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
</head>
<h1>Kanata simulator</h1>
<h2><code>v1.12.0</code></h2>
<body>
<div class="center grid">
<div class="box1">
<div class="justify-left">
<div>
<div class="textAreaHeader">
<label id="cfg-title" for="config">Configuration</label>
<button id="showConfigFormat" class="button" title="Display a popup explaining the Configuration text box">About config</button>
<a id="openKanataGuide" title="Link to the configuration guide"
href="/config.html"
target="_blank" rel="noopener noreferrer" class="button"
>Kanata guide</a>
</div>
<textarea
title="config"
id="config"
name="config"
class="monospace"
spellcheck="false"
rows="6"
></textarea>
</div>
<div>
<div class="textAreaHeader">
<label id="siminput-title" for="siminput">Input</label>
<button id="showInputFormat" class="button" title="Display a popup explaining the Input text box">About input</button>
<button id="beginRecording" class="button" title="Begin recording your key inputs the Input text box, replacing the existing content"
onclick="beginRecording()"
>Record inputs</button>
<button id="stopRecording" class="button stopbutton" title="Stop recording into the Input text box"
onclick="stopRecording()"
>Stop recording</button>
</div>
<div>
<dialog id="configFormat" class="modal">
<div class="modal-header">
<h3>Configuration format</h3>
<button id="closeConfigFormat" class="button" title="Close this popup">Close</label>
</div>
<p>
You should put a valid kanata configuration
within the configuration text box.
You can see the <a id="openKanataGuideDialog" title=""
href="/config.html"
target="_blank" rel="noopener noreferrer"
>kanata guide</a>
to learn about the configuration syntax.
</p>
<p>
To insert a Tab (<code>'\t'</code>) character
in the configuration text box, you can press Shift+Space.
</p>
<p>
Some kanata configurations make use of files when using the
real program.
For example, in <code>(include file.txt...)</code>
or for <code>(defzippy-experimental zippycfg.txt ...)</code>.
You can simulate files in the simulator.
Start a line with:<br/><br/>
<code>=== file:...</code><br/><br/>
The text composing <code>...</code> will be the filename.
All text after the line — up until the end of the configuration
or the next file definition —
will be the content of the simulated file.
</p>
<p>
Example:<br/><br/>
<code class="multiline">(defsrc)
(deflayermap (base) d @d)
(include config-d.txt)
(defzippy-experimental zippycfg.txt)
=== file:config-d.txt
(defalias d (tap-hold 200 200 d lsft))
=== file:zippycfg.txt
abc alphabet</code>
</p>
</dialog>
</div>
<div>
<dialog id="inputFormat" class="modal">
<div class="modal-header">
<h3>Simulated input format</h3>
<button id="closeInputFormat" class="button" title="Close this popup">Close</label>
</div>
<p>
You can use the recording functionality to automatically
generate inputs. The recording will end on demand
or after running for 30s.
<br/><br/>
The input format is <code>action:item</code>.
Valid actions are:
<table>
<tr><td><code>d | down</code></td> <td>: key down</td></tr>
<tr><td><code>r | repeat</code></td> <td>: key repeat</td></tr>
<tr><td><code>u | up</code></td> <td>: key up</td></tr>
<tr><td><code>t | tick</code></td> <td>: advance time</td></tr>
</table>
<p style="max-width: 600px">
The items for key up/down actions are a single key name
like what you would use in <code>defsrc</code>.
The items for tick actions are a single number
representing the number of milliseconds to advance time by.
<br/><br/>
Example:<br/><br/>
<code class="multiline">d:a t:50 u:a t:50
d:b t:50 u:b t:50</code>
<br/><br/>
<b>NOTE:</b> The simulator behaves as if <code>process-unmapped-keys</code>
is always set to <code>yes</code>. This cannot be turned off.
This is unlike the real Kanata program where this configuration is off by default.
</p>
</dialog>
</div>
<textarea
title="simulated input"
id="siminput"
name="siminput"
class="monospace"
spellcheck="false"
rows="6"
></textarea>
</div>
</div>
</div>
<div class="center box2">
<div class="justify-left box2-inner">
<h4 id="actions-title">Actions</h4>
<div id="actions-buttons" style="margin-top: 10px">
<button class="button" onclick="testConfig()" title="Test if the configuration is valid">Check</button>
<button class="button" style="margin-left: 10px" title="Simulate inputs then display outputs"
onclick="simulateInput()">Simulate</button>
<button class="button" style="margin-left: 10px" title="Save a link to your clipboard for the current configuration and input"
onclick="permalink()">Copy permalink</button>
<button class="button" style="margin-left: 10px" title="Save a link and all fields to your clipboard in markdown format"
onclick="permalinkConfigInputOutput()">Copy all</button>
</div>
</div>
<div class="center full-height">
<div class="justify-left result-container full-height">
<p id="result" class="monospace multiline full-height"></p>
</div>
</div>
</div>
</div>
</body>
</html>
<script src="modal.js"></script>
<script type="module" src="lzstring.min.js"></script>
<script type="module" src="persist.js"></script>
<script src="style.js"></script>