-
Notifications
You must be signed in to change notification settings - Fork 5
/
android.html
400 lines (354 loc) · 16.1 KB
/
android.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
<!doctype html>
<!--
Copyright (c) 2013, Empirical Modelling Group
All rights reserved.
See LICENSE.txt
-->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=0.9">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#29454B" />
<title>JS-EDEN</title>
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.12.1.min.css">
<link rel="stylesheet" type="text/css" href="css/jseden-mobile.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/eden.css">
<link rel="stylesheet" type="text/css" href="css/menu-bar-mobile.css">
<link rel="stylesheet" type="text/css" href="css/explorer.css">
<link rel="stylesheet" type="text/css" href="css/scriptbox.css">
<link rel="stylesheet" type="text/css" href="css/projectdetails-mobile.css">
<link rel="stylesheet" type="text/css" href="css/feedback.css">
<link rel="stylesheet" type="text/css" href="plugins/canvas/canvas.css"/>
<link rel="stylesheet" type="text/css" href="plugins/symbol-viewer/symbol-viewer.css">
<link rel="stylesheet" type="text/css" href="plugins/version-viewer/version-viewer.css">
<link rel="stylesheet" type="text/css" href="plugins/observable-mining/observable-mining.css">
<link rel="stylesheet" type="text/css" href="plugins/symbol-lookup-table/symbol-lookup-table.css" />
<link rel="stylesheet" type="text/css" href="plugins/dependency-map/dependency-map.css" />
<link rel="stylesheet" type="text/css" href="plugins/state-timeline/state-timeline.css" />
<link rel="stylesheet" type="text/css" href="plugins/state-listener/state-listener.css" />
<link rel="stylesheet" type="text/css" href="plugins/network-remote/network-remote.css" />
<link rel="stylesheet" type="text/css" href="plugins/external-html-content/external-html-content.css" />
<link rel="stylesheet" type="text/css" href="plugins/html/html-views.css" />
<link rel="stylesheet" type="text/css" href="plugins/input-dialog/interpreter.css" />
<link rel="stylesheet" type="text/css" href="plugins/input-dialog/details.css" />
<link rel="stylesheet" type="text/css" href="css/contextmenu.css" />
<link rel="stylesheet" type="text/css" href="css/highlighter.css" />
<link rel="stylesheet" type="text/css" href="css/markdown.css">
<link rel="stylesheet" type="text/css" href="plugins/input-dialog/gutter.css" />
<link rel="stylesheet" type="text/css" href="plugins/page/page.css" />
<link rel="stylesheet" type="text/css" href="plugins/adm/adm-input.css" />
<link rel="stylesheet" type="text/css" href="plugins/dbview/dbview.css" />
<link rel="stylesheet" type="text/css" href="plugins/veden/veden.css" />
<link rel="stylesheet" type="text/css" href="plugins/script-generator/script-generator.css" />
<link rel="stylesheet" type="text/css" href="plugins/observable-palette/observable-palette.css" />
<link rel="stylesheet" type="text/css" href="plugins/debugger/debugger.css" />
<link rel="stylesheet" type="text/css" media="print" href="css/print.css" />
<link rel="stylesheet" type="text/css" href="css/mobile.css">
<script type="text/javascript" src="js/lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/lib/jquery-ui-1.12.1.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.dialogextend.min.js"></script>
<style type="text/css">
/*If we ever upgrade to jquery.ui version 1.10 or later then remove the following rule. */
.ui-front {
/*z-index: 10000 !important;*/
}
.ui-top {
z-index: 200000 !important;
}
/* Used to force a dialog to the back */
.ui-back {
z-index: 9000 !important;
}
.ui-dialog {
z-index: 9999;
}
</style>
</head>
<body>
<script src="js/lib/jquery.color.js"></script>
<script src="js/lib/jquery.hotkeys.js"></script>
<script src="js/lib/json2.js"></script>
<script src="js/lib/diff_match_patch.js"></script>
<script src="js/lib/showdown.min.js"></script>
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script>
<script src="js/core/jseden.min.js"></script>
<script src="js/ui/jseden-ui.min.js"></script>
<script src="js/dummyconsole.js"></script>
<script src="js/arrayCompareFix.js"></script>
<script src="plugins/jseden-plugins.min.js"></script>
<script type="text/javascript">
var projects;
$(".loadmodal").show();
Construit(undefined, function(loaded) {
// Place to record projects by tag.
Eden.projecttags = {};
var cachedprojects;
var maxres = URLUtil.getParameterByName("max");
var searchstr = "";
maxres = (maxres && maxres != "") ? parseInt(maxres) : undefined;
$(".loadmodal").hide();
if (!loaded) {
var q = URLUtil.getParameterByName("q");
var lopts = $("#loadoptions");
function updateSearch() {
var pbrowser = lopts.find("#project-browser");
pbrowser.get(0).style.display = "none";
var plist = pbrowser.get(0).previousSibling;
//console.log(plist);
if (plist === null || plist.nodeName == "#text" || plist.getAttribute("id") != "jseden-project-search") {
var pliste = document.createElement("div");
pliste.setAttribute("id", "jseden-project-search");
pliste.style.height = "initial";
pbrowser.get(0).parentNode.insertBefore(pliste, pbrowser.get(0));
plist = pliste;
pliste.className = "jseden-dialog-plisting";
}
//console.log("Load projects: " + path);
Eden.DB.search(searchstr, 1, 50, undefined, function(data) {
//console.log("SEARCH",searchstr,data,plist);
//var pliste = plist.get(0);
while (plist.lastChild) plist.removeChild(plist.lastChild);
EdenUI.ProjectDetails._searchProjects(searchstr, $(plist), true, data, 50, 1, false);
});
}
function updateSearch2(searchstr, sortby, plist, count) {
if (count === undefined) count = 10;
Eden.DB.search(searchstr, 1, count, sortby, function(data) {
//console.log("SEARCH",searchstr,data,plist);
//var pliste = plist.get(0);
while (plist.lastChild) plist.removeChild(plist.lastChild);
EdenUI.ProjectDetails._searchProjects(searchstr, $(plist), true, data, count, 1, false);
});
}
Eden.Project.listenTo("loading", this, function() {
lopts.css("display","none");
});
lopts.css("display","block");
lopts.on("keyup",".search", function(e) {
var sortby = "downloads";
var out = document.getElementById("project-searchresults");
updateSearch2(e.currentTarget.value, sortby, out);
})
.on("change",".search", function(e) {
var sortby = "downloads";
var out = document.getElementById("project-searchresults");
updateSearch2(e.currentTarget.value, sortby, out);
})
.on("click",".projectmore", function(e) {
var filter = e.currentTarget.parentNode.getAttribute("data-filter");
console.log("FILTER: " + filter);
searchstr = filter;
//updateSearch();
//lopts.find(".searchouter").remove();
var content = lopts.find(".project-content");
var pbrowser = $("#defaultcontent");
pbrowser.get(0).style.display = "none";
//var welcometext = $("#welcometext");
//welcometext.get(0).style.display = "none";
//content[0].removeChild(content[0].firstChild);
var newblock = $('<div class="jseden-project-cat tmpitem" data-count="50" data-filter="'+searchstr+'">'+searchstr+'<div class="projectsearchouter"><input type="text" class="search projectsearch" placeholder="Search..."></input></div><select class="projectsort"><option>Popular</option><option>Recent</option><option>Rating</option></select></div>');
var newres = $('<div id="jseden-custom-projects" style="height: initial;" class="jseden-dialog-plisting tmpitem">');
//content.html("");
content.prepend(newres);
content.prepend(newblock);
EdenUI.ProjectDetails.searchProjects(newres, searchstr, 50, undefined, false, "downloads");
window.history.pushState({query: searchstr},"","?q="+encodeURIComponent(searchstr));
});
// P2P Dialog
var p2p = $('#p2pconnect');
p2p.on("click", "#p2pgo", function(e) {
var p2ppeer = document.getElementById("p2ppeer");
var p2proles = document.getElementById("p2proles");
//document.location = "?master="+p2ppeer.value;
eden.peer = new Eden.Peer(p2ppeer.value, undefined);
})
.on("click", "#p2plisten", function(e) {
var p2ppeer = document.getElementById("p2ppeer");
eden.peer = new Eden.Peer(undefined, p2ppeer.value);
});
function setLoadObserver() {
eden.root.lookup("_jseden_loaded").addJSObserver("hideProjects", function(sym, value) {
if (value) {
lopts.css("display","none");
$(".loadmessage").html("Loading...");
$(".loadmodal").hide();
}
});
}
setLoadObserver();
window.addEventListener("popstate", function(e) {
if (!e.state || !e.state.id) {
if (eden.project) window.location.reload();
else {
setLoadObserver();
lopts.css("display","block");
$(".tmpitem").remove();
var pbrowser = $("#defaultcontent");
pbrowser.get(0).style.display = "block";
}
} else {
lopts.css("display","none");
}
});
function addCategory(name, title, filter, sortby) {
var browser = $("#project-browser").get(0);
var cat = document.createElement("div");
cat.className = "jseden-project-cat";
cat.setAttribute("data-filter",filter);
cat.innerHTML = title+'<button style="display: inline-block;" class="script-button projectmore">See More</button>';
var cont = document.createElement("div");
cont.className = "jseden-dialog-plisting";
cont.id = "jseden-"+name+"-projects";
browser.appendChild(cat);
//browser.appendChild(poptags);
browser.appendChild(cont);
displayProjects(name, filter, sortby);
}
function displayProjects(id, query, sortby, cb) {
var plist = lopts.find("#jseden-"+id+"-projects");
EdenUI.ProjectDetails.searchProjects(plist, query, 10, cb, false, sortby);
}
if (Eden.DB.isConnected()) {
if (q && q != "") {
//searchstr = q;
//updateSearch();
//displayProjects(true, function() {
//updateSearch(q);
//});
lopts.find(".searchouter").remove();
var content = lopts.find(".project-content");
//content[0].removeChild(content[0].firstChild);
var newblock = $('<div class="jseden-project-cat">'+q+':</div>');
var newres = $('<div id="jseden-custom-projects" class="jseden-dialog-plisting">');
content.html("");
content.prepend(newres);
content.prepend(newblock);
EdenUI.ProjectDetails.searchProjects(newres, q, 10);
//displayProjects("featured", "#featured");
//displayProjects("recent");
} else {
/*displayProjects("featured", "#featured", "downloads");
displayProjects("recent");
displayProjects("starter", "#starter", "downloads");
displayProjects("ref", "#documentation", "downloads");
displayProjects("conf", "#construit2017", "downloads");
displayProjects("games", "#game", "downloads");
displayProjects("oers", "#OERs", "downloads");*/
addCategory("featured", "Featured Construals", "#featured", "downloads");
addCategory("starter", "Starter Examples", "#starter", "downloads");
addCategory("recent", "All Construals", "", undefined);
addCategory("ref", "Reference", "#documentation", "downloads");
addCategory("conf", "Construit 2017", "#construit2017", "downloads");
addCategory("games", "Games", "#game", "downloads");
addCategory("oers", "Educational Resources", "#OERs", "downloads");
}
if (Eden.DB.isLoggedIn() == false) {
//$("#welcometext").get(0).style.display = "block";
}
} else {
//$("#welcometext").get(0).style.display = "block";
$("#project-browser").html('<p>Construal store: <span style="color:red; font-weight: bold;">offline</span>. You are offline or our server is undergoing maintenance, try again later or look at the selected examples below.</p><div class="jseden-project-cat">Examples:</div><div id="jseden-offline-projects" class="jseden-dialog-plisting"></div>');
var plist = lopts.find("#jseden-offline-projects");
var projects = [];
for (var x in Eden.Project.local) {
Eden.Project.local[x].name = x;
if (Eden.Project.local[x].listed) projects.push(Eden.Project.local[x]);
}
EdenUI.ProjectDetails.localProjects(plist, projects, false);
}
Eden.DB.listenTo("login", this, function(name) {
var plist = lopts.find("#jseden-private-projects").get(0);
if (!plist) return;
var node = plist.firstChild;
while (node) {
var next = node.nextSibling;
plist.removeChild(node);
node = next;
}
displayProjects("private",":me");
//$("#welcometext").get(0).style.display = "none";
$("#privateprojects").get(0).style.display = "block";
//$("#projectbuttons").get(0).style.display = "flex";
document.getElementById("p2plisten").disabled = false;
document.getElementById("mobilelogin").style.display = "none";
document.getElementById("mobilelogout").style.display = "initial";
document.getElementById("menubar-obscurer").style.display = "none";
});
Eden.DB.listenTo("logout", this, function() {
var plist = lopts.find("#jseden-private-projects").get(0);
if (!plist) return;
var node = plist.firstChild;
while (node) {
var next = node.nextSibling;
plist.removeChild(node);
node = next;
}
document.getElementById("privateprojects").style.display = "none";
document.getElementById("p2plisten").disabled = true;
document.getElementById("mobilelogin").style.display = "initial";
document.getElementById("mobilelogout").style.display = "none";
//$("#welcometext").get(0).style.display = "block";
//displayProjects(true);
});
Eden.Project.listenTo("load", this, function() {
$(".loadmodal").hide();
});
Eden.Peer.listenTo("status", this, function(msg, code) {
document.getElementById("p2pconnect").style.display = "none";
var ele = document.getElementById("p2pconnected");
if (code == 1) {
ele.style.display = "flex";
}
});
}
});
</script>
<div id="jseden-main">
<div id="jseden-views"></div>
</div>
<div class="loadmodal modal" style="display: block">
<div class="loaddialog">
<div class="mainloader">Loading...</div>
<div class="loadmessage">Loading...</div>
</div>
</div>
<div id="loadoptions" class="" style="display: none;">
<div class="project-content">
<div id="defaultcontent">
</div>
<div id="projectbuttons" class="jseden-dialog-plisting">
<img width="278" src="images/construit_logo_5.png"/>
<button id="mobilelogin" onclick="edenUI.menu.showLogin();"><span class="icon"></span>Sign-In</button>
<button id="mobilelogout" style="display: none;" onclick="Eden.DB.logOut();"><span class="icon"></span>Sign-Out</button>
<button onclick="document.getElementById('p2pconnect').style.display = 'flex';"><span class="icon"></span>P2P Connect</button>
</div>
<div class="projectsearchouter"><input type="text" class="search projectsearch" placeholder="Search..."></input></div>
<div id="project-searchresults" class="jseden-dialog-plisting"></div>
<div id="project-browser">
<div id="privateprojects" style="display: none">
<div class="jseden-project-cat" data-filter=":me">Your Projects<button class="script-button projectmore">See More</button></div>
<div id="jseden-private-projects" class="jseden-dialog-plisting">
</div>
</div>
</div>
</div>
</div>
</div>
<div id="p2pconnect" class="mobile-dialog" style="display: none;">
<img width="278" src="images/construit_logo_5.png"/>
<input id="p2ppeer" type="text" placeholder="Peer Name..."></input>
<input id="p2proles" type="text" placeholder="Your Roles..."></input>
<button id="p2pgo"><span class="icon"></span>Connect</button>
<button id="p2plisten" disabled><span class="icon"></span>Listen</button>
<button onclick="document.getElementById('p2pconnect').style.display = 'none';"><span class="icon"></span>Cancel</button>
</div>
<div id="p2pconnected" class="mobile-dialog" style="display: none;">
<div>P2P Connected</div>
<button onclick="document.getElementById('p2pconnected').style.display = 'none';">Continue</button>
</div>
<div id="tooltip" style="display:none"></div>
</body>
</html>