|
|
|
@ -167,10 +167,26 @@
|
|
|
|
|
<script src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
|
|
|
|
type="text/javascript" charset="utf-8"></script>
|
|
|
|
|
<script src="View/src/JS/baseMulti.js">
|
|
|
|
|
var index = '<?php echo $index; ?>';
|
|
|
|
|
var enigmeId = '<?php echo $enigme->getIdEnigme(); ?>';
|
|
|
|
|
console.log("Index&enigme"index + enigmeId);
|
|
|
|
|
document.getElementById ('editor').addEventListener('input', saveCode(index, enigmeId));
|
|
|
|
|
</script>
|
|
|
|
|
<script>
|
|
|
|
|
var index = '<?php echo $index; ?>';
|
|
|
|
|
var enigmeId = '<?php echo $enigme->getIdEnigme(); ?>';
|
|
|
|
|
console.log("Index&enigme"index + enigmeId);
|
|
|
|
|
function saveCode(index, enigmeId) {
|
|
|
|
|
console.log("saveCode");
|
|
|
|
|
console.log("[Savecode]index : " + index, "[Savecode]enigmeId : " + enigmeId);
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
// xhr.open('POST', 'http://localhost/Scripted/WEB/index.php?action=saveCode', true);
|
|
|
|
|
xhr.open('POST', 'http://82.165.180.114/Scripted/WEB/index.php?action=saveCodeMulti', true);
|
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
console.log('[SaveCode] '+xhr.responseText);
|
|
|
|
|
};
|
|
|
|
|
var searchParams = new URLSearchParams(window.location.search);
|
|
|
|
|
xhr.send("code=" + editor.getValue() + "&index=" + index, "&enigmeId=" + enigmeId);
|
|
|
|
|
}
|
|
|
|
|
document.getElementById ('editor').addEventListener('input', saveCode(index, enigmeId));
|
|
|
|
|
</script>
|
|
|
|
|
<?php
|
|
|
|
|
echo '<script src="View/src/JS/' . $enigme->getNom() . '.js"></script>';
|
|
|
|
|