-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplain.html
159 lines (150 loc) · 4.93 KB
/
plain.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="google" value="notranslate">
<title data-bind="text: title"></title>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="blockly/blockly_compressed.js"></script>
<script src="blockly/blocks_compressed.js"></script>
<script src="blockly/javascript_compressed.js"></script>
<script src="blockly/msg/js/en.js"></script>
<script src="knockout-3.4.0.js"></script>
<script src="JS-Interpreter/acorn_interpreter.js"></script>
<script src="blocks.js"></script>
<script src="mersenne-twister.js"></script>
<script src="download.js"></script>
<script src="array.js"></script>
<script src="plain.js"></script>
<style>
html, body {
height: 100%;
margin: 0;
}
body {
background-color: #fff;
font-family: sans-serif;
overflow: hidden;
}
h1 {
font-weight: normal;
font-size: 140%;
}
.table {
height: 100%;
width: 100%;
}
#blocklyArea {
height: 99%;
}
#faright {
text-align: right;
}
.arraytd {
border: 1px solid black;
padding: 5px;
width: 20px;
}
</style>
</head>
<body>
<table class="table">
<tr>
<td>
<a href="index.html"><h1 data-bind="text: title"></h1></a>
</td>
<td>
<div class="controls">
Browser memory: Load: <select data-bind="options: algorithms, value: algorithm, event:{ change: onChangeAlgorithm}"></select>
<input id="save" type="button" value="Save" data-bind="click: saveBrowser"></input>
<input id="delete" type="button" value="Delete" data-bind="click: deleteBrowser"></input>
From Disk:
<input id="upload" type="button" value="Upload" data-bind="click: upload"></input>
<input id="fileInput" type="file"/>
<input id="download" type="button" value="Download" data-bind="click: download"></input>
</div>
<div class="controls">
Algorithm:
<input id="clear" type="button" value="Clear" data-bind="click: clear"></input>
<input id="play" type="button" value="Play" data-bind="click: play, value: running() ? 'Pause' : 'Run'"></input>
<input id="step" type="button" value="Step" data-bind="click: step"></input>
Speed: <select data-bind="options: speeds, value: speed"></select>
<span data-bind="style: {color: status() == 'stopped' ? 'red' : 'green'}, text: status"></span>
<span>Steps: <span data-bind="text: steps"></span></span>
</div>
</td>
</tr>
<tr>
<td style="width:40%; padding:5px">
<div style="overflow-y: scroll; height:100%;">
<h3>Variables</h3>
<table>
<tbody data-bind="foreach: variables">
<tr>
<td class="arraytd"><span data-bind="text: name"></span></td>
<td class="arraytd"><span data-bind="text: val"></span></td>
</tr>
</tbody>
</table>
<div data-bind="if: variables().length==0">
None
</div>
</div>
</td>
<td id="blocklyArea" style="padding: 5px;" colspan="2">
</td>
</tr>
</table>
<div id="blocklyDiv" style="position: absolute; padding: 5px"></div>
<xml id="toolbox" style="display: none">
<category name="Operations">
<block type="controls_if"></block>
<block type="logic_operation"></block>
<block type="logic_compare"></block>
<block type="math_number"></block>
<block type="math_arithmetic"></block>
<block type="text"></block>
<block type="text_print"></block>
<block type="text_prompt"></block>
<block type="array_swap"></block>
<block type="array_length"></block>
<block type="array_get"></block>
<block type="array_set"></block>
</category>
<category name="Loops">
<block type="controls_repeat_ext"></block>
<block type="controls_flow_statements"></block>
<block type="controls_whileUntil"></block>
<block type="controls_for">
<value name="FROM">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="TO">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
<value name="BY">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
</category>
<category name="Variables" custom="VARIABLE"></category>
<category name="Functions" custom="PROCEDURE"></category>
</xml>
<script>
var model = null;
var init = function() {
model = new PlainModel();
model.init();
ko.applyBindings(model);
}
window.addEventListener('load', init);
</script>
</body>
</html>