Basic bonfire functionality completed

This commit is contained in:
webdev
2015-01-16 21:55:01 -05:00
parent adac5f6352
commit c39e2672fc
2 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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');
});