Merge of dev-auth #1
@@ -76,6 +76,10 @@ async function main() {
|
|||||||
}
|
}
|
||||||
if (select.value === "other") {
|
if (select.value === "other") {
|
||||||
let otherInput = document.getElementById("other");
|
let otherInput = document.getElementById("other");
|
||||||
|
if (otherInput.value === "") {
|
||||||
|
showMessage("Tu as sélectionné autre mais tu n'as pas donné de nom", "N'oublie pas de soit sélectioner une personne ou de mettre un nom dans ''Autre:''.", true, "warning");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let otherInputLabel = document.getElementById("other_label");
|
let otherInputLabel = document.getElementById("other_label");
|
||||||
let player = await fetch("/player", {method: "post", body: JSON.stringify({"name": otherInput.value})}).then(r => r.json());
|
let player = await fetch("/player", {method: "post", body: JSON.stringify({"name": otherInput.value})}).then(r => r.json());
|
||||||
let option = document.createElement("option");
|
let option = document.createElement("option");
|
||||||
@@ -106,6 +110,10 @@ async function main() {
|
|||||||
title.textContent = "Vote -";
|
title.textContent = "Vote -";
|
||||||
if (select.value === "other") {
|
if (select.value === "other") {
|
||||||
let otherInput = document.getElementById("other");
|
let otherInput = document.getElementById("other");
|
||||||
|
if (otherInput.value === "") {
|
||||||
|
showMessage("Tu as sélectionné autre mais tu n'as pas donné de nom", "N'oublie pas de soit sélectioner une personne ou de mettre un nom dans ''Autre:''.", true, "warning");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let otherInputLabel = document.getElementById("other_label");
|
let otherInputLabel = document.getElementById("other_label");
|
||||||
let player = await fetch("/player", {method: "post", body: JSON.stringify({"name": otherInput.value})}).then(r => r.json());
|
let player = await fetch("/player", {method: "post", body: JSON.stringify({"name": otherInput.value})}).then(r => r.json());
|
||||||
let option = document.createElement("option");
|
let option = document.createElement("option");
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function show_plus(id, votes, players) {
|
|||||||
const app = document.getElementById("app");
|
const app = document.getElementById("app");
|
||||||
app.innerHTML = "";
|
app.innerHTML = "";
|
||||||
let vote = votes[id];
|
let vote = votes[id];
|
||||||
let player = "";
|
let player = "?";
|
||||||
for (let i = 0; i < players.length; i++) {
|
for (let i = 0; i < players.length; i++) {
|
||||||
if (players[i].id === vote["plus_player_id"]) {
|
if (players[i].id === vote["plus_player_id"]) {
|
||||||
player = players[i]["name"];
|
player = players[i]["name"];
|
||||||
@@ -63,7 +63,7 @@ function show_minus(id, votes, players) {
|
|||||||
let vote = votes[id];
|
let vote = votes[id];
|
||||||
let nickname = vote["minus_nickname"];
|
let nickname = vote["minus_nickname"];
|
||||||
let reason = vote["minus_reason"];
|
let reason = vote["minus_reason"];
|
||||||
let player = "";
|
let player = "?";
|
||||||
for (let i = 0; i < players.length; i++) {
|
for (let i = 0; i < players.length; i++) {
|
||||||
if (players[i].id === vote["minus_player_id"]) {
|
if (players[i].id === vote["minus_player_id"]) {
|
||||||
player = players[i]["name"];
|
player = players[i]["name"];
|
||||||
@@ -122,7 +122,7 @@ async function show_results(players) {
|
|||||||
let counter = 0;
|
let counter = 0;
|
||||||
for (let i = 0; i < plus.length; i++) {
|
for (let i = 0; i < plus.length; i++) {
|
||||||
let p = plus[i];
|
let p = plus[i];
|
||||||
let player = "";
|
let player = "?";
|
||||||
for (let i = 0; i < players.length; i++) {
|
for (let i = 0; i < players.length; i++) {
|
||||||
if (players[i].id === p[0]) {
|
if (players[i].id === p[0]) {
|
||||||
player = players[i]["name"];
|
player = players[i]["name"];
|
||||||
@@ -149,7 +149,7 @@ async function show_results(players) {
|
|||||||
counter = 0;
|
counter = 0;
|
||||||
for (let i = 0; i < minus.length; i++) {
|
for (let i = 0; i < minus.length; i++) {
|
||||||
let p = minus[i];
|
let p = minus[i];
|
||||||
let player = "";
|
let player = "?";
|
||||||
for (let i = 0; i < players.length; i++) {
|
for (let i = 0; i < players.length; i++) {
|
||||||
if (players[i].id === p[0]) {
|
if (players[i].id === p[0]) {
|
||||||
player = players[i]["name"];
|
player = players[i]["name"];
|
||||||
|
|||||||
Reference in New Issue
Block a user