forked from GithubMirrors/cardconjurer
Support importing art for Adventure cards
This commit is contained in:
@@ -3874,14 +3874,7 @@ function stretchSVGReal(data, frameObject) {
|
|||||||
});
|
});
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
//SCRYFALL STUFF MAY BE CHANGED IN THE FUTURE
|
function processScryfallCard(card, responseCards) {
|
||||||
function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '') {
|
|
||||||
var xhttp = new XMLHttpRequest();
|
|
||||||
xhttp.onreadystatechange = function() {
|
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
|
||||||
responseCards = [];
|
|
||||||
importedCards = JSON.parse(this.responseText).data;
|
|
||||||
importedCards.forEach(card => {
|
|
||||||
if ('card_faces' in card) {
|
if ('card_faces' in card) {
|
||||||
card.card_faces.forEach(face => {
|
card.card_faces.forEach(face => {
|
||||||
face.set = card.set;
|
face.set = card.set;
|
||||||
@@ -3892,6 +3885,9 @@ function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '
|
|||||||
face.type_line = face.printed_type_line;
|
face.type_line = face.printed_type_line;
|
||||||
}
|
}
|
||||||
responseCards.push(face);
|
responseCards.push(face);
|
||||||
|
if (!face.image_uris) {
|
||||||
|
face.image_uris = card.image_uris;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (card.lang != 'en') {
|
if (card.lang != 'en') {
|
||||||
@@ -3901,6 +3897,17 @@ function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '
|
|||||||
}
|
}
|
||||||
responseCards.push(card);
|
responseCards.push(card);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//SCRYFALL STUFF MAY BE CHANGED IN THE FUTURE
|
||||||
|
function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '') {
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
responseCards = [];
|
||||||
|
importedCards = JSON.parse(this.responseText).data;
|
||||||
|
importedCards.forEach(card => {
|
||||||
|
processScryfallCard(card, responseCards);
|
||||||
});
|
});
|
||||||
callback(responseCards);
|
callback(responseCards);
|
||||||
} else if (this.readyState == 4 && this.status == 404 && !searchUniqueArt && cardName != '') {
|
} else if (this.readyState == 4 && this.status == 404 && !searchUniqueArt && cardName != '') {
|
||||||
|
Reference in New Issue
Block a user