aboutsummaryrefslogtreecommitdiff
path: root/poll
diff options
context:
space:
mode:
Diffstat (limited to 'poll')
-rw-r--r--poll/public/script.js14
-rw-r--r--poll/public/style.css4
2 files changed, 15 insertions, 3 deletions
diff --git a/poll/public/script.js b/poll/public/script.js
index 8c56894..09f8c93 100644
--- a/poll/public/script.js
+++ b/poll/public/script.js
@@ -29,7 +29,19 @@ fetch("/auth/api/list" + (type == "teacher" ? "?class=teacher" : ""))
.then((response) => appendOption(response));
fetch("/poll/api/get?type=" + type)
- .then((response) => response.json())
+ .then(async (response) => {
+ let json;
+ try {
+ return await response.json();
+ } catch (e) {
+ document.querySelector("p").innerText = "";
+ question_label.innerText = "Du hast bereits alle Fragen beantwortet.";
+ document.querySelectorAll("label")[1].innerText = "Danke!";
+ document.querySelector("select").style.display = "none";
+ document.querySelector("button").style.display = "none";
+ throw "Oh nein, alle beantwortet!"; // :^)
+ }
+ })
.then((response) => {
question_label.innerText = response["question"];
question_input.setAttribute("value", response["id"]);
diff --git a/poll/public/style.css b/poll/public/style.css
index 9861f9d..80f9294 100644
--- a/poll/public/style.css
+++ b/poll/public/style.css
@@ -14,7 +14,7 @@ div {
main {
position: absolute;
- width: 30%;
+ width: 40%;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
@@ -30,7 +30,7 @@ select {
width: 100%;
}
-@media only screen and (max-width: 600px) {
+@media only screen and (max-width: 700px) {
main {
width: calc(100% - 50px);
}