|
|
@ -30,31 +30,31 @@ function run() {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
runner.stopRunning();
|
|
|
|
runner.stopRunning();
|
|
|
|
}, 10 * 1000);
|
|
|
|
}, 10 * 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function run_init() {
|
|
|
|
function run_init() {
|
|
|
|
if (document.getElementById("console") != "") {
|
|
|
|
if (document.getElementById("console") != "") {
|
|
|
|
document.getElementById("console").innerHTML = "";
|
|
|
|
document.getElementById("console").innerHTML = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
run();
|
|
|
|
run();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var editor = ace.edit("editor");
|
|
|
|
var editor = ace.edit("editor");
|
|
|
|
editor.container.style.opacity = 0.85;
|
|
|
|
editor.container.style.opacity = 0.85;
|
|
|
|
editor.setTheme("ace/theme/vibrant_ink");
|
|
|
|
editor.setTheme("ace/theme/vibrant_ink");
|
|
|
|
editor.getSession().setMode("ace/mode/python");
|
|
|
|
editor.getSession().setMode("ace/mode/python");
|
|
|
|
editor.setFontSize("16px");
|
|
|
|
editor.setFontSize("16px");
|
|
|
|
editor.setOptions({
|
|
|
|
editor.setOptions({
|
|
|
|
enableLiveAutocompletion: true,
|
|
|
|
enableLiveAutocompletion: true,
|
|
|
|
copyWithEmptySelection: true,
|
|
|
|
copyWithEmptySelection: true,
|
|
|
|
showGutter: true,
|
|
|
|
showGutter: true,
|
|
|
|
useWrapMode: true, // wrap text to view
|
|
|
|
useWrapMode: true, // wrap text to view
|
|
|
|
indentedSoftWrap: false,
|
|
|
|
indentedSoftWrap: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//Function that execute given code and return the result in a given element by id
|
|
|
|
//Function that execute given code and return the result in a given element by id
|
|
|
|
|
|
|
|
|
|
|
|
function exec(code, id) {
|
|
|
|
function exec(code, id) {
|
|
|
|
const terminal = document.getElementById("console");
|
|
|
|
const terminal = document.getElementById("console");
|
|
|
|
terminal.innerHTML = "";
|
|
|
|
terminal.innerHTML = "";
|
|
|
|
const runner = new BrythonRunner({
|
|
|
|
const runner = new BrythonRunner({
|
|
|
@ -93,12 +93,12 @@ function run() {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
runner.stopRunning();
|
|
|
|
runner.stopRunning();
|
|
|
|
}, 10 * 1000);
|
|
|
|
}, 10 * 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* It checks if the code in the editor as the same result as the solution.
|
|
|
|
* It checks if the code in the editor as the same result as the solution.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function check() {
|
|
|
|
function check() {
|
|
|
|
if (retourSolution == "ERROR") {
|
|
|
|
if (retourSolution == "ERROR") {
|
|
|
|
result.innerHTML = "Il semblerait qu'il y a une erreur dans ton code :/";
|
|
|
|
result.innerHTML = "Il semblerait qu'il y a une erreur dans ton code :/";
|
|
|
|
} else if (retourSolution == retourCode) {
|
|
|
|
} else if (retourSolution == retourCode) {
|
|
|
@ -107,14 +107,12 @@ function run() {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
result.innerHTML = "Mauvaise réponse";
|
|
|
|
result.innerHTML = "Mauvaise réponse";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* If the help is displayed, hide it. Otherwise, display it.
|
|
|
|
* If the help is displayed, hide it. Otherwise, display it.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function displayHelp() {
|
|
|
|
function displayHelp() {
|
|
|
|
var help = document.getElementsByClassName("help");
|
|
|
|
var help = document.getElementsByClassName("help");
|
|
|
|
|
|
|
|
|
|
|
|
if (help[0].style.display == "block") {
|
|
|
|
if (help[0].style.display == "block") {
|
|
|
@ -127,5 +125,11 @@ function run() {
|
|
|
|
for (var i = 0; i < help.length; i++) {
|
|
|
|
for (var i = 0; i < help.length; i++) {
|
|
|
|
help[i].style.display = "block";
|
|
|
|
help[i].style.display = "block";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* It opens a new window with the name dashboard.html and the size of 1000x450.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function dashboard() {
|
|
|
|
|
|
|
|
window.open("dashboard.html", "", "width=1000, height=450");
|
|
|
|
|
|
|
|
}
|