From 231251c5e456435e3375d7d03d61c87ad61d63da Mon Sep 17 00:00:00 2001 From: JdM Date: Thu, 16 May 2024 19:25:04 +0200 Subject: [PATCH] removed console.log --- scripts/getComments.js | 1 - scripts/loadTeachers.js | 1 - scripts/popup.js | 26 ++++++++++++++++++-------- scripts/sendComment.js | 1 - scripts/sendRating.js | 1 - 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/scripts/getComments.js b/scripts/getComments.js index a246565..f26464b 100644 --- a/scripts/getComments.js +++ b/scripts/getComments.js @@ -6,6 +6,5 @@ async function getComments(profId) { }), }); let responseJson = await response.json(); - console.log(responseJson); return responseJson; } diff --git a/scripts/loadTeachers.js b/scripts/loadTeachers.js index b3eb690..daa11a1 100644 --- a/scripts/loadTeachers.js +++ b/scripts/loadTeachers.js @@ -33,7 +33,6 @@ function addTeachers(teachers) { let htmlResult = ""; teachers.forEach((teacher) => { - console.log(teacher); htmlResult += /*html*/ `
diff --git a/scripts/popup.js b/scripts/popup.js index f51ef8d..25e2842 100644 --- a/scripts/popup.js +++ b/scripts/popup.js @@ -46,14 +46,24 @@ function openCommentsPopup(popupId, profId) { recreateNode(document.getElementById("commentPopup"), true); const sendCommentButton = document.getElementById("sendCommentButton"); - sendCommentButton.addEventListener("click", () => { - sendComment( - document.getElementById("commentContentInput").value, - profId - ).then(() => { - getComments(profId).then(function (comments) { - loadComments(comments); - }); + const sendCommentInput = document.getElementById("commentContentInput"); + console.log(sendCommentInput.value); + sendCommentInput.addEventListener("input", function (e) { + alert(e.key); + if (e.key == "Enter") { + onCommentSend(); + } + }); + sendCommentButton.addEventListener("click", () => onCommentSend()); +} + +function onCommentSend() { + sendComment( + document.getElementById("commentContentInput").value, + profId + ).then(() => { + getComments(profId).then(function (comments) { + loadComments(comments); }); }); } diff --git a/scripts/sendComment.js b/scripts/sendComment.js index 81fd649..25d473c 100644 --- a/scripts/sendComment.js +++ b/scripts/sendComment.js @@ -7,7 +7,6 @@ async function sendComment(content, teacher_ID) { }), }); let responseJson = await response.json(); - console.log(responseJson); // if (responseJson.info == "vote updated") { // alert("Votre vote a été mis a jour"); // } diff --git a/scripts/sendRating.js b/scripts/sendRating.js index 45f9452..ba7cbaa 100644 --- a/scripts/sendRating.js +++ b/scripts/sendRating.js @@ -10,7 +10,6 @@ async function sendVotes(profId, teachingQuality, kindness, authority, humor) { }), }); let responseJson = await response.json(); - console.log(responseJson); if (responseJson.info == "vote updated") { alert("Votre vote a été mis a jour"); }