Permalink
Browse files

scryfall images fixed

  • Loading branch information...
Manuel-777 committed Sep 29, 2018
1 parent f432203 commit 97d00d2c4a8bb78402fe69609d4ac47d36f8bd20
Showing with 21 additions and 49 deletions.
  1. +3 −18 shared/util.js
  2. +1 −1 window_background/background.js
  3. +17 −30 window_main/renderer.js
@@ -27,19 +27,6 @@ function addCardTile(grpId, indent, quantity, element) {
glow.on('mouseenter', function(e) {
var domid = $(this).attr('id');
$('#'+domid).css('margin-top', '0px');
/*
$('.main_hover').css("opacity", 1);
$('.loader').css("opacity", 1);
let dfc = '';
if (cardsDb.get(grpId).dfc == 'DFC_Back') dfc = 'a';
if (cardsDb.get(grpId).dfc == 'DFC_Front') dfc = 'b';
if (cardsDb.get(grpId).dfc == 'SplitHalf') dfc = 'a';
$('.main_hover').attr("src", "https://img.scryfall.com/cards/normal/en/"+get_set_scryfall(cardsDb.get(grpId).set)+"/"+cardsDb.get(grpId).cid+dfc+".jpg");
$('.main_hover').on('load', function(){
$('.loader').css("opacity", 0);
});
*/
});
glow.on('click', function(e) {
@@ -147,10 +134,8 @@ function addCardHover(div, _card) {
$('.main_hover_dfc').css("opacity", 1);
$('.loader_dfc').css("opacity", 1);
var dfcCard = cardsDb.get(_card.dfcId);
dfcf = '';
if (dfcCard.dfc == 'DFC_Back') dfcf = 'a';
if (dfcCard.dfc == 'DFC_Front') dfcf = 'b';
$('.main_hover_dfc').attr("src", "https://img.scryfall.com/cards/normal/en/"+get_set_scryfall(dfcCard.set)+"/"+dfcCard.cid+dfcf+".jpg");
$('.main_hover_dfc').attr("src", "https://img.scryfall.com/cards"+dfcCard.images[cardQuality]);
$('.main_hover_dfc').on('load', function(){
$('.loader_dfc').css("opacity", 0);
});
@@ -160,7 +145,7 @@ function addCardHover(div, _card) {
$('.loader_dfc').hide();
}
$('.main_hover').attr("src", "https://img.scryfall.com/cards/normal/en/"+get_set_scryfall(_card.set)+"/"+_card.cid+dfc+".jpg");
$('.main_hover').attr("src", "https://img.scryfall.com/cards"+_card.images[cardQuality]);
$('.main_hover').on('load', function(){
$('.loader').css("opacity", 0);
@@ -51,7 +51,7 @@ const cardsDb = new Database();
const serverAddress = 'mtgatool.com';
const debugLog = false;
const debugNet = true;
const debugNet = false;
const debugLogSpeed = 0.1;
var timeStart = 0;
var timeEnd = 0;
@@ -559,7 +559,8 @@ function setHistory(loadMore) {
var tile = document.createElement("div");
tile.classList.add(match.id+"t");
tile.classList.add("deck_tile");
tile.style.backgroundImage = "url(https://img.scryfall.com/cards/art_crop/en/"+get_set_scryfall(cardsDb.get(tileGrpid).set)+"/"+cardsDb.get(tileGrpid).cid+".jpg)";
tile.style.backgroundImage = "url(https://img.scryfall.com/cards"+cardsDb.get(tileGrpid).images["art_crop"]+")";
fltl.appendChild(tile);
var d = document.createElement("div");
@@ -621,7 +622,8 @@ function setHistory(loadMore) {
var tile = document.createElement("div");
tile.classList.add(match.id+"t");
tile.classList.add("deck_tile");
tile.style.backgroundImage = "url(https://img.scryfall.com/cards/art_crop/en/"+get_set_scryfall(cardsDb.get(tileGrpid).set)+"/"+cardsDb.get(tileGrpid).cid+".jpg)";
tile.style.backgroundImage = "url(https://img.scryfall.com/cards"+cardsDb.get(tileGrpid).images["art_crop"]+")";
fltl.appendChild(tile);
var d = document.createElement("div");
@@ -768,11 +770,7 @@ function setDecks(arg) {
tile.classList.add(deck.id+'t');
tile.classList.add('deck_tile');
let dfc = '';
if (cardsDb.get(tileGrpid).dfc == 'DFC_Back') dfc = 'a';
if (cardsDb.get(tileGrpid).dfc == 'DFC_Front') dfc = 'b';
if (cardsDb.get(tileGrpid).dfc == 'SplitHalf') dfc = 'a';
tile.style.backgroundImage = "url(https://img.scryfall.com/cards/art_crop/en/"+get_set_scryfall(cardsDb.get(tileGrpid).set)+"/"+cardsDb.get(tileGrpid).cid+dfc+".jpg)";
tile.style.backgroundImage = "url(https://img.scryfall.com/cards"+cardsDb.get(tileGrpid).images["art_crop"]+")";
var div = document.createElement("div");
div.classList.add(deck.id);
@@ -1009,11 +1007,7 @@ function setExplore(arg, loadMore) {
tile.classList.add(index+"t");
tile.classList.add("deck_tile");
let dfc = '';
if (cardsDb.get(tileGrpid).dfc == 'DFC_Back') dfc = 'a';
if (cardsDb.get(tileGrpid).dfc == 'DFC_Front') dfc = 'b';
if (cardsDb.get(tileGrpid).dfc == 'SplitHalf') dfc = 'a';
tile.style.backgroundImage = "url(https://img.scryfall.com/cards/art_crop/en/"+get_set_scryfall(cardsDb.get(tileGrpid).set)+"/"+cardsDb.get(tileGrpid).cid+dfc+".jpg)";
tile.style.backgroundImage = "url(https://img.scryfall.com/cards"+cardsDb.get(tileGrpid).images["art_crop"]+")";
var div = document.createElement("div");
div.classList.add(index);
@@ -1131,14 +1125,8 @@ function open_deck(i, type) {
});
top.append(flr);
var tileGrpid = _deck.deckTileId;
let dfc = '';
if (cardsDb.get(tileGrpid).dfc == 'DFC_Back') dfc = 'a';
if (cardsDb.get(tileGrpid).dfc == 'DFC_Front') dfc = 'b';
if (cardsDb.get(tileGrpid).dfc == 'SplitHalf') dfc = 'a';
change_background("https://img.scryfall.com/cards/art_crop/en/"+get_set_scryfall(cardsDb.get(tileGrpid).set)+"/"+cardsDb.get(tileGrpid).cid+dfc+".jpg");
change_background("https://img.scryfall.com/cards"+cardsDb.get(tileGrpid).images["art_crop"]);
var fld = $('<div class="flex_item"></div>');
var dl = $('<div class="decklist"></div>');
@@ -1416,7 +1404,8 @@ function drawDeckVisual(_div, _stats, deck) {
let d = $('<div style="width: '+sz+'px !important;" class="deck_visual_card"></div>');
let img = $('<img style="width: '+sz+'px !important;" class="deck_visual_card_img"></img>');
img.attr("src", "https://img.scryfall.com/cards/"+cardQuality+"/en/"+get_set_scryfall(card.set)+"/"+card.cid+dfc+".jpg");
img.attr("src", "https://img.scryfall.com/cards"+card.images[cardQuality]);
img.appendTo(d);
d.appendTo(tileNow);
@@ -1458,7 +1447,8 @@ function drawDeckVisual(_div, _stats, deck) {
var d = $('<div style="margin-left: 60px; width: '+sz+'px !important;" class="deck_visual_card_side"></div>');
}
let img = $('<img style="width: '+sz+'px !important;" class="deck_visual_card_img"></img>');
img.attr("src", "https://img.scryfall.com/cards/"+cardQuality+"/en/"+get_set_scryfall(card.set)+"/"+card.cid+dfc+".jpg");
img.attr("src", "https://img.scryfall.com/cards"+card.images[cardQuality]);
//img.attr("src", "https://img.scryfall.com/cards/"+cardQuality+"/en/"+get_set_scryfall(card.set)+"/"+card.cid+dfc+".jpg");
img.appendTo(d);
d.appendTo(tileNow);
@@ -1663,7 +1653,8 @@ function open_draft(id, tileGrpid, set) {
var top = $('<div class="decklist_top"><div class="button back"></div><div class="deck_name">'+set+' Draft</div></div>');
flr = $('<div class="flex_item" style="align-self: center;"></div>');
top.append(flr);
change_background("https://img.scryfall.com/cards/art_crop/en/"+get_set_scryfall(cardsDb.get(tileGrpid).set)+"/"+cardsDb.get(tileGrpid).cid+".jpg");
change_background("https://img.scryfall.com/cards"+cardsDb.get(grpId).images["art_crop"]);
var cont = $('<div class="flex_item" style="flex-direction: column;"></div>');
cont.append('<div class="draft_nav_container"><div class="draft_nav_prev"></div><div class="draft_nav_next"></div></div>');
@@ -1681,21 +1672,16 @@ function open_draft(id, tileGrpid, set) {
pack.forEach(function(grpId) {
let dfc = '';
if (cardsDb.get(grpId).dfc == 'DFC_Back') dfc = 'a';
if (cardsDb.get(grpId).dfc == 'DFC_Front') dfc = 'b';
if (cardsDb.get(grpId).dfc == 'SplitHalf') dfc = 'a';
var d = $('<div style="width: '+cardSize+'px !important;" class="draft_card"></div>');
var img = $('<img style="width: '+cardSize+'px !important;" class="draft_card_img"></img>');
if (grpId == pick && draftPosition % 2 == 0) {
img.addClass('draft_card_picked');
}
var card = cardsDb.get(grpId);
img.attr("src", "https://img.scryfall.com/cards/"+cardQuality+"/en/"+get_set_scryfall(card.set)+"/"+card.cid+dfc+".jpg");
img.appendTo(d);
img.attr("src", "https://img.scryfall.com/cards"+card.images[cardQuality]);
img.appendTo(d);
addCardHover(img, card);
d.appendTo(pd);
});
@@ -2624,7 +2610,7 @@ function printCards() {
}
var img = $('<img style="width: '+cardSize+'px !important;" class="inventory_card_img"></img>');
img.attr("src", "https://img.scryfall.com/cards/"+cardQuality+"/en/"+get_set_scryfall(card.set)+"/"+card.cid+dfc+".jpg");
img.attr("src", "https://img.scryfall.com/cards"+card.images[cardQuality]);
img.appendTo(d);
addCardHover(img, card);
@@ -2780,6 +2766,7 @@ function open_settings(openSection) {
var d = $('<div style="width: '+cardSize+'px; !important" class="inventory_card_settings"></div>');
var img = $('<img style="width: '+cardSize+'px; !important" class="inventory_card_settings_img"></img>');
img.attr("src", "https://img.scryfall.com/cards/"+cardQuality+"/en/m19/"+Math.round(Math.random()*314)+".jpg");
img.appendTo(d);

1 comment on commit 97d00d2

@Manuel-777

This comment has been minimized.

Owner

Manuel-777 commented on 97d00d2 Sep 29, 2018

fixes #49

Please sign in to comment.