Add clear and example buttons
This commit is contained in:
parent
6fd1f6a46d
commit
a498c5b5cd
|
@ -34,12 +34,25 @@ header {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
#exBtn {
|
||||||
|
background-color: #9A9F03;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
display: inline-block;
|
||||||
|
width: 25%;
|
||||||
|
border: none;
|
||||||
|
height: 50px;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
#exBtn:hover {
|
||||||
|
background-color: #7A7F0A;
|
||||||
|
}
|
||||||
#runBtn {
|
#runBtn {
|
||||||
background-color: #079992;
|
background-color: #079992;
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
display: block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: 50%;
|
||||||
border: none;
|
border: none;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
|
@ -47,6 +60,19 @@ header {
|
||||||
#runBtn:hover {
|
#runBtn:hover {
|
||||||
background-color: #007972;
|
background-color: #007972;
|
||||||
}
|
}
|
||||||
|
#clearBtn {
|
||||||
|
background-color: #832317;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
display: inline-block;
|
||||||
|
width: 25%;
|
||||||
|
border: none;
|
||||||
|
height: 50px;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
#clearBtn:hover {
|
||||||
|
background-color: #6A1F13;
|
||||||
|
}
|
||||||
#console {
|
#console {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -13,6 +13,14 @@ function run() {
|
||||||
console = oldConsole
|
console = oldConsole
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function example() {
|
||||||
|
flask.updateCode("function foo(n) {\n for(i = 0; i < n; i++) {\n console.log('passe ' + i)\n }\n return n*n\n}\n\nconsole.log(foo(5))")
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCode() {
|
||||||
|
flask.updateCode("")
|
||||||
|
}
|
||||||
|
|
||||||
/* Penser à réimplémenter toute la console : https://developer.mozilla.org/fr/docs/Web/API/Console */
|
/* Penser à réimplémenter toute la console : https://developer.mozilla.org/fr/docs/Web/API/Console */
|
||||||
const oldConsole = console
|
const oldConsole = console
|
||||||
const newConsole = {
|
const newConsole = {
|
||||||
|
|
4
js.html
4
js.html
|
@ -14,7 +14,9 @@
|
||||||
<div id="codeContainer"><div id="code"></div></div><!--
|
<div id="codeContainer"><div id="code"></div></div><!--
|
||||||
--><div id="console">
|
--><div id="console">
|
||||||
</div>
|
</div>
|
||||||
<input type="button" onclick="run()" value="Exécuter !" id="runBtn" />
|
<input type="button" onclick="example()" value="Exemple" id="exBtn" /><!--
|
||||||
|
--><input type="button" onclick="run()" value="Exécuter !" id="runBtn" /><!--
|
||||||
|
--><input type="button" onclick="clearCode()" value="Effacer" id="clearBtn" />
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
Romain de Laage - CC0
|
Romain de Laage - CC0
|
||||||
|
|
12
lua.html
12
lua.html
|
@ -16,7 +16,9 @@
|
||||||
<div id="codeContainer"><div id="code"></div></div><!--
|
<div id="codeContainer"><div id="code"></div></div><!--
|
||||||
--><div id="console">
|
--><div id="console">
|
||||||
</div>
|
</div>
|
||||||
<input type="button" onclick="run()" value="Exécuter !" id="runBtn" />
|
<input type="button" onclick="example()" value="Exemple" id="exBtn" /><!--
|
||||||
|
--><input type="button" onclick="run()" value="Exécuter !" id="runBtn" /><!--
|
||||||
|
--><input type="button" onclick="clearCode()" value="Effacer" id="clearBtn" />
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
Romain de Laage - CC0
|
Romain de Laage - CC0
|
||||||
|
@ -28,6 +30,14 @@
|
||||||
function run() {
|
function run() {
|
||||||
fengari.load(flask.getCode())()
|
fengari.load(flask.getCode())()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function example() {
|
||||||
|
flask.updateCode("function foo(n)\n for i = 0, n, 1 do\n print('passe ' .. tostring(i))\n end\n return n*n\nend\n\nprint(foo(5))")
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCode() {
|
||||||
|
flask.updateCode("")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
12
python.html
12
python.html
|
@ -17,7 +17,9 @@
|
||||||
<div id="codeContainer"><div id="code"></div></div><!--
|
<div id="codeContainer"><div id="code"></div></div><!--
|
||||||
--><div id="console">
|
--><div id="console">
|
||||||
</div>
|
</div>
|
||||||
<input type="button" onclick="run()" value="Exécuter !" id="runBtn" />
|
<input type="button" onclick="example()" value="Exemple" id="exBtn" /><!--
|
||||||
|
--><input type="button" onclick="run()" value="Exécuter !" id="runBtn" /><!--
|
||||||
|
--><input type="button" onclick="clearCode()" value="Effacer" id="clearBtn" />
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
Romain de Laage - CC0
|
Romain de Laage - CC0
|
||||||
|
@ -62,6 +64,14 @@ document['console'].html = ''
|
||||||
ids:["pycode"]
|
ids:["pycode"]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function example() {
|
||||||
|
flask.updateCode("def foo(n):\n for i in range(n):\n print('passe ' + str(i))\n return n*n\n\nprint(foo(5))")
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCode() {
|
||||||
|
flask.updateCode("")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue