From 5eb14d6d09638c9ba3f034a019a8cd54c512b238 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Fri, 29 Jan 2021 11:31:24 +0100 Subject: Some fixes --- profile/public/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profile/public/user.js') diff --git a/profile/public/user.js b/profile/public/user.js index 39d6713..9a55682 100644 --- a/profile/public/user.js +++ b/profile/public/user.js @@ -13,7 +13,7 @@ function addUser(userData) { if (!questions.hasOwnProperty(questionID)) continue; const question = questions[questionID]; const div = document.createElement("div"); - div.innerHTML = `${question.question} ${question.answer || ""}`; + div.innerHTML = `${question.question.replace(//g, ">")} ${question.answer.replace(//g, ">") || ""}`; divs.push(div); } const h1 = document.createElement("h1"); -- cgit v1.2.3 From e83901076f3d15f5d601d53237f886b7bc34f50b Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Fri, 29 Jan 2021 13:42:31 +0100 Subject: Hmm --- profile/public/style.css | 6 ++++-- profile/public/user.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'profile/public/user.js') diff --git a/profile/public/style.css b/profile/public/style.css index 66c0bdf..db3457a 100644 --- a/profile/public/style.css +++ b/profile/public/style.css @@ -54,12 +54,14 @@ img { } #user h1, -#comments h2 { +#comments h2, +#char h2 { cursor: pointer; } #user h1:hover, -#comments h2:hover { +#comments h2:hover, +#char h2:hover { opacity: 0.8; } diff --git a/profile/public/user.js b/profile/public/user.js index 9a55682..6dfb95b 100644 --- a/profile/public/user.js +++ b/profile/public/user.js @@ -10,10 +10,10 @@ function addUser(userData) { const questions = userData.questions; const user = userData.user; for (const questionID in questions) { - if (!questions.hasOwnProperty(questionID)) continue; + if (!questions.hasOwnProperty(questionID) || questions[questionID].type === "file") continue; const question = questions[questionID]; const div = document.createElement("div"); - div.innerHTML = `${question.question.replace(//g, ">")} ${question.answer.replace(//g, ">") || ""}`; + div.innerHTML = `${question.question.replace(//g, ">")} ${(question.answer || "Hitler").replace(//g, ">") || ""}`; divs.push(div); } const h1 = document.createElement("h1"); -- cgit v1.2.3 From 8637186a9f835972a5a0b96e4df1665d6d42557a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 29 Jan 2021 14:10:17 +0100 Subject: idk --- profile/public/index.html | 6 ++++- profile/public/script.js | 60 +++++++++++++++++++++++++++-------------------- profile/public/style.css | 6 ++++- profile/public/user.js | 4 +++- profile/public/users.html | 10 +++++++- profile/public/users.js | 2 +- 6 files changed, 57 insertions(+), 31 deletions(-) (limited to 'profile/public/user.js') diff --git a/profile/public/index.html b/profile/public/index.html index a87fb77..91cb545 100644 --- a/profile/public/index.html +++ b/profile/public/index.html @@ -26,6 +26,10 @@

+

+ Bitte fülle diese Seite nur mit korrekten Daten aus, da diese direkt in der Abizeitung dargestellt + werden. Auf dem Kinderbild solltest du gut sichtbar und nicht älter als 8 Jahre sein. +

@@ -36,7 +40,7 @@ Picture - +
diff --git a/profile/public/script.js b/profile/public/script.js index 91b723e..db9a277 100644 --- a/profile/public/script.js +++ b/profile/public/script.js @@ -12,17 +12,18 @@ const controlButtons = document.querySelectorAll(".control-btns button"); let cropper = undefined; const crop = () => { - cropper = new Cropper(document.getElementById("popup-img"), { // Consider dataset id - dragMode: "move", + cropper = new Cropper(document.getElementById("popup-img"), { + // Consider dataset id + //dragMode: "move", aspectRatio: 10 / 13, - autoCropArea: 0.65, - restore: false, - guides: false, - center: false, - highlight: false, - cropBoxMovable: false, - cropBoxResizable: false, - toggleDragModeOnDblclick: false, + //autoCropArea: 0.65, + //restore: false, + //guides: false, + //center: false, + //highlight: false, + //cropBoxMovable: false, + //cropBoxResizable: false, + //toggleDragModeOnDblclick: false, }); }; @@ -86,7 +87,7 @@ form.addEventListener("submit", async (evt) => { const method = init ? "POST" : "PUT"; const inputs = form.querySelectorAll("input"); - const rawBody = {} + const rawBody = {}; for (const input of inputs) { if (input.type !== "file") rawBody[input.name] = input.value; } @@ -94,25 +95,32 @@ form.addEventListener("submit", async (evt) => { const resp = await fetch("api/answer", { method, body, headers: { "Content-Type": "application/json" } }); const res = await resp.json(); - if (!res.success) alert("AHHHH"); + if (!res.success) alert("An error occurred"); else init = false; }); saveBtn.addEventListener("click", (e) => { - cropper.getCroppedCanvas() - .toBlob(async (blob) => { - const url = "api/answerImage"; - const method = imageInit ? "POST" : "PUT"; - const body = new FormData(); - if (imageID === -1) { - return; - } - body.append(imageID, blob); - const resp = await fetch(url, { method, body }); - const res = await resp.json(); - if (!res.success) alert("AHHH"); - else imageInit = false; - }, "image/jpeg"); + cropper.getCroppedCanvas().toBlob(async (blob) => { + const url = "api/answerImage"; + const method = imageInit ? "POST" : "PUT"; + const body = new FormData(); + if (imageID === -1) { + return; + } + body.append(imageID, blob); + const resp = await fetch(url, { method, body }); + const res = await resp.json(); + if (!res.success) { + alert("An error occurred"); + } else { + imageInit = false; + popup.style.display = "none"; + cropper.destroy(); + document.querySelectorAll("img").forEach((elem) => { + if (elem.src.startsWith("http")) elem.src += "#" + new Date().getTime(); + }); + } + }, "image/jpeg"); }); slider.addEventListener("input", (e) => { diff --git a/profile/public/style.css b/profile/public/style.css index db3457a..becb428 100644 --- a/profile/public/style.css +++ b/profile/public/style.css @@ -141,4 +141,8 @@ img { display: none; max-height: 600px; max-width: 600px; -} \ No newline at end of file + left: 50%; + top: 50%; + transform: translateX(-50%) translateY(-50%); + border: 1px solid black; +} diff --git a/profile/public/user.js b/profile/public/user.js index 6dfb95b..963904c 100644 --- a/profile/public/user.js +++ b/profile/public/user.js @@ -13,7 +13,9 @@ function addUser(userData) { if (!questions.hasOwnProperty(questionID) || questions[questionID].type === "file") continue; const question = questions[questionID]; const div = document.createElement("div"); - div.innerHTML = `${question.question.replace(//g, ">")} ${(question.answer || "Hitler").replace(//g, ">") || ""}`; + div.innerHTML = `${question.question.replace(//g, ">")} ${ + (question.answer || "nichts").replace(//g, ">") || "" + }`; divs.push(div); } const h1 = document.createElement("h1"); diff --git a/profile/public/users.html b/profile/public/users.html index ebca429..f7bd346 100644 --- a/profile/public/users.html +++ b/profile/public/users.html @@ -19,12 +19,20 @@
-

Nutzerliste

+

+ Hier kannst du andere Schüler kommentieren und Erkennungsmerkmale schreiben. Diese werden dann auf dem + Steckbrief der jeweiligen Person in der Abizeitung dargestellt. +

+ TGM13.1
    + TGM13.2
      + TGTM13.1
        + TGI13.1
          + TGI13.2
            diff --git a/profile/public/users.js b/profile/public/users.js index 77bc85c..73f0e4a 100644 --- a/profile/public/users.js +++ b/profile/public/users.js @@ -2,7 +2,7 @@ function addUser(user) { const li = document.createElement("li"); li.textContent = `${user.name} ${user.middlename || ""} ${user.surname}`; li.addEventListener("click", () => window.location.assign(`./user.html?uid=${user.id}`)); - document.getElementById("class_" + user.class_id).appendChild(li); + if (user.class_id < 6) document.getElementById("class_" + user.class_id).appendChild(li); } fetch("/auth/api/list?class=all") -- cgit v1.2.3