forked from mcallegari/qlcplus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevtool.html
More file actions
193 lines (178 loc) · 5.21 KB
/
devtool.html
File metadata and controls
193 lines (178 loc) · 5.21 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Q Light Controller Plus - RGBScript Development Tool</title>
<style>
.readonly {
background-color: lightgrey;
border: solid 0px;
}
body {
background: #373737;
color: #f9f8f0;
font-family: Arial;
}
h2 {
background: #aaa;
color: #333;
padding: 10px;
}
.box {
padding: 10px;
display: inline-block;
vertical-align:top;
min-width: 200px;
}
input[type=button] {
background-color: #7497b6;
border: none;
color: white;
padding: 5px 10px;
text-decoration: none;
margin: 4px 2px;
font-size: 16px;
cursor: pointer;
}
input[type=button]:hover {
background-color: #8db8dd;
}
</style>
<script type="text/javascript" src="devtool.js"></script>
</head>
<body onLoad="loadAlgoFile()">
<h1>Q Light Controller Plus - RGB Script Development Tool</h1>
<div>
<h2>Instructions</h2>
<p>
To use this tool, you must first set the filename of the script you intend to test/debug
(including the .js extension) in the 'filename' field. Then hit 'Reload' to load it.
To make your algorithm object accessible to this tool, you must create a global variable
within your algorithm file called <b>testAlgo</b>, which then actually contains your algorithm
object i.e. the object that provides rgbMap() and rgbMapStepCount() functions. Now you're ready to load
this file with your browser and see your first results.
</p>
<p>
If you see what you expect to see in the <b>Algorithm Properties</b> section below,
you'll know your script has been evaluated successfully. Next, put some values to the
<b>Width</b> and <b>Height</b> boxes in the <b>Grid Size</b> section and see if your
script calculates the <b>rgbMapStepCount(width, height)</b> result correctly.
If everything is OK, you should already see your RGB script running through frames.
To inspect individual frames, stop the script and hit the previous and next buttons.
</p>
<b>
For troubleshooting purposes, I would suggest using some good JavaScript development
tools for your browser. Mozilla FireFox has a built-in Web Console behind <i>Tools -> Web
Developer</i> which is very useful in hunting errors within the JavaScript code.
Google Chrome has one as well, that you can access with F12 or with <i>More Tools -> Developer Tools (Ctrl+Shift+I)</i>
</b>
</div>
<div class="box">
<h2>Algorithm Specification</h2>
<form>
<table id="definitions">
<tr>
<td>filename</td>
<td><input type="text" size="12" id="filename" value="Enter filename here." onChange="onFilenameUpdated(this.value)"/></td>
</tr>
<tr>
<td>apiVersion</td>
<td><input type="text" readonly="readonly" class="readonly" size="3" id="apiversion"/></td>
</tr>
<tr>
<td>name</td>
<td><input type="text" readonly="readonly" class="readonly" id="name"/></td>
</tr>
<tr>
<td>author</td>
<td><input type="text" readonly="readonly" class="readonly" id="author"/></td>
</tr>
<tr>
<td>acceptColors</td>
<td><input type="text" readonly="readonly" class="readonly" id="acceptColors"/></td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="Reload" onClick="location.reload()"/>
</td>
</tr>
</table>
</form>
<h2>Grid Size</h2>
<form>
<table>
<tr>
<td>Width</td>
<td><input type="number" min="1" id="width" value="15" size="4" style="width: 8em;" required onChange="onGridSizeUpdated()"/></td>
</tr>
<tr>
<td>Height</td>
<td><input type="number" min="1" id="height" value="15" size="4" style="width: 8em;" required onChange="onGridSizeUpdated()"/></td>
</tr>
</table>
</form>
</div>
<div class="box">
<form id="pixelColorChooser">
<h2>Pixel colors</h2>
<table>
<tr>
<td>Primary color (rrggbb)</td>
<td><input type="text" id="primaryColor" value="FF0000" pattern="[0-9A-Fa-f]{6}" size="6" onChange="onColorChange()" required /></td>
</tr>
<tr id="secondaryColorChooser">
<td>Secondary color (rrggbb, leave empty to disable)</td>
<td><INPUT TYPE="text" id="secondaryColor" value="" pattern="[0-9A-Fa-f]{6}" size="6" onChange="onColorChange()"/></td>
</tr>
</table>
</form>
<h2>Algorithm Properties</h2>
<form>
<table id="properties">
</table>
</form>
<h2>Algorithm Functions</h2>
<form>
<table>
<tr>
<td>rgbMapStepCount(width, height)</td>
<td><input TYPE="text" readonly="readonly" class="readonly" size="3" id="stepCount"/></td>
</tr>
</table>
</form>
<form>
<table>
<tr>
<td>rgbMap(width, height, rgb, <b>step</b>)
<input type="number" min="0" id="currentStep" onChange="writeCurrentStep()"/>
</td>
</tr>
<tr>
<td>
<span>
<input type="button" value="Previous" onClick="previousStep()"/>
<input type="button" value="Next" onClick="nextStep()"/>
</span>
<span>
<input type="button" value="Start test" onClick="startTest()"/>
<input type="button" value="Stop test" onClick="stopTest()"/>
</span>
</td>
</tr>
<tr>
<td>
Speed (ms): <input type="number" min="1" id="speed" value="500" size="4" style="width: 8em;" onChange="onSpeedChanged()"/>
</td>
</tr>
</table>
</form>
</div>
<div class="box">
<h2>Preview</h2>
<table id="map">
</table>
</div>
<hr/>
This file is licensed under the Apache 2.0 license. Copyright © Heikki Junnila, Massimo Callegari, APIv2 integration: Hans-Jürgen Tappe.
</body>
</html>