-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiy.html
212 lines (198 loc) · 8.43 KB
/
diy.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>QuPlayground - Bell test</title>
<!--Gojs CDN-->
<script src="https://cdn.bootcss.com/gojs/1.8.20/go.js"></script>
<!--
<script src="https://cdnjs.cloudflare.com/ajax/libs/gojs/1.8.25/go-debug.js"></script>
-->
<!--Bootstrap CDN-->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap-grid.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap-reboot.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/bootstrap/4.1.1/js/bootstrap.bundle.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.1.1/js/bootstrap.js"></script>
<link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
<link href="json_syntax.css" rel="stylesheet">
<script src="json_syntax.js"></script>
<script src="qubit.js"></script>
<script id="code" src="main.js"></script>
</head>
<body onload="init()">
<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom box-shadow">
<h3 class="my-0 mr-md-auto font-weight-normal"><a href="index.html">
<b>Qu</b>Playground</a></h3>
<nav class="my-2 my-md-0 mr-md-3">
<a class="p-2 text-dark" href="#">Developing</a>
</nav>
<a class="btn btn-outline-primary" href="https://github.com/camelop/QuPlayground">Github page</a>
</div>
<div id="main" class="container">
<div style="width: 100%; display: flex; justify-content: space-between">
<div id="myPaletteDiv" style="width: 150px; margin-right: 2px; background-color: whitesmoke; border: solid 1px black"></div>
<div id="myDiagramDiv" style="flex-grow: 1; height: 600px; border: solid 1px black"></div>
</div>
<button type="button" class="btn btn-primary" style="width:24%" onclick="save()">
Save
<i class="fa fa-download fa-1.5x"></i>
</button>
<button type="button" class="btn btn-secondary" style="width:24%" onclick="load()">
Load
<i class="fa fa-upload fa-1.5x"></i>
</button>
<button type="button" class="btn btn-success" style="width:24%" onclick="refresh()">
Refresh
<i class="fa fa-refresh fa-1.5x"></i>
</button>
<button type="button" class="btn btn-danger" style="width:24%" onclick="openRunModal()">
Run
<i class="fa fa-play-circle fa-1.5x"></i>
</button>
<br>
<textarea class="form-control" id="mySavedModel" style="width:100%;height:150px">
{ "class": "go.GraphLinksModel",
"nodeDataArray": [
{"key":"P1", "text":"Double click to rename or edit config", "isGroup":true, "category":"Program", "loc":"0 0"},
{"key":"P1S1", "text":"Step1", "isGroup":true, "group":"P1", "category":"Stage", "loc":"0 23.522847498307936", "size":"126.38720703125 200"},
{"key":"P1S2", "text":"Step2", "isGroup":true, "group":"P1", "category":"Stage", "loc":"128 23.522847498307936", "size":"126.38720703125 200"},
{"key":"a", "group":"P1S1", "category":"JSBB", "text":"init", "isize":0, "osize":1, "code":"init = function(input) {return input;}", "loc":"20 53.52284749830794"},
{"key":"b", "group":"P1S1", "category":"Qgate", "isize":0, "osize":1, "gtype":"|0>", "loc":"20 101.52284749830794"},
{"key":"P1S22", "text":"Step3", "isGroup":true, "group":"P1", "category":"Stage", "loc":"256 23.522847498307936", "size":"126.38720703125 200"},
{"key":"baseJS_", "category":"JSBB", "text":"identity", "isize":0, "osize":0, "code":"identity = function(x) {return x;}", "loc":"148 53.52284749830794", "group":"P1S2"},
{"key":"baseJS_2", "category":"JSBB", "text":"identity", "isize":0, "osize":0, "code":"identity = function(x) {return x;}", "loc":"276 53.52284749830794", "group":"P1S22"},
{"key":"baseH_", "category":"Qgate", "isize":1, "osize":1, "gtype":"Hadamard", "loc":"148 101.52284749830794", "group":"P1S2"},
{"key":"baseM_", "category":"Qgate", "isize":1, "osize":1, "gtype":"Measure", "toJSBB":true, "loc":"276 101.52284749830794", "group":"P1S22"}
],
"linkDataArray": [
{"from":"b", "to":"baseH_"},
{"from":"baseH_", "to":"baseM_"}
]}
</textarea>
</div>
<!-- JSSB -->
<div class="modal fade" id="JSBB_modal" tabindex="-1" role="dialog" aria-labelledby="Settings" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Settings</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="row">
<div class="col-1"></div>
<div class="col-10">
description: <br>
<input type="text" placeholder="" id="JSBB_description" stype>
<br>
code: <br>
<textarea id="JSBB_code" style="width: 100%" rows="10"></textarea>
</div>
<div class="col-1"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">cancel</button>
<button type="button" class="btn btn-primary" onclick="closeJSBBModal()" data-dismiss="modal">apply</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
<!-- Qgate -->
<div class="modal fade" id="Qgate_modal" tabindex="-1" role="dialog" aria-labelledby="Settings" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Settings</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="center-block">
<form class="form-horizontal" align="center">
<fieldset>
<!-- Select Basic -->
<div class="controls" align="center">
<label class="control-label">gateType</label>
<select class="input-xlarge" id="Qgate_gtype">
<option>|0></option>
<option>|1></option>
<option>Identity</option>
<option>PauliX</option>
<option>PauliZ</option>
<option>PauliY</option>
<option>Hadamard</option>
<option>Phase</option>
<option>PiD8</option>
<option>CNOT</option>
<option>SWAP</option>
<option>C_U</option>
<option>Measure</option>
</select>
<br>
</div>
<label class="control-label">  inputSize</label>
<input type="number" placeholder="" id="Qgate_isize">
<br>
<label class="control-label">outputSize</label>
<input type="number" placeholder="" id="Qgate_osize">
<div class="control-group">
<!-- Multiple Checkboxes -->
<div class="controls">
<!-- Inline Checkboxes -->
<label class="checkbox inline">
<input type="checkbox" id="Qgate_fromJS"> fromJS
</label>
<label class="checkbox inline">
<input type="checkbox" id="Qgate_toJS"> toJS
</label>
</div>
</div>
</fieldset>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">cancel</button>
<button type="button" class="btn btn-primary" onclick="closeQgateModal()" data-dismiss="modal">apply</button>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>
<!-- Run_modal -->
<div class="modal fade bs-example-modal-lg" id="Run_modal" tabindex="-1" role="dialog" aria-labelledby="Settings" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="gridSystemModalLabel">Run settings</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<textarea id="Run_config" style="width: 100%" rows="5">
entry = function(programs) { for(var i in programs) {programs[i].run();}}
</textarea>
<div class="panel">
<div class="panel-body" style="word-break:break-all">
<p id="Run_text">
gzotpa
</p>
</div>
</div>
</div>
<div class="col-1"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">close</button>
<button type="button" class="btn btn-danger" onclick="run()">GO!</button>
</div>
</div>
</div>
</div>
</body>
</html>