-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
363 lines (318 loc) · 10.6 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<script type="text/javascript" src="//rawgit.com/amark/gun/master/gun.js"></script>
<script type="text/javascript" src="include/cytoscape.min.js"></script>
<script type="text/javascript" src="include/cytoscape-cose-bilkent.js"></script>
<script type="text/javascript" src="include/gGraph-v2.js"></script>
<script type="text/javascript" src="include/gIntrospect.js"></script>
<script type="text/javascript" src="include/gSetup.js"></script>
<link rel="stylesheet" type="text/css" href="include/simple-console.css">
<script type="text/javascript" src="include/simple-console.js"></script>
<style type="text/css">
html, body {
height: 100%;
width: 100%;
}
body {
height: 100%;
margin: 0;
display: flex;
flex: 1;
}
#graph {
margin-top: 10px;
width: 70%;
height: 80%;
}
.simple-console {
margin-top: 50px;
width: 50%;
height: 100%;
display: block;
}
pre {
font-weight: bold;
z-index:9999999;
}
code {
position: absolute;
right: 2em;
bottom: 1.5em;
pointer-events: none;
}
.buttons {
position: absolute;
right: 1em;
top: 0.75em;
z-index: 100;
}
</style>
<title>GunDB Graph Live</title>
<script type='text/javascript'>//<![CDATA[
window.onload=function(){
localStorage.clear();
window.gEx1 = {
setUpExample: function() {
g.get('person/john').put({name:'john doe', gender:'m'});
g.get('person/anne').put({name:'anne smith', gender:'f'});
window.refresh();
},
setUpCouple: function() {
g.get('person/anne').get('married_to').put( g.get('person/john'));
window.refresh();
},
setUpChild: function(){
g.get('person/max').put({name:'max doe', gender:'m'});
g.get('person/min').put({name:'min doe', gender:'f'});
g.get('set/children').set( g.get('person/max') );
g.get('set/children').set( g.get('person/min') );
g.get('person/min').get('sibling_to').put( g.get('person/max'));
g.get('person/anne').get('children').put( g.get('set/children') );
g.get('person/john').get('children').put( g.get('set/children') );
window.refresh();
}
};
gSetup(false, true);
var con = new SimpleConsole({
placeholder: "Gun Console (g)",
handleCommand: function(command){
try {
console.log(eval(command));
con.clear();
window.refresh();
} catch(error) {
con.error(error);
window.refresh();
}
},
autofocus: true, // if the console is to be the primary interface of the page
storageID: "app-console"
});
// add the console to the page
document.body.appendChild(con.element);
// show any uncaught errors
con.handleUncaughtErrors();
window.resetData = function() {
g._.graph = {};
gi = gIntrospect(g);
renderGraph = gGraph(g, gi, '#graph');
}
window.logData = function() {
gi.logAll();
}
window.refresh = function(){
setTimeout(function() {
renderGraph()
}, 500);
}
setTimeout(function() {
var gi = gIntrospect(g);
window.gi = gi;
window.renderGraph = gGraph(g, gi, '#graph');
}, 100);
}//]]>
</script>
</head>
<body>
<a href="https://github.com/lmangani/gun-scape"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/8b6b8ccc6da3aa5722903da7b58eb5ab1081adee/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_orange_ff7600.png"></a> <!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="googlebot" content="noindex, nofollow" />
<script
type="text/javascript"
src="//rawgit.com/amark/gun/master/gun.js"
></script>
<script type="text/javascript" src="include/cytoscape.min.js"></script>
<script
type="text/javascript"
src="include/cytoscape-cose-bilkent.js"
></script>
<script type="text/javascript" src="include/gGraph-v2.js"></script>
<script type="text/javascript" src="include/gIntrospect.js"></script>
<script type="text/javascript" src="include/gSetup.js"></script>
<link rel="stylesheet" type="text/css" href="include/simple-console.css" />
<script type="text/javascript" src="include/simple-console.js"></script>
<style type="text/css">
html,
body {
height: 100%;
width: 100%;
}
body {
height: 100%;
margin: 0;
display: flex;
flex: 1;
}
#graph {
margin-top: 10px;
width: 70%;
height: 80%;
}
.simple-console {
margin-top: 50px;
width: 50%;
height: 100%;
display: block;
}
pre {
font-weight: bold;
z-index: 9999999;
}
code {
position: absolute;
right: 2em;
bottom: 1.5em;
pointer-events: none;
}
.buttons {
position: absolute;
right: 1em;
top: 0.75em;
z-index: 100;
}
</style>
<title>GunDB Graph Live</title>
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
localStorage.clear();
window.gEx1 = {
setUpExample: function() {
g.get("person/john").put({ name: "john doe", gender: "m" });
g.get("person/anne").put({ name: "anne smith", gender: "f" });
window.refresh();
},
setUpCouple: function() {
g.get("person/anne")
.get("married_to")
.put(g.get("person/john"));
window.refresh();
},
setUpChild: function() {
g.get("person/max").put({ name: "max doe", gender: "m" });
g.get("person/min").put({ name: "min doe", gender: "f" });
g.get("set/children").set(g.get("person/max"));
g.get("set/children").set(g.get("person/min"));
g.get("person/min")
.get("sibling_to")
.put(g.get("person/max"));
g.get("person/anne")
.get("children")
.put(g.get("set/children"));
g.get("person/john")
.get("children")
.put(g.get("set/children"));
window.refresh();
}
};
gSetup(false, true);
var con = new SimpleConsole({
placeholder: "Gun Console (g)",
handleCommand: function(command) {
try {
console.log(eval(command));
con.clear();
renderGraph();
} catch (error) {
con.error(error);
}
},
autofocus: true, // if the console is to be the primary interface of the page
storageID: "app-console"
});
// add the console to the page
document.body.appendChild(con.element);
// show any uncaught errors
con.handleUncaughtErrors();
window.resetData = function() {
g._.graph = {};
gi = gIntrospect(g);
renderGraph = gGraph(g, gi, "#graph");
};
window.logData = function() {
gi.logAll();
};
window.refresh = function() {
setTimeout(function() {
renderGraph();
}, 500);
};
setTimeout(function() {
var gi = gIntrospect(g);
window.gi = gi;
window.renderGraph = gGraph(g, gi, "#graph");
}, 100);
}; //]]>
</script>
</head>
<body>
<a href="https://github.com/lmangani/gun-scape"
><img
style="position: absolute; top: 0; left: 0; border: 0;"
src="https://camo.githubusercontent.com/8b6b8ccc6da3aa5722903da7b58eb5ab1081adee/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f6f72616e67655f6666373630302e706e67"
alt="Fork me on GitHub"
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_orange_ff7600.png"
/></a>
<div id="graph"></div>
<div class="buttons">
<button onclick="window.gEx1.setUpExample()">Add Pair</button>
<button onclick="window.gEx1.setUpCouple()">Join Pair</button>
<button onclick="window.gEx1.setUpChild()">Clone Pair</button> |
<button onclick="renderGraph()">Refresh</button>
<!-- <button onclick="window.logData()">Log</button> -->
<button onclick="window.resetData()">Clear</button>
</div>
<code
>Scroll to Zoom. Example Syntax:
<pre>
g.get('person/me').put({name: 'Lorenzo'});
</pre
></code
>
<script>
// tell the embed parent frame the height of the content
if (window.parent && window.parent.parent) {
window.parent.parent.postMessage(
[
"resultsFrame",
{
height: document.body.getBoundingClientRect().height,
slug: "ca4womwf"
}
],
"*"
);
}
</script>
</body>
</html>
<div id="graph"></div>
<div class="buttons">
<button onclick="window.gEx1.setUpExample()">Add Pair</button>
<button onclick="window.gEx1.setUpCouple()">Join Pair</button>
<button onclick="window.gEx1.setUpChild()">Clone Pair</button> |
<button onclick="renderGraph()">Refresh</button>
<!-- <button onclick="window.logData()">Log</button> -->
<button onclick="window.resetData()">Clear</button>
</div>
<code>Scroll to Zoom. Example Syntax: <pre>
g.get('person/me').put({name: 'Lorenzo'});
</pre></code>
<script>
// tell the embed parent frame the height of the content
if (window.parent && window.parent.parent){
window.parent.parent.postMessage(["resultsFrame", {
height: document.body.getBoundingClientRect().height,
slug: "ca4womwf"
}], "*")
}
</script>
</body>
</html>