bug fix + add multiple correct anwsers
This commit is contained in:
parent
7d01dcda30
commit
8833deaace
23
gst.js
23
gst.js
@ -25,7 +25,7 @@ function getRandomCpu() {
|
||||
let randomIndex;
|
||||
do {
|
||||
randomIndex = getRandomInt(0, cpuList.length)
|
||||
} while (typeof(cpuList[randomIndex]["type"]) == null)
|
||||
} while (typeof(cpuList[randomIndex]["type"]) == null || cpuList[randomIndex]["type"] == "null" || cpuList[randomIndex]["type"] == null);
|
||||
|
||||
|
||||
return {
|
||||
@ -51,6 +51,10 @@ export async function btnClick(typ) {
|
||||
|
||||
let btns = [btnDesktop, btnLaptop, btnMobile, btnServer];
|
||||
|
||||
btns.forEach((el) => {
|
||||
el.setAttribute("disabled", "");
|
||||
})
|
||||
|
||||
switch (typ) {
|
||||
case 0:
|
||||
btnDesktop.style.backgroundColor = "#FF4444";
|
||||
@ -66,25 +70,24 @@ export async function btnClick(typ) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (currentCpu.type) {
|
||||
case "Desktop":
|
||||
if(currentCpu.type.includes("Desktop")) {
|
||||
btnDesktop.style.backgroundColor = "lightgreen";
|
||||
break;
|
||||
case "Laptop":
|
||||
}
|
||||
if(currentCpu.type.includes("Laptop")) {
|
||||
btnLaptop.style.backgroundColor = "lightgreen";
|
||||
break;
|
||||
case "Mobile/Embedded":
|
||||
}
|
||||
if(currentCpu.type.includes("Mobile/Embedded")) {
|
||||
btnMobile.style.backgroundColor = "lightgreen";
|
||||
break;
|
||||
case "Server":
|
||||
}
|
||||
if(currentCpu.type.includes("Server")) {
|
||||
btnServer.style.backgroundColor = "lightgreen";
|
||||
break;
|
||||
}
|
||||
|
||||
await delay(2000);
|
||||
|
||||
btns.forEach( (el) => {
|
||||
el.style.backgroundColor = "#3CC3FA";
|
||||
el.removeAttribute("disabled");
|
||||
})
|
||||
|
||||
nextRound();
|
||||
|
Loading…
Reference in New Issue
Block a user