2 '/static/jquery.terminal.css', // http://terminal.jcubic.pl/js/jquery.terminal.css
3 '/static/jquery-ui.css', // http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css
9 '/static/jquery.dimensions.js',
10 '/static/jquery.ui.core.js',
11 '/static/jquery.ui.widget.js',
12 '/static/jquery.ui.accordion.js',
13 '/static/jquery.svg.js',
14 '/static/jquery.terminal.js', // http://terminal.jcubic.pl/js/jquery.terminal-0.4.12.min.js
15 '/static/jquery.mousewheel.js', // http://terminal.jcubic.pl/js/jquery.mousewheel-min.js
16 '/static/jquery-ui.min.js', // http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js
17 '/static/bonescript.js',
18 '/static/beagle-ui.js',
19 '/static/ajaxorg-ace-builds-c2f3abb/ace.js'// https://github.com/ajaxorg/ace-builds/commit/c2f3abb2ecd3287f90225d804132f0fd26cfb639
22 var oldLog = console.log;
28 var area = $('#console-output');
29 for(var i in arguments) {
30 str += arguments[i].toString() + '\n';
32 oldLog.apply(console, arguments);
35 area.scrollTop(area[0].scrollHeight - area.height());
40 var url = cssUrls.shift();
42 var head = document.getElementsByTagName('head')[0];
43 var link = document.createElement('link');
44 link.rel = 'stylesheet';
45 link.type = 'text/css';
47 var linkObj = head.appendChild(link);
54 // based loosely on http://stackoverflow.com/questions/950087/include-javascript-file-inside-javascript-file
55 function loadScripts() {
56 var url = scriptUrls.shift();
58 loadScript(url, loadScripts);
64 function loadScript(url, callback) {
65 var head = document.getElementsByTagName('head')[0];
66 var script = document.createElement('script');
67 script.type = 'text/javascript';
69 script.charset = 'UTF-8';
70 var scriptObj = head.appendChild(script);
71 scriptObj.onload = callback;
74 function initClient() {
75 $('.use-editor').each(demoEdit);
76 var co_style = $('#console-output').attr('style');
77 $('#console-output').replaceWith('<textarea id="console-output" />')
78 $('#console-output').attr('style', co_style);
80 function demoEdit(index) {
81 if(typeof editor == 'undefined') editor = {};
83 editor[this.id].original = this.innerHTML;
84 editor[this.id].editor = ace.edit(this.id);
85 editor[this.id].editor.setTheme("ace/theme/textmate");
86 editor[this.id].editor.getSession().setMode("ace/mode/javascript");
87 var originalDemoRun = demoRun;
88 demoRun = function(myid) {
89 if(typeof editor[myid].editor != 'undefined') {
90 var code = editor[myid].editor.getValue();
93 originalDemoRun(myid);
100 alert(JSON.stringify(m));
103 function demoRun(id) {
104 var myScript = document.getElementById(id).innerHTML;
105 myScript = myScript.replace("<", "<");
106 myScript = myScript.replace(">", ">");
107 myScript = myScript.replace("&", "&");
111 function onShell(x) {
115 function shellRun(id) {
116 var myScript = document.getElementById(id).innerHTML;
117 var b = require('bonescript');
118 b.socket.on('shell', onShell);
119 b.socket.emit('shell', myScript);
122 function demoRestore(id) {
123 if(typeof editor[id] == 'undefined') return;
124 editor[id].editor.setValue(editor[id].original);
127 function myeval(script) {
131 console.log('Exception: ' + ex);