Fixed my stupid mistake that almost killed the server again
This commit is contained in:
@ -133,7 +133,7 @@ editor.setOption("extraKeys", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Ctrl-Enter": function() {
|
"Ctrl-Enter": function() {
|
||||||
bonfireExecute();
|
bonfireExecute(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -480,7 +480,7 @@ var runTests = function(err, data) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function bonfireExecute() {
|
function bonfireExecute(test) {
|
||||||
goodTests = 0;
|
goodTests = 0;
|
||||||
attempts++;
|
attempts++;
|
||||||
ga('send', 'event', 'Challenge', 'ran-code', challenge_Name);
|
ga('send', 'event', 'Challenge', 'ran-code', challenge_Name);
|
||||||
@ -501,6 +501,7 @@ function bonfireExecute() {
|
|||||||
|
|
||||||
if(userJavaScript.match(/function/gi)){
|
if(userJavaScript.match(/function/gi)){
|
||||||
if(userJavaScript.match(/function\s*?\(|function\s+\w+\s*?\(/gi)){
|
if(userJavaScript.match(/function\s*?\(|function\s+\w+\s*?\(/gi)){
|
||||||
|
|
||||||
submit(userJavaScript, function (cls, message) {
|
submit(userJavaScript, function (cls, message) {
|
||||||
if (failedCommentTest) {
|
if (failedCommentTest) {
|
||||||
myCodeMirror.setValue(myCodeMirror.getValue() + "*/");
|
myCodeMirror.setValue(myCodeMirror.getValue() + "*/");
|
||||||
@ -510,11 +511,13 @@ function bonfireExecute() {
|
|||||||
}
|
}
|
||||||
else if (cls) {
|
else if (cls) {
|
||||||
codeOutput.setValue(message.error);
|
codeOutput.setValue(message.error);
|
||||||
|
if(test)
|
||||||
runTests('Error', null);
|
runTests('Error', null);
|
||||||
} else {
|
} else {
|
||||||
codeOutput.setValue(message.output);
|
codeOutput.setValue(message.output);
|
||||||
codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi, ''));
|
codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi, ''));
|
||||||
message.input = removeLogs(message.input);
|
message.input = removeLogs(message.input);
|
||||||
|
if(test)
|
||||||
runTests(null, message);
|
runTests(null, message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -533,11 +536,13 @@ function bonfireExecute() {
|
|||||||
}
|
}
|
||||||
else if (cls) {
|
else if (cls) {
|
||||||
codeOutput.setValue(message.error);
|
codeOutput.setValue(message.error);
|
||||||
|
if(test)
|
||||||
runTests('Error', null);
|
runTests('Error', null);
|
||||||
} else {
|
} else {
|
||||||
codeOutput.setValue(message.output);
|
codeOutput.setValue(message.output);
|
||||||
codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi, ''));
|
codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi, ''));
|
||||||
message.input = removeLogs(message.input);
|
message.input = removeLogs(message.input);
|
||||||
|
if(test)
|
||||||
runTests(null, message);
|
runTests(null, message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -550,7 +555,7 @@ function bonfireExecute() {
|
|||||||
editorValueForIFrame = editorValueForIFrame + "-->";
|
editorValueForIFrame = editorValueForIFrame + "-->";
|
||||||
}
|
}
|
||||||
if(!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) && challengeType === "0") {
|
if(!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) && challengeType === "0") {
|
||||||
safeHTMLRun(true);
|
safeHTMLRun(test);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
workerError("Unsafe $($)");
|
workerError("Unsafe $($)");
|
||||||
@ -563,7 +568,7 @@ function bonfireExecute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#submitButton').on('click', function() {
|
$('#submitButton').on('click', function() {
|
||||||
bonfireExecute();
|
bonfireExecute(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@ -573,9 +578,9 @@ $(document).ready(function(){
|
|||||||
myCodeMirror.setValue(editorValue.replace(/fccss/gi, '<script>').replace(/fcces/gi, "</script>"));
|
myCodeMirror.setValue(editorValue.replace(/fccss/gi, '<script>').replace(/fcces/gi, "</script>"));
|
||||||
if(typeof $preview.html() !== 'undefined') {
|
if(typeof $preview.html() !== 'undefined') {
|
||||||
$preview.load(function(){
|
$preview.load(function(){
|
||||||
bonfireExecute();
|
bonfireExecute(false);
|
||||||
});
|
});
|
||||||
} else{
|
} else{
|
||||||
bonfireExecute();
|
bonfireExecute(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -124,7 +124,7 @@ block content
|
|||||||
form.code
|
form.code
|
||||||
.form-group.codeMirrorView
|
.form-group.codeMirrorView
|
||||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||||
script(src='/js/lib/coursewares/commonFrameWork_0.0.3.js')
|
script(src='/js/lib/coursewares/commonFrameWork_0.0.4.js')
|
||||||
script.
|
script.
|
||||||
editor.setOption("mode", "javascript");
|
editor.setOption("mode", "javascript");
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ block content
|
|||||||
form.code
|
form.code
|
||||||
.codeMirrorView
|
.codeMirrorView
|
||||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||||
script(src = '/js/lib/coursewares/commonFrameWork_0.0.3.js')
|
script(src = '/js/lib/coursewares/commonFrameWork_0.0.4.js')
|
||||||
script.
|
script.
|
||||||
editor.setOption("mode", "text/html");
|
editor.setOption("mode", "text/html");
|
||||||
.col-md-4.col-lg-3
|
.col-md-4.col-lg-3
|
||||||
|
@ -72,7 +72,7 @@ block content
|
|||||||
form.code
|
form.code
|
||||||
.codeMirrorView
|
.codeMirrorView
|
||||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||||
script(src = '/js/lib/coursewares/commonFrameWork_0.0.3.js')
|
script(src = '/js/lib/coursewares/commonFrameWork_0.0.4.js')
|
||||||
script.
|
script.
|
||||||
editor.setOption("mode", "javascript");
|
editor.setOption("mode", "javascript");
|
||||||
#complete-courseware-dialog.modal(tabindex='-1')
|
#complete-courseware-dialog.modal(tabindex='-1')
|
||||||
|
Reference in New Issue
Block a user