This commit is contained in:
Kyle
2020-12-16 16:22:44 -08:00
parent 1a9d15d94b
commit bddedd324f
1124 changed files with 2165 additions and 0 deletions

22
askurza/askUrza.js Normal file
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", "/askUrza/planeswalkerAbilities.txt", true);
xhttp.send();
}
function randomAbility(index) {
possibleAbilities = fullAbilityList[index]
document.getElementById("askUrzaResult").innerHTML = possibleAbilities[Math.floor(Math.random() * (possibleAbilities.length - 1))].replace(/\\"/g, '"')
}
loadAbilities()

View File

@@ -0,0 +1,82 @@
<!DOCTYPE html PUBLIC>
<html>
<head>
<title>Ask Scryfall - Ability List Generator</title>
</head>
<body>
</body>
<script>
var plusAbilities = new Array()
var minusAbilities = new Array()
var ultimateAbilities = new Array()
function importPlaneswalkers(request) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var planeswalkerList = this.responseText.split('oracle_text":"')
var planeswalkerNameList = this.responseText.replace(/","name":"/g, "").split('"name":"')
//console.log(planeswalkerNameList)
var iAdjust = 0
for (var i = 1; i < planeswalkerList.length; i++) {
var planeswalkerAbilityList = planeswalkerList[i].split('",')[0].split(/\\n/g)
var planeswalkerName = planeswalkerNameList[i - iAdjust].split(/",/g)[0]
if (planeswalkerName.includes(" // ")) {
planeswalkerName = planeswalkerName.split(" // ")[1]
}
for (var n = 0; n < planeswalkerAbilityList.length; n++) {
if (planeswalkerAbilityList[n].includes(":")) {
var abilityText = planeswalkerAbilityList[n].substr(planeswalkerAbilityList[n].indexOf(": ") + 2)
if (abilityText != undefined) {
//console.log(abilityText, planeswalkerName, iAdjust)
abilityText = abilityText.replace(planeswalkerName, "Urza, Academy Headmaster")
var abilityType = planeswalkerAbilityList[n].split(":")[0]
if (!abilityType.includes("X")) {
if (abilityType.includes("+")) {
//plus
plusAbilities[plusAbilities.length] = abilityText
} else if (abilityType.includes("\u2212") && parseInt(abilityType.replace("\u2212", "")) > 4) {
//ult
ultimateAbilities[ultimateAbilities.length] = abilityText
} else if (abilityType.includes("\u2212") || abilityType == "0") {
//minus
minusAbilities[minusAbilities.length] = abilityText
} else {
//do nothing
}
}
}
}
}
if (i < planeswalkerList.length - 1 && planeswalkerList[i - 1].includes('"card_faces"')) {
iAdjust += 1
}
}
if (this.responseText.includes('"has_more":true')) {
importPlaneswalkers(this.responseText.split('"next_page":"')[1].split('","data"')[0].replace(/\\u0026/g, "&"))
} else {
var allAbilities = [plusAbilities, minusAbilities, ultimateAbilities]
let csvContent = "data:text/csv;charset=utf-8,";
allAbilities.forEach(function(rowArray) {
csvContent += rowArray.join(";") + "$$$";
})
var encodedUri = encodeURI(csvContent)
var download = document.createElement('a')
download.href = encodedUri
download.download = 'planeswalkerAbilities.txt'
document.body.appendChild(download)
download.click()
}
} else if (this.readyState == 4 && this.status == 404) {
alert("An error occurred. Please try again.");
}
}
xhttp.open("GET", request, true);
xhttp.send();
}
importPlaneswalkers("https://api.scryfall.com/cards/search?order=released&q=type%3Dplaneswalker")
</script>
</html>

106
askurza/index.html Normal file
View File

@@ -0,0 +1,106 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="description">
<meta name="keywords" content="keywords">
<link rel="stylesheet" href="/css/reset.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="shortcut icon" href="/favicon.ico">
<script src='/js/includeHTML.js'></script>
<script src='/js/main.js'></script>
</head>
<body onload='includeHTML();'>
<div class='background'></div>
<header html-include='/globalHTML/header.html'></header>
<div html-include='/globalHTML/menu.html'></div>
<!-- Page Specific Content Begins Here -->
<title>Ask Urza 2.0</title>
<h2 class='readable-background header-extension title center'>Ask Urza 2.0</h2>
<style>
.askUrzaGrid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: auto 90pt auto;
align-items: center;
justify-items: center;
grid-gap: 2rem;
}
.urzaCard {
width: 90vw;
text-align: center;
grid-column: 1 / span 3;
}
.urzaCard > img {
width: 100%;
height: auto;
}
.askUrzaButton {
height: auto;
width: 22vw;
transition: 0.25s;
cursor: pointer;
}
#askUrzaResult {
grid-column: 1 / span 3;
padding: 1rem;
margin: 0.5rem;
border-radius: 1rem;
font: 1.5rem belerenb;
}
@media screen and (min-width: 864pt) {
.askUrzaGrid {
grid-template-columns: calc(360pt) 1fr 1fr 1fr !important;
grid-template-rows: 92pt auto !important;
}
.urzaCard {
grid-column: 1;
grid-row: 1 / span 2 !important;
}
#askUrzaResult {
grid-column: 2 / span 3 !important;
}
}
@media screen and (min-width: 380pt) {
.urzaCard {
width: 360pt;
}
.askUrzaButton {
height: auto;
width: 100pt;
transition: 0.25s;
}
.askUrzaButton:hover {
width: 110pt;
}
.askUrzaButton:active {
width: 120pt !important;
}
}
</style>
<div class="askUrzaGrid layer margin-large">
<div class="urzaCard">
<img src="/askUrza/urzaBlank.png">
</div>
<div>
<img class="askUrzaButton" src="/askUrza/plus.png" onclick="randomAbility(0)">
</div>
<div>
<img class="askUrzaButton" src="/askUrza/minus.png" onclick="randomAbility(1)">
</div>
<div>
<img class="askUrzaButton" src="/askUrza/ultimate.png" onclick="randomAbility(2)">
</div>
<h3 id="askUrzaResult" class='readable-background'></h3>
</div>
<div class="readable-background layer margin-large">
<h5>
Ask Urza 2.0 is a replacement for AskUrza.com that periodically compiles all planeswalker abilities and sorts them into three categories for use with Urza, Academy Headmaster. This allows for much more unpredictability and, in my opinion, much more fun. To use Ask Urza, simply click on the +1, -1, or -6, and let the gods of chaos decide your fate!
</h5>
</div>
<script defer src="/askUrza/askUrza.js"></script>
<!-- Page Specific Content Ends Here -->
<footer html-include='/globalHTML/footer.html'></footer>
</body>
</html>

BIN
askurza/minus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

File diff suppressed because one or more lines are too long

BIN
askurza/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
askurza/ultimate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
askurza/urzaBlank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB