sort by set name (#770)

* fix https

* add beasts

* Remove extra file

* Prettier-ify code

* Prettier-ify

* add basic land guesser

also added fetcher to filter all cards instead of only unique art

* default to original

makes basic better

* added set symbol to basics

added set symbol to the basics game mode. Changed name to "How Basic"

* cleanup

* changed some pixels

* only load set data if needed

* hacked fix for removing image from name

* removed check from original

* remove check from original

* sort names by set instead of by set symbol

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
This commit is contained in:
marsteralex 2022-08-17 18:01:59 -07:00 committed by GitHub
parent 2c97be815b
commit 5bf39a7a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,7 +221,9 @@ function setUpNewGame() {
artDict = sampledData[0]
let randomImages = Object.keys(artDict)
shuffleArray(randomImages)
let namesList = Array.from(sampledData[1]).sort()
let namesList = Array.from(sampledData[1]).sort((a, b) =>
removeSymbol(a).localeCompare(removeSymbol(b))
)
// fill in the new cards and names
for (let cardIndex = 1; cardIndex <= k; cardIndex++) {
let currCard = document.getElementById('card-' + cardIndex)
@ -239,6 +241,11 @@ function setUpNewGame() {
}
}
function removeSymbol(name) {
let arr = name.split('>')
return arr[arr.length - 1]
}
function checkAnswers() {
let score = k
// show the correct full cards
@ -247,12 +254,12 @@ function checkAnswers() {
let incorrect = true
if (currCard.dataset.name) {
// remove image text
let guess = document
.getElementById(currCard.dataset.name)
.innerText.split('>')
let ans = artDict[currCard.dataset.url][0].split('>')
let guess = removeSymbol(
document.getElementById(currCard.dataset.name).innerText
)
let ans = removeSymbol(artDict[currCard.dataset.url][0])
window.console.log(ans, guess)
incorrect = ans[ans.length - 1] !== guess[guess.length - 1]
incorrect = ans !== guess
// decide if their guess was correct
}
if (incorrect) currCard.classList.add('incorrect')