From 42ef903a6f6126d8471c84a71ca857eb97f0ff67 Mon Sep 17 00:00:00 2001
From: Kyle <41976328+ImKyle4815@users.noreply.github.com>
Date: Sat, 12 Jan 2019 20:29:12 -0800
Subject: [PATCH] nifty
---
data/main.js | 28 +++++++++++++++++++++++++++-
index.html | 7 +++----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/data/main.js b/data/main.js
index 85e84b43..625ddb19 100644
--- a/data/main.js
+++ b/data/main.js
@@ -877,6 +877,32 @@ function loadImage(event, destination, arg) {
reader.readAsDataURL(input.files[0])
}
}
+//Loads card art from Scryfall via their api!
+var savedArtistName
+function inputCardArtName(cardArtNameInput) {
+ var xhttp = new XMLHttpRequest()
+ xhttp.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ var originalResponse = this.responseText
+ var editedResponse = originalResponse.slice(originalResponse.indexOf('"art_crop":"') + 12, originalResponse.indexOf('","border_crop"'))
+ // alert(editedResponse)
+ imgArt.src = editedResponse
+ if (document.getElementById("inputArtist").value == "" || document.getElementById("inputArtist").value == savedArtistName) {
+ savedArtistName = originalResponse.slice(originalResponse.indexOf('"artist":"') + 10, originalResponse.indexOf('","border_color":'))
+ document.getElementById("inputArtist").value = savedArtistName
+ }
+ if (document.getElementById("imageSize").value == 100) {
+ document.getElementById("imageSize").value = 100.8
+ }
+ } else {
+ if (this.readyState == 4 && this.status == 404) {
+ alert("Sorry, but we can't seem to find any art for '" + cardArtNameInput + "'")
+ }
+ }
+ }
+ xhttp.open("GET", "https://api.scryfall.com/cards/named?fuzzy=" + cardArtNameInput.replace(/ /g, "+"), true)
+ xhttp.send()
+}
//============================================//
@@ -1087,4 +1113,4 @@ function checkCookies() {
}
}
-checkCookies()
+checkCookies()
\ No newline at end of file
diff --git a/index.html b/index.html
index 360104a1..b4717e61 100644
--- a/index.html
+++ b/index.html
@@ -283,6 +283,8 @@
+
+
Image Zoom
@@ -453,9 +455,6 @@