-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
119 lines (101 loc) · 4.04 KB
/
index.html
File metadata and controls
119 lines (101 loc) · 4.04 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Pain Lab Control Panel</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval';" />
<link rel="stylesheet" href="frontend/css/index.css">
<script>window.$ = window.jQuery = require('jquery');</script>
<script src="frontend/js/jquery-resizable.js"></script>
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css">
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="node_modules/bean/bean.min.js"></script>
<script type="text/javascript" src="node_modules/underscore/underscore-min.js"></script>
<script type="text/javascript" src="node_modules/flotr2/flotr2.nolibs.js"></script>
</head>
<body style="background: #FAFAFA;">
<nav class="side-bar">
<div class="nav-tabs">
<div id="device-detail-button" onclick="switchTab('device-detail-button', 'device-detail-tab')" class="nav-tab active-tab tab">
<div class="nav-icon-wrapper">
<i class="fas fa-project-diagram"></i>
</div>
</div>
<div id="script-button" onclick="switchTab('script-button', 'script-tab')" class="nav-tab tab">
<div class="nav-icon-wrapper">
<i class="fas fa-file-code"></i>
</div>
</div>
</div>
</nav>
<div id="device-detail-tab" class="panel-container">
<div id="device-select-panel" class="panel-left">
</div>
<div class="splitter">
</div>
<div class="panel-right">
<div id="detail-display">
</div>
</div>
</div>
<div id="script-tab" class="panel-container", style="display: none;">
<div id="script-select-panel" class="panel-left">
</div>
<div class="splitter">
</div>
<div class="panel-right">
<div id="script-actions">
Activated Script: <div id="activated-script-name">None</div>
<button id="activate-script" onclick="runUserScript()">Activate</button>
<button id="save-script" onclick="saveUserScript()">Save</button>
</div>
<div id="script-display">
</div>
</div>
</div>
</body>
<script type="text/javascript" defer src="node_modules/@fortawesome/fontawesome-free/js/all.js"></script>
<script src="frontend/js/renderer.js"></script>
<script>
$(".panel-left").resizable({
handleSelector: ".splitter",
resizeHeight: false
});
$(".panel-top").resizable({
handleSelector: ".splitter-horizontal",
resizeWidth: false
});
var codeMirrorEditor = CodeMirror(document.getElementById("script-display"), {
value: "",
mode: "javascript"
});
codeMirrorEditor.setSize(null, 1200);
requestSavedScriptList();
/* Box-Muller transform normal distribution generator, Mean 0 variance 1
Author: https://stackoverflow.com/a/36481059
*/
function randn_bm() {
var u = 0, v = 0;
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
while(v === 0) v = Math.random();
return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
}
/* Fisher-Yates (aka Knuth) Shuffle
Credit: https://stackoverflow.com/a/2450976
*/
function inplace_shuffle(array) {
let currentIndex = array.length, randomIndex;
// While there remain elements to shuffle...
while (currentIndex != 0) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;
// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]];
}
return array;
}
</script>
</html>