forked from chilipeppr/widget-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
modal.html
483 lines (466 loc) · 18.1 KB
/
modal.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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
-->
<script>
/* global $ */
var configFormatData = [{
"code": "0",
"setting": "Step pulse time",
"units": "microseconds",
"explanation": "Sets time length per step. Minimum 3usec.",
"tab": "Steps",
"fieldType": "integer",
"values": [],
"minimum": 3
}, {
"code": "1",
"setting": "Step idle delay",
"units": "milliseconds",
"explanation": "Sets a short hold delay when stopping to let dynamics settle before disabling steppers. Value 255 keeps motors enabled with no delay.",
"tab": "Steps",
"fieldType": "integer",
"values": [],
"maximum": 255,
"minimum": 0
}, {
"code": "2",
"setting": "Step pulse invert",
"units": "mask",
"explanation": "Inverts the step signal.",
"tab": "Inversions",
"fieldType": "axisMask",
"minimum": 0
}, {
"code": "3",
"setting": "Step direction invert",
"units": "mask",
"explanation": "Inverts the direction signal.",
"tab": "Inversions",
"fieldType": "axisMask",
"minimum": 0
}, {
"code": "4",
"setting": "Invert step enable pin",
"units": "boolean",
"explanation": "Inverts the stepper driver enable pin signal.",
"tab": "Inversions",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "5",
"setting": "Invert limit pins",
"units": "boolean",
"explanation": "Inverts the all of the limit input pins.",
"tab": "Inversions",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "6",
"setting": "Invert probe pin",
"units": "boolean",
"explanation": "Inverts the probe input pin signal.",
"tab": "Inversions",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "10",
"setting": "Status report options",
"units": "mask",
"explanation": "Alters data included in status reports.",
"tab": "Reporting",
"fieldType": "switch",
"values": ["standard", "full"],
"minimum": 0
}, {
"code": "11",
"setting": "Junction deviation",
"units": "millimeters",
"explanation": "Sets how fast Grbl travels through consecutive motions. Lower value slows it down.",
"tab": "Junction Deviation",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "12",
"setting": "Arc tolerance",
"units": "millimeters",
"explanation": "Sets the G2 and G3 arc tracing accuracy based on radial error. Beware: A very small value may effect performance.",
"tab": "Arc Tolerance",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "13",
"setting": "Report in inches",
"units": "boolean",
"explanation": "Enables inch units when returning any position and rate value that is not a settings value.",
"tab": "Reporting",
"fieldType": "switch",
"values": ["mm", "inch"],
"minimum": 0
}, {
"code": "20",
"setting": "Soft limits enable",
"units": "boolean",
"explanation": "Enables soft limits checks within machine travel and sets alarm when exceeded. Requires homing.",
"tab": "Limits",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "21",
"setting": "Hard limits enable",
"units": "boolean",
"explanation": "Enables hard limits. Immediately halts motion and throws an alarm when switch is triggered.",
"tab": "Limits",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "22",
"setting": "Homing cycle enable",
"units": "boolean",
"explanation": "Enables homing cycle. Requires limit switches on all axes.",
"tab": "Homing",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "23",
"setting": "Homing direction invert",
"units": "mask",
"explanation": "Homing searches for a switch in the positive direction. Set axis bit (00000ZYX) to search in negative direction.",
"tab": "Homing",
"fieldType": "axisMask",
"minimum": 0
}, {
"code": "24",
"setting": "Homing locate feed rate",
"units": "mm\/min",
"explanation": "Feed rate to slowly engage limit switch to determine its location accurately.",
"tab": "Homing",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "25",
"setting": "Homing search seek rate",
"units": "mm\/min",
"explanation": "Seek rate to quickly find the limit switch before the slower locating phase.",
"tab": "Homing",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "26",
"setting": "Homing switch debounce delay",
"units": "milliseconds",
"explanation": "Sets a short delay between phases of homing cycle to let a switch debounce.",
"tab": "Homing",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "27",
"setting": "Homing switch pull-off distance",
"units": "millimeters",
"explanation": "Retract distance after triggering switch to disengage it. Homing will fail if switch isn't cleared.",
"tab": "Homing",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "30",
"setting": "Maximum spindle speed",
"units": "RPM",
"explanation": "Maximum spindle speed. Sets PWM to 100% duty cycle.",
"tab": "Spindle",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "31",
"setting": "Minimum spindle speed",
"units": "RPM",
"explanation": "Minimum spindle speed. Sets PWM to 0.4% or lowest duty cycle.",
"tab": "Spindle",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "32",
"setting": "Laser-mode enable",
"units": "boolean",
"explanation": "Enables laser mode. Consecutive G1\/2\/3 commands will not halt when spindle speed is changed.",
"tab": "Laser",
"fieldType": "switch",
"values": ["off", "on"],
"minimum": 0
}, {
"code": "100",
"setting": "X-axis travel resolution",
"units": "step\/mm",
"explanation": "X-axis travel resolution in steps per millimeter.",
"tab": "Axis Resolution",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "101",
"setting": "Y-axis travel resolution",
"units": "step\/mm",
"explanation": "Y-axis travel resolution in steps per millimeter.",
"tab": "Axis Resolution",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "102",
"setting": "Z-axis travel resolution",
"units": "step\/mm",
"explanation": "Z-axis travel resolution in steps per millimeter.",
"tab": "Axis Resolution",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "110",
"setting": "X-axis maximum rate",
"units": "mm\/min",
"explanation": "X-axis maximum rate. Used as G0 rapid rate.",
"tab": "Axis FeedRate",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "111",
"setting": "Y-axis maximum rate",
"units": "mm\/min",
"explanation": "Y-axis maximum rate. Used as G0 rapid rate.",
"tab": "Axis FeedRate",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "112",
"setting": "Z-axis maximum rate",
"units": "mm\/min",
"explanation": "Z-axis maximum rate. Used as G0 rapid rate.",
"tab": "Axis FeedRate",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "120",
"setting": "X-axis acceleration",
"units": "mm\/sec^2",
"explanation": "X-axis acceleration. Used for motion planning to not exceed motor torque and lose steps.",
"tab": "Axis Acceleration",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "121",
"setting": "Y-axis acceleration",
"units": "mm\/sec^2",
"explanation": "Y-axis acceleration. Used for motion planning to not exceed motor torque and lose steps.",
"tab": "Axis Acceleration",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "122",
"setting": "Z-axis acceleration",
"units": "mm\/sec^2",
"explanation": "Z-axis acceleration. Used for motion planning to not exceed motor torque and lose steps.",
"tab": "Axis Acceleration",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "130",
"setting": "X-axis maximum travel",
"units": "millimeters",
"explanation": "Maximum X-axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances.",
"tab": "Axis Max Travel",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "131",
"setting": "Y-axis maximum travel",
"units": "millimeters",
"explanation": "Maximum Y-axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances.",
"tab": "Axis Max Travel",
"fieldType": "integer",
"values": [],
"minimum": 0
}, {
"code": "132",
"setting": "Z-axis maximum travel",
"units": "millimeters",
"explanation": "Maximum Z-axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances.",
"tab": "Axis Max Travel",
"fieldType": "integer",
"values": [],
"minimum": 0
}];
var integerNode = $(`
<div class='configItemHolder input-group input-group-sm'>
<label class=''></label>
<input class='configItem' type='text'>
</div>
`);
var switchNode = $(`
<div class='checkbox'>
<label><input type='checkbox'/>
<span class='col-md-3'>Text goes here</span>
</label>
</div>
`);
var axisMaskNodeTable = $(`
<table class="table-condensed">
<tbody>
<thead>
<tr class="row">
<th class="col-md-2"> </th>
<th class="col-md-2">X-Axis</th>
<th class="col-md-2">Y-Axis</th>
<th class="col-md-2">Z-Axis</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
`);
var axisMaskNode = $(`
<tr class="row">
<td class="col-md-2"></td>
<td class="col-md-2"><span><input type="checkbox" /></span></td>
<td class="col-md-2"><span><input type="checkbox" /></span></td>
<td class="col-md-2"><span><input type="checkbox" />
<input class="result configItem" type="text"></span>
</td>
</tr>
`);
var tabs = [];
var tabHolder = [];
$(document).ready(function() {
configFormatData.forEach(function(item){
switch(item.fieldType){
case 'integer':
if(!tabs.hasOwnProperty(item.tab)){
tabs[item.tab] = $(`
<div class="panel panel-default">
<div class="panel-heading">` + item.tab + `
</div>
<div class="panel-body collapsible">
</div>
</div>
`);
}
var e = tabs[item.tab].find('.panel-body');
var x = integerNode.clone(true);
x.find('span').text(item.setting);
x.find('input:first').data({
code: item.code,
minimum: item.minimum,
size: 'mini'
});
if(item.hasOwnProperty('maximum')){
x.find('input:first').data('maximum',item.maximum);
}
x.append( '<span>' + item.units + '</span>')
e.append(x);
break;
case 'switch':
if(!tabs.hasOwnProperty(item.tab)){
tabs[item.tab] = $(`
<div class="panel panel-default">
<div class="panel-heading">` + item.tab + `
</div>
<div class="panel-body collapsible">
</div>
</div>
`);
}
var e = tabs[item.tab].find('.panel-body');
var x = switchNode.clone(true);
x.find('span').text(item.setting);
x.find('checkbox:first').data({
code: item.code,
off: item.values[0],
on: item.values[1],
size: 'mini'
}).addClass('bsToggle');
e.append(x);
break;
case 'axismask':
if(!tabs.hasOwnProperty(item.tab)){
tabs[item.tab] = $(`
<div class="panel panel-default">
<div class="panel-heading">` + item.tab + `
</div>
<div class="panel-body collapsible">
` + axisMaskNodeTable.html() + `
</div>
</div>
`);
}
var e = tabs[item.tab].find('tbody:first');
var x = axisMaskNode.clone(true);
x.find('td:first').text(item.setting);
x.find('input').each(function(index,inputItem){
if(item.is(':checkbox')){
x.data({
setting: "setting"+index,
value: Math.pow(2,index),
on: 'Inverted',
off: 'Normal',
size: 'mini'
}).addClass('bsToggle').
on('click',function(){
var parent = $(this).closest('tr');
var r = parent.find('.result:first');
parent.find(':checkbox').each(function(){
if($(this).is(':checked')){
var val = parseInt(r.val(), 10);
val = val + $(this).data('value');
}
});
});
} else {
$(this).data('code', item.code);
}
e.append(x);
});
break;
}
});
$(tabs).each(function(item){
$('#tabHolder').append(item);
})
$(tabs).find('.bsToggle').each(function(item){
item.bootstrapToggle({
size: item.size,
on: item.on,
off: item.off
})
});
});
</script>
<style>
#axisMaskHolder th{text-align:center;}
</style>
</head>
<div id="tabHolder">
</div>