forked from MycroftAI/mycroft-skills
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta_editor.html
351 lines (313 loc) · 9.71 KB
/
meta_editor.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
<html>
<!-- Copyright Mycroft AI, Inc. 2017. All Rights Reserved. -->
<!-- Thanks to https://www.sanwebe.com/2014/08/css-html-forms-designs for the basis of this -->
<style type="text/css">
#output {
height : 500px;
}
.entry-form{
max-width:90%;
margin:10px auto;
background:#fff;
border-radius:2px;
padding:20px;
font-family: Georgia, "Times New Roman", Times, serif;
}
h1{
display: block;
text-align: center;
padding: 0;
margin: 0px 0px 0px 0px;
color: #5C5C5C;
font-variant: small-caps;
font-size:2em;
}
.instructions{
max-width:90%;
margin: 10px auto;
padding: 0px;
}
.entry-form ul{
list-style:none;
padding:0;
margin:0;
}
.entry-form li{
display: block;
padding: 9px;
border:1px solid #DDDDDD;
margin-bottom: 30px;
border-radius: 3px;
}
.entry-form li > label{
display: block;
float: left;
margin-top: -19px;
background: #FFFFFF;
height: 14px;
padding: 2px 5px 2px 5px;
color: #B9B9B9;
font-size: 14px;
overflow: hidden;
font-family: Arial, Helvetica, sans-serif;
}
.entry-form input[type="text"],
.entry-form input[type="date"],
.entry-form input[type="datetime"],
.entry-form input[type="email"],
.entry-form input[type="number"],
.entry-form input[type="search"],
.entry-form input[type="time"],
.entry-form input[type="url"],
.entry-form input[type="password"],
.entry-form textarea,
.entry-form select
{
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
width: 100%;
display: block;
outline: none;
border: none;
height: 25px;
line-height: 25px;
font-size: 16px;
padding: 0;
font-family: Georgia, "Times New Roman", Times, serif;
}
.entry-form input[type="text"]:focus,
.entry-form input[type="date"]:focus,
.entry-form input[type="datetime"]:focus,
.entry-form input[type="email"]:focus,
.entry-form input[type="number"]:focus,
.entry-form input[type="search"]:focus,
.entry-form input[type="time"]:focus,
.entry-form input[type="url"]:focus,
.entry-form input[type="password"]:focus,
.entry-form textarea:focus,
.entry-form select:focus
{
}
.entry-form li > span{
background: #F3F3F3;
display: block;
padding: 3px;
margin: 0 -9px -9px -9px;
text-align: center;
color: #6A9FFF;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.entry-form textarea{
resize:none;
}
.entry-form input[type="submit"],
.entry-form input[type="button"]{
background: #2471FF;
border: none;
padding: 10px 20px 10px 20px;
border-bottom: 3px solid #5994FF;
border-radius: 3px;
color: #D2E2FF;
}
.entry-form input[type="submit"]:hover,
.entry-form input[type="button"]:hover{
background: #6B9FFF;
color:#fff;
}
.entry-form .noborder {
border:none;
text-align: center;
}
.ex[id^="ex_"][name^="ex_"]
{
background: #f6f6ff;
margin: 3px 0 3px 0;
padding: 0px 4px 0px 4px;
}
.author[id^="author_"][name^="author_"]
{
background: #f6f6ff;
margin: 3px 0 3px 0;
padding: 0px 4px 0px 4px;
}
tt {
color: #094;
}
</style>
<script type="text/javascript">
//auto expand textarea
function adjust_textarea(h) {
new_height = h.scrollHeight;
if (new_height < 200) {
new_height = 200;
}
h.style.height = "20px";
h.style.height = new_height+"px";
}
function generate()
{
// Convert the filled-out form to a markdown description (README.md) for
// the mycroft-skill on Github
var elem = document.getElementById("output");
var elName = document.getElementById("name");
var elShortDesc = document.getElementById("short_desc");
var elLongDesc = document.getElementById("long_desc");
elem.value = "## " + elName.value + "\n";
elem.value += elShortDesc.value + "\n\n";
elem.value += "## Description \n";
elem.value += elLongDesc.value + "\n\n";
elem.value += "## Examples \n";
for (var i=1; ; i++)
{
var ex = document.getElementById("ex_"+i);
if (!ex)
break;
if (ex.value != "")
elem.value += '* "' + ex.value + '"\n';
}
elem.value += "\n## Credits \n";
for (var i=1; ; i++)
{
var ex = document.getElementById("author_"+i);
if (!ex)
break;
if (ex.value != "")
elem.value += ex.value + "\n";
}
var req_mark1 = document.getElementById("req_mark1").checked;
var req_picroft = document.getElementById("req_picroft").checked;
var req_plasmoid = document.getElementById("req_plasmoid").checked;
if (req_mark1 || req_picroft || req_plasmoid)
{
elem.value += "\n## Require \n";
if (req_mark1)
elem.value += "platform_mark1 ";
if (req_picroft)
elem.value += "platform_picroft ";
if (req_plasmoid)
elem.value += "platform_plasmoid ";
elem.value += "\n";
}
var excl_mark1 = document.getElementById("excl_mark1").checked;
var excl_picroft = document.getElementById("excl_picroft").checked;
var excl_plasmoid = document.getElementById("excl_plasmoid").checked;
if (excl_mark1 || excl_picroft || excl_plasmoid)
{
elem.value += "\n## Exclude \n";
if (excl_mark1)
elem.value += "platform_mark1 ";
if (excl_picroft)
elem.value += "platform_picroft ";
if (excl_plasmoid)
elem.value += "platform_plasmoid ";
elem.value += "\n";
}
}
function load()
{
}
function addNextExample(input)
{
if (input.value == "")
return true;
inputNext = input.cloneNode();
input.onkeyup = "";
// ## <input class="ex" type="text" name="ex_1" id="ex_1" maxlength="100" placeholder="example 1"...
num = input.name.substring(3)*1 + 1;
inputNext.name = "ex_"+num;
inputNext.id = inputNext.name;
inputNext.value = "";
inputNext.placeholder = input.placeholder.substring(0,7)+" "+num;
// Add after the last
input.parentElement.insertBefore(inputNext, input.nextSibling);
}
function addNextAuthor(input)
{
if (input.value == "")
return true;
inputNext = input.cloneNode();
input.onkeyup = "";
// ## <input class="author" type="text" name="author_1" id="author_1" maxlength="100" placeholder="author name"></input>
num = input.name.substring(7)*1 + 1;
inputNext.name = "author_"+num;
inputNext.id = inputNext.name;
inputNext.value = "";
inputNext.placeholder = input.placeholder.substring(0,12)+" "+num;
// Add after the last
input.parentElement.insertBefore(inputNext, input.nextSibling);
}
</script>
<body>
<h1>Mycroft Skill Description Tool</h1>
<div class="instructions">
<h2>Usage Instructions:</h2>
<ol>
<li>Fill in the appropriate information below</li>
<li>Click the Generate button</li>
<li>Copy the output into a README.md file for your Skill's repo.</li>
</ol>
You can extend the contents with a custom section (such as <tt>## Notes</tt>, but please do not change the
format of the sections. Today, this will explain your skill to users in a standardized, easy to read
format. In the future it will be machine-parsed to fill the store, perform searches, etc.
</div>
<form class="entry-form">
<ul>
<li>
<label for="name">Name</label>
<input type="text" id="name" name="name" maxlength="100">
<span>Enter a brief, speakable skill name. Ex: "podcast player"</span>
</li>
<li>
<label for="short_desc">Short Description</label>
<input type="text" name="short_desc" id="short_desc"" maxlength="100">
<span>Enter a one-line description of your skill, Ex: "Podcast management and playback"</span>
</li>
<li>
<label for="long_desc">Long Description</label>
<textarea name="long_desc" id="long_desc" onkeyup="adjust_textarea(this)"></textarea>
<span>Free form, multi-paragraph description of the skill. You can use <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">Github markdown</a>.</span>
</li>
<li>
<label for="ex_1">Examples: Hey Mycroft...</label>
<input class="ex" type="text" name="ex_1" id="ex_1" maxlength="100" placeholder="example 1" onkeyup="addNextExample(this)"></input>
<span>Example phrases handled after "Hey Mycroft", Ex: "play latest podcast", "make this a favorite"</span>
</li>
<li>
<label for="author_1">Author(s)</label>
<input class="author" type="text" name="author_1" id="author_1" maxlength="100" placeholder="author name" onkeyup="addNextAuthor(this)"></input>
<span>Credits for people or organizations involved (names, emails, and/or Github handles)</span>
</li>
<li>
<label for="ex1">Requires</label>
<div><input type="checkbox" id="req_mark1" name="req_mark1" value="mark1"/>
<label for="req_mark1">Mark 1</label></div>
<div><input type="checkbox" id="req_picroft" name="req_picroft" value="picroft"/>
<label for="req_picroft">Picroft</label></div>
<div><input type="checkbox" id="req_plasmoid" name="req_plasmoid" value="plasmoid"/>
<label for="req_plasmoid">Plasmoid</label></div>
<span>If only for specific plaforms, check one or more (blank means any platform)</span>
</li>
<li>
<label for="ex1">Excludes</label>
<div><input type="checkbox" id="excl_mark1" name="excl_mark1" value="mark1"/>
<label for="excl_mark1">Mark 1</label></div>
<div><input type="checkbox" id="excl_picroft" name="excl_picroft" value="picroft"/>
<label for="excl_picroft">Picroft</label></div>
<div><input type="checkbox" id="excl_plasmoid" name="excl_plasmoid" value="plasmoid"/>
<label for="excl_plasmoid">Plasmoid</label></div>
<span>Check platforms that should NOT receive this by this skill.</span>
</li>
<li class="noborder">
<input type="button" onclick="generate()" value="Generate ↓" >
<!--input type="button" onclick="load()" value="Load ↑" -->
</li>
<li>
<label for="output">Output</label>
<textarea id="output" placeholder="...fill the above area and hit Generate..."></textarea>
</li>
</ul>
</form>
</body>
</html>