3ème essaie
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent 1780eb9b84
commit 682658bc03

@ -128,19 +128,4 @@ function run() {
help[i].style.display = "block"; help[i].style.display = "block";
} }
} }
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);
}

@ -167,10 +167,26 @@
<script src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js" <script src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
type="text/javascript" charset="utf-8"></script> type="text/javascript" charset="utf-8"></script>
<script src="View/src/JS/baseMulti.js"> <script src="View/src/JS/baseMulti.js">
var index = '<?php echo $index; ?>'; </script>
var enigmeId = '<?php echo $enigme->getIdEnigme(); ?>'; <script>
console.log("Index&enigme"index + enigmeId); var index = '<?php echo $index; ?>';
document.getElementById ('editor').addEventListener('input', saveCode(index, enigmeId)); 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> </script>
<?php <?php
echo '<script src="View/src/JS/' . $enigme->getNom() . '.js"></script>'; echo '<script src="View/src/JS/' . $enigme->getNom() . '.js"></script>';

Loading…
Cancel
Save