ask scryfall

This commit is contained in:
Kyle
2020-02-23 15:33:41 -08:00
parent e3d4e999ff
commit b69c7ee8b1
11 changed files with 224 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
var fullAbilityList = new Array()
function loadAbilities() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
fullAbilityList = xhttp.responseText.split("$$$")
for (var i = 0; i < 3; i ++) {
fullAbilityList[i] = fullAbilityList[i].split(";")
}
}
}
xhttp.open("GET", "data/site/other/askScryfall/planeswalkerAbilities.txt", true);
xhttp.send();
}
function randomAbility(index) {
possibleAbilities = fullAbilityList[index]
document.getElementById("askScryfallResult").innerHTML = possibleAbilities[Math.floor(Math.random() * (possibleAbilities.length - 1))].replace(/\\"/g, '"')
}
loadAbilities()