Basic bonfire functionality completed
This commit is contained in:
@ -27,7 +27,7 @@ var escape = function(msg) {
|
||||
|
||||
// puts the message on the terminal
|
||||
var print = function(cls, msg) {
|
||||
codeOutput.setValue(escape(msg));
|
||||
codeOutput.setValue(msg);
|
||||
};
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ var api = {
|
||||
endLoading();
|
||||
}
|
||||
|
||||
print('separator');
|
||||
// print('separator');
|
||||
print('input', data.input);
|
||||
if (data.error) {
|
||||
print('message', data.error);
|
||||
@ -84,18 +84,20 @@ var reset = function() {
|
||||
// give some time to handle the last responce
|
||||
setTimeout( function() {
|
||||
endLoading();
|
||||
|
||||
while (el.terminal.hasChildNodes()) {
|
||||
el.terminal.removeChild(el.terminal.childNodes[0]);
|
||||
}
|
||||
codeOutput.setValue('Infinite loop detected!');
|
||||
|
||||
|
||||
print('message', 'Your code took too long to execute. Check for an infinite loop or recursion.');
|
||||
|
||||
|
||||
|
||||
// print('message', 'Your code took too long to execute. Check for an infinite loop or recursion.');
|
||||
// console.log('infinite loop');
|
||||
// $('#codeOutput.setValue('Infinite loop detected')')
|
||||
|
||||
reset();
|
||||
}, 10);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// initialize everything
|
||||
|
@ -2,6 +2,7 @@ extends ../layout
|
||||
block content
|
||||
script(src='/js/lib/codemirror/lib/codemirror.js')
|
||||
script(src='/js/lib/codemirror/addon/edit/closebrackets.js')
|
||||
script(src='/js/lib/codemirror/addon/edit/matchbrackets.js')
|
||||
script(src='/js/lib/codemirror/addon/lint/lint.js')
|
||||
script(src='/js/lib/codemirror/addon/lint/javascript-lint.js')
|
||||
script(src='//ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js')
|
||||
@ -34,6 +35,8 @@ block content
|
||||
mode: "javascript",
|
||||
theme: 'monokai',
|
||||
runnable: true,
|
||||
lint: true,
|
||||
matchBrackets: true,
|
||||
autoCloseBrackets: true,
|
||||
gutters: ["CodeMirror-lint-markers"],
|
||||
onKeyEvent : doLinting
|
||||
@ -81,7 +84,6 @@ block content
|
||||
$('#codeOutput').empty();
|
||||
var js = myCodeMirror.getValue();
|
||||
submit(js);
|
||||
console.log('submitted');
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user