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