File: devtool.html

package info (click to toggle)
qlcplus 4.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,644 kB
  • sloc: cpp: 182,867; javascript: 7,764; xml: 2,453; ansic: 2,120; sh: 1,716; python: 634; ruby: 606; makefile: 23
file content (234 lines) | stat: -rw-r--r-- 6,959 bytes parent folder | download
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
<!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;
    min-height: calc(100vh - 16px); /* Subtract padding to prevent vertical scrollbar */
    padding: 8px;
    margin: 0;
  }
  h2 {
    background: #aaa;
    color: #333;
    padding: 10px;
  }
  .box {
    padding: 10px;
    display: inline-block;
    vertical-align: top;
    min-width: 200px;
  }
  :nth-child(1 of .box) {
    padding-left: 0;
  }
  :nth-last-child(1 of .box) {
    padding-right: 0;
  }
  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;
  }
  table:not(#map), table input[type=text], table input[type=number], table input[type=color], table select {
    width: 100%;
    min-width: 75px;
    box-sizing: border-box;
  }
  #dropContainer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    color: #000;
    background: none;
    font-size: 2em;
    pointer-events: none;
    justify-content: center;
    align-items: center;
  }
  #dropContainer.dragging {
    display: flex;
    background-color: rgba(255,255,255,0.7);
  }
</style>
<script type="text/javascript" src="devtool/devtool.js"></script>
</head>
<body onLoad="devtool.onLoad()">

<div id="dropContainer">
   &#8609;&#xFE0E; Drop your RGB script here to load it &#8609;&#xFE0E;
</div>

<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 'enter' to load it.
Alternatively, you can use the 'browse' button to select the file from your local file system.
A third option is to drag and drop the file directly into this page.
</p>
<p>
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>Load script</h2>
<form>
<table id="definitions">
 <tr>
  <td><label for="filename">Enter a filename</label></td>
  <td><input type="text" size="12" id="filename" placeholder="Enter filename here." onChange="devtool.onFilenameUpdated(this.value)"/></td>
 </tr>
 <tr>
  <td><label for="filebrowse">Or browse</label></td>
  <td><input type="file" size="12" id="filebrowse" onChange="devtool.onFileBrowsed(event)"/></td>
 </tr>
</table>
</form>

<h2>Algorithm specification</h2>
<form>
<table id="definitions">
 <tr>
  <td><label for="apiversion">apiVersion</label></td>
  <td><input type="text" readonly="readonly" class="readonly" size="3" id="apiversion"/></td>
 </tr>
 <tr>
  <td><label for="name">name</label></td>
  <td><input type="text" readonly="readonly" class="readonly" id="name"/></td>
 </tr>
 <tr>
  <td><label for="author">author</label></td>
  <td><input type="text" readonly="readonly" class="readonly" id="author"/></td>
 </tr>
 <tr>
  <td><label for="acceptColors">acceptColors</label></td>
  <td><input type="text" readonly="readonly" class="readonly" id="acceptColors"/></td>
 </tr>
</table>
</form>

<h2>Grid size</h2>
<form>
<table>
 <tr>
  <td><label for="gridwidth">Width</label></td>
  <td><input type="number" min="1" id="gridwidth" value="15" size="4" required onChange="devtool.onGridSizeUpdated()"/></td>
 </tr>
 <tr>
  <td><label for="gridheight">Height</label></td>
  <td><input type="number" min="1" id="gridheight" value="15" size="4" required onChange="devtool.onGridSizeUpdated()"/></td>
 </tr>
 <tr>
  <td><label for="gridsize">Size</label></td>
  <td><input type="number" min="1" max="20" id="gridsize" value="20" size="4" required onChange="devtool.onGridSizeUpdated()"/></td>
 </tr>
</table>
</form>

</div>

<div class="box">
<form id="pixelColorChooser">
<h2>Pixel colors</h2>
<table id="colorChooserTable">
</table>
</form>

<h2>Algorithm properties</h2>
<form>
<table id="properties">
</table>
</form>

<h2>Algorithm functions</h2>
<form>
<table>
 <tr>
  <td><label for="stepCount">rgbMapStepCount(width, height)</label></td>
  <td><input type="text" readonly="readonly" class="readonly" size="3" id="stepCount"/></td>
 </tr>
 <tr>
  <td><label for="currentStep">rgbMap(width, height, rgb, <b>step</b>)</label></td>
  <td>
   <input type="number" min="0" id="currentStep" onChange="devtool.writeCurrentStep()"/>
  </td>
 </tr>
 <tr>
  <td colspan="2">
    <input type="button" value="&#x23EA;&#xFE0E; Previous" onClick="devtool.previousStep()"/>
    <input type="button" value="&#x23E9;&#xFE0E; Next" onClick="devtool.nextStep()"/>
    <input type="button" value="&#x23F5;&#xFE0E; Start" onClick="devtool.startTest(1)"/>
    <input type="button" value="&#x23F9;&#xFE0E; Stop" onClick="devtool.stopTest()"/>
    <input type="button" value="&#x23F4;&#xFE0E; Start reversed" onClick="devtool.startTest(-1)"/>
  </td>
 </tr>
 <tr>
  <td><label for="alternate">Alternate</label></td>
  <td>
   <input type="checkbox" id="alternate" onChange="devtool.onAlternateChanged()"/>
  </td>
 </tr>
 <tr>
  <td><label for="speed">Speed (ms)</label></td>
  <td>
   <input type="number" min="1" id="speed" value="500" size="4" onChange="devtool.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 &copy; Heikki Junnila, Massimo Callegari, APIv2 & APIv3 integration: Hans-Jürgen Tappe.

</body>
</html>