mirror of
https://github.com/ssyyhhrr/stewardle.git
synced 2025-11-16 05:43:49 -05:00
Previous Constructors
This commit is contained in:
11
app.js
11
app.js
@@ -92,18 +92,18 @@ async function updateDrivers() {
|
|||||||
res.data.MRData.StandingsTable.StandingsLists[0].DriverStandings.forEach(driver => {
|
res.data.MRData.StandingsTable.StandingsLists[0].DriverStandings.forEach(driver => {
|
||||||
if (driver.Driver.driverId in drivers) {
|
if (driver.Driver.driverId in drivers) {
|
||||||
drivers[driver.Driver.driverId].wins += parseInt(driver.wins)
|
drivers[driver.Driver.driverId].wins += parseInt(driver.wins)
|
||||||
drivers[driver.Driver.driverId].constructor = team[driver.Constructors[0].name]
|
if (!drivers[driver.Driver.driverId].constructors.includes(team[driver.Constructors[0].name])) drivers[driver.Driver.driverId].constructors.push(team[driver.Constructors[0].name])
|
||||||
} else if (driver.Driver.hasOwnProperty("permanentNumber")) {
|
} else if (driver.Driver.hasOwnProperty("permanentNumber")) {
|
||||||
drivers[driver.Driver.driverId] = {
|
drivers[driver.Driver.driverId] = {
|
||||||
"firstName": driver.Driver.givenName,
|
"firstName": driver.Driver.givenName,
|
||||||
"lastName": driver.Driver.familyName,
|
"lastName": driver.Driver.familyName,
|
||||||
"code": driver.Driver.code,
|
"code": driver.Driver.code,
|
||||||
"nationality": flag[driver.Driver.nationality],
|
"nationality": flag[driver.Driver.nationality],
|
||||||
"constructor": team[driver.Constructors[0].name],
|
"constructors": [team[driver.Constructors[0].name]],
|
||||||
"permanentNumber": driver.Driver.permanentNumber,
|
"permanentNumber": driver.Driver.permanentNumber,
|
||||||
"age": getAge(driver.Driver.dateOfBirth),
|
"age": getAge(driver.Driver.dateOfBirth),
|
||||||
"firstYear": i,
|
"firstYear": i,
|
||||||
"wins": parseInt(driver.wins)
|
"wins": parseInt(driver.wins),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -179,8 +179,9 @@ function server() {
|
|||||||
if (guess.nationality == actual.nationality) response.push(1) // correct nationality
|
if (guess.nationality == actual.nationality) response.push(1) // correct nationality
|
||||||
else response.push(3) // incorrect nationality
|
else response.push(3) // incorrect nationality
|
||||||
|
|
||||||
// constructor
|
// constructors
|
||||||
if (guess.constructor == actual.constructor) response.push(1) // correct constructor
|
if (guess.constructors[guess.constructors.length - 1] == actual.constructors[guess.constructors.length - 1]) response.push(1) // correct constructor
|
||||||
|
else if (actual.constructors.includes(guess.constructors[guess.constructors.length - 1])) response.push(4) // previous constructor
|
||||||
else response.push(3) // incorrect constructor
|
else response.push(3) // incorrect constructor
|
||||||
|
|
||||||
// permanent number
|
// permanent number
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ input[type=text] {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
margin-bottom: 1.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
@@ -340,7 +341,6 @@ p a:hover {
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
width: 380px;
|
width: 380px;
|
||||||
margin-top: 1.4em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes shake {
|
@keyframes shake {
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ document.addEventListener("keyup", async function (event) {
|
|||||||
let frames = Array.from(document.getElementsByClassName("frame")).filter(x => x.childNodes.length == 0)
|
let frames = Array.from(document.getElementsByClassName("frame")).filter(x => x.childNodes.length == 0)
|
||||||
frames[0].innerHTML = `<div class="guess text">${obj.code}</div>`
|
frames[0].innerHTML = `<div class="guess text">${obj.code}</div>`
|
||||||
frames[1].innerHTML = `<img class="flag" src="./flags/${Object.values(obj)[0 + 3]}.svg">`
|
frames[1].innerHTML = `<img class="flag" src="./flags/${Object.values(obj)[0 + 3]}.svg">`
|
||||||
frames[2].innerHTML = `<img class="team" src="./logos/${Object.values(obj)[1 + 3]}.webp">`
|
frames[2].innerHTML = `<img class="team" src="./logos/${Object.values(obj)[1 + 3][Object.values(obj)[1 + 3].length - 1]}.webp">`
|
||||||
for (let i = 2; i < 6; i++) {
|
for (let i = 2; i < 6; i++) {
|
||||||
frames[i + 1].innerHTML = `<div class="guess text"> ${Object.values(obj)[i + 3]}</div>`
|
frames[i + 1].innerHTML = `<div class="guess text"> ${Object.values(obj)[i + 3]}</div>`
|
||||||
}
|
}
|
||||||
@@ -160,6 +160,7 @@ document.addEventListener("keyup", async function (event) {
|
|||||||
else if (answer == 1) frames[index + 1].classList.add("correct")
|
else if (answer == 1) frames[index + 1].classList.add("correct")
|
||||||
else if (answer == 2) frames[index + 1].classList.add("up")
|
else if (answer == 2) frames[index + 1].classList.add("up")
|
||||||
else if (answer == 3) frames[index + 1].classList.add("incorrect")
|
else if (answer == 3) frames[index + 1].classList.add("incorrect")
|
||||||
|
else if (answer == 4) frames[index + 1].classList.add("previous")
|
||||||
}, index * 250)
|
}, index * 250)
|
||||||
})
|
})
|
||||||
if (won || Array.from(document.getElementsByClassName("frame")).filter(x => x.childNodes.length == 0).length == 0) {
|
if (won || Array.from(document.getElementsByClassName("frame")).filter(x => x.childNodes.length == 0).length == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user