Commit 21ed42ce authored by Paul-Elliot Anglès d'Auriac's avatar Paul-Elliot Anglès d'Auriac
Browse files

support MathJax

parent cb04a202
......@@ -56,7 +56,7 @@ exports.listOfCourse = function (courseID, callback) {
function (room) {
return function (callback) {
bdd.query('SELECT COUNT(*) as number FROM poll WHERE `roomID` = ?', [room.id], function(err, ans) {
bdd.query('SELECT pseudo as owner FROM users WHERE `id` = ?', [room.ownerID], function(err, ans1) {
bdd.query('SELECT fullName as owner FROM users WHERE `id` = ?', [room.ownerID], function(err, ans1) {
room.number = ans[0].number;
room.owner = ans1[0].owner;
callback();
......
......@@ -62,6 +62,7 @@ socketAdmin.on('newStats', function (newStats) {
else
stat.response2 = document.querySelector("#r"+stat.response).innerHTML;
li.innerHTML = '<div style="display:flex; justify-content: space-between;color:'+color+';"> '+/*stat.pseudo*/stat.fullName+' : <span>'+stat.response2+'</span></div>'
MathJax.Hub.Queue(["Typeset",MathJax.Hub,li]);
ul.appendChild(li);
});
document.querySelector("#stats ul").innerHTML = ul.innerHTML;
......
......@@ -17,7 +17,9 @@ socket.on('connect', () => {
socket.on('newQuestion', function (reponse) {
// console.log(reponse);
document.querySelector("#question").textContent=reponse.enonce;
enonce = document.querySelector("#question");
enonce.textContent=reponse.enonce;
MathJax.Hub.Queue(["Typeset",MathJax.Hub,enonce]);
wrapper = document.querySelector("#wrapperAnswer");
while (wrapper.firstChild) {
wrapper.removeChild(wrapper.firstChild);
......@@ -32,6 +34,7 @@ socket.on('newQuestion', function (reponse) {
chooseAnswer(index);
});
elem.textContent = rep.reponse;
MathJax.Hub.Queue(["Typeset",MathJax.Hub,elem]);
wrapper.appendChild(elem);
});
});
......
......@@ -5,6 +5,9 @@
<title>title</title>
<link rel="stylesheet" href="/stylesheets/css_reset.css">
<link rel="stylesheet" href="/stylesheets/play_student.css">
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
<div id="question" onclick="chooseAnswer(-1)"></div>
......
......@@ -6,6 +6,9 @@
<link rel="stylesheet" href="/stylesheets/css_reset.css">
<link rel="stylesheet" href="/stylesheets/play_student.css">
<link rel="stylesheet" href="/stylesheets/play_admin.css">
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
<div id="answerContainer">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment