mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
ask scryfall
This commit is contained in:
115
askScryfall.html
Normal file
115
askScryfall.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html5>
|
||||
<html>
|
||||
<head>
|
||||
<title>CC — Ask Scryfall</title>
|
||||
<!-- Other things -->
|
||||
<link rel="stylesheet" href="data/site/styles.css">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
.askScryfallGrid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-rows: auto 90pt auto;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
}
|
||||
.urzaCard {
|
||||
text-align: center;
|
||||
grid-column: 1 / span 3;
|
||||
}
|
||||
.urzaCard > img {
|
||||
width: 360pt;
|
||||
height: auto;
|
||||
}
|
||||
.askScryfallGrid > * {
|
||||
/*border: 1px solid red;*/
|
||||
}
|
||||
.askScryfallButton {
|
||||
width: auto;
|
||||
height: 60pt;
|
||||
transition: 0.25s;
|
||||
}
|
||||
.askScryfallButton:hover {
|
||||
height: 80pt;
|
||||
}
|
||||
.askScryfallButton:active {
|
||||
height: 90pt !important;
|
||||
}
|
||||
#askScryfallResult {
|
||||
grid-column: 1 / span 3;
|
||||
padding: 12pt;
|
||||
font: 32pt belerenb;
|
||||
}
|
||||
@media screen and (min-width: 864pt) {
|
||||
.askScryfallGrid {
|
||||
grid-template-columns: calc(360pt + 1rem) 1fr 1fr 1fr !important;
|
||||
grid-template-rows: 90pt auto !important;
|
||||
}
|
||||
.urzaCard {
|
||||
grid-column: 1;
|
||||
grid-row: 1 / span 2 !important;
|
||||
}
|
||||
#askScryfallResult {
|
||||
grid-column: 2 / span 3 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mainDiv">
|
||||
<div class="layer">
|
||||
<div class="title">
|
||||
Ask Scryfall
|
||||
</div>
|
||||
</div>
|
||||
<div class="layer">
|
||||
<div class="paragraph">
|
||||
<div class="askScryfallGrid">
|
||||
<div class="urzaCard">
|
||||
<img src="data/site/other/askScryfall/urzaBlank.png">
|
||||
</div>
|
||||
<div>
|
||||
<img class="askScryfallButton" src="data/site/other/askScryfall/plus.png" onclick="randomAbility(0)">
|
||||
</div>
|
||||
<div>
|
||||
<img class="askScryfallButton" src="data/site/other/askScryfall/minus.png" onclick="randomAbility(1)">
|
||||
</div>
|
||||
<div>
|
||||
<img class="askScryfallButton" src="data/site/other/askScryfall/ultimate.png" onclick="randomAbility(2)">
|
||||
</div>
|
||||
<div id="askScryfallResult">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layer">
|
||||
<div class="paragraph indent">
|
||||
Ask Scryfall is a replacement for AskUrza.com that periodically compiles all planeswalker abilities (using Scryfall) 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 Scryfall, simply click on one of the +1, -1, or -6, and let the gods of chaos decide your fate!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<div class="footerGrid">
|
||||
<div>
|
||||
<div class="visitorCountTrigger">Card Conjurer By Kyle Burton</div>
|
||||
<div class="visitorCount"></div>
|
||||
</div>
|
||||
<div>
|
||||
Navigation:<br>
|
||||
<a href="index.html">Card Creator</a><br>
|
||||
<a href="life.html">Life Counter</a><br>
|
||||
<a href="askScryfall.html">Ask Scryfall</a>
|
||||
</div>
|
||||
<div>
|
||||
Legal:<br>
|
||||
<a href="disclaimer.html">Disclaimer</a><br>
|
||||
<a href="termsOfUse.html">Terms of Use</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="data/scripts/colors.js"></script>
|
||||
<script src="data/site/other/askScryfall/askScryfall.js"></script>
|
||||
<html>
|
22
data/site/other/askScryfall/askScryfall.js
Normal file
22
data/site/other/askScryfall/askScryfall.js
Normal 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()
|
@@ -0,0 +1,78 @@
|
||||
<!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") && n == planeswalkerAbilityList.length - 1 && n > 1) {
|
||||
//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)
|
||||
window.open(encodedUri)
|
||||
}
|
||||
} 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>
|
||||
|
||||
|
BIN
data/site/other/askScryfall/minus.png
Normal file
BIN
data/site/other/askScryfall/minus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
1
data/site/other/askScryfall/planeswalkerAbilities.txt
Normal file
1
data/site/other/askScryfall/planeswalkerAbilities.txt
Normal file
File diff suppressed because one or more lines are too long
BIN
data/site/other/askScryfall/plus.png
Normal file
BIN
data/site/other/askScryfall/plus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
BIN
data/site/other/askScryfall/ultimate.png
Normal file
BIN
data/site/other/askScryfall/ultimate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
data/site/other/askScryfall/urzaBlank.png
Normal file
BIN
data/site/other/askScryfall/urzaBlank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 653 KiB |
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html5>
|
||||
<html>
|
||||
<head>
|
||||
<title>CC — Terms of Use</title>
|
||||
<title>CC — Disclaimer</title>
|
||||
<!-- Other things -->
|
||||
<link rel="stylesheet" href="data/site/styles.css">
|
||||
<meta charset="UTF-8">
|
||||
@@ -49,7 +49,8 @@
|
||||
<div>
|
||||
Navigation:<br>
|
||||
<a href="index.html">Card Creator</a><br>
|
||||
<a href="life.html">Life Counter</a>
|
||||
<a href="life.html">Life Counter</a><br>
|
||||
<a href="askScryfall.html">Ask Scryfall</a>
|
||||
</div>
|
||||
<div>
|
||||
Legal:<br>
|
||||
|
@@ -226,7 +226,8 @@
|
||||
<div>
|
||||
Navigation:<br>
|
||||
<a href="index.html">Card Creator</a><br>
|
||||
<a href="life.html">Life Counter</a>
|
||||
<a href="life.html">Life Counter</a><br>
|
||||
<a href="askScryfall.html">Ask Scryfall</a>
|
||||
</div>
|
||||
<div>
|
||||
Legal:<br>
|
||||
|
@@ -40,7 +40,8 @@
|
||||
<div>
|
||||
Navigation:<br>
|
||||
<a href="index.html">Card Creator</a><br>
|
||||
<a href="life.html">Life Counter</a>
|
||||
<a href="life.html">Life Counter</a><br>
|
||||
<a href="askScryfall.html">Ask Scryfall</a>
|
||||
</div>
|
||||
<div>
|
||||
Legal:<br>
|
||||
|
Reference in New Issue
Block a user