forked from Investigamer/cardconjurer
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix local_art in Art tab and allow PNG downloads. #8
Open
Villadelfia
wants to merge
2
commits into
joshbirnholz:master
Choose a base branch
from
Villadelfia:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ async function resetCardIrregularities({canvas = [getStandardWidth(), getStandar | |
} | ||
}); | ||
if (resetOthers) { | ||
setBottomInfoStyle(); | ||
setBottomInfoStyle(); | ||
//onload | ||
card.onload = null; | ||
} | ||
|
@@ -3808,7 +3808,11 @@ async function addTextbox(textboxType) { | |
} | ||
//ART TAB | ||
function uploadArt(imageSource, otherParams) { | ||
art.src = imageSource; | ||
if (!imageSource.includes('http')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The real fix for this is to actually update |
||
art.src = '/local_art/' + imageSource; | ||
} else { | ||
art.src = imageSource; | ||
} | ||
if (otherParams && otherParams == 'autoFit') { | ||
art.onload = function() { | ||
autoFitArt(); | ||
|
@@ -4289,8 +4293,8 @@ function drawCard() { | |
} else { | ||
cardContext.drawImage(bottomInfoCanvas, 0, 0, cardCanvas.width, cardCanvas.height); | ||
} | ||
|
||
|
||
// cutout the corners | ||
cardContext.globalCompositeOperation = 'destination-out'; | ||
if (!card.noCorners && (card.marginX == 0 && card.marginY == 0)) { | ||
|
@@ -4376,34 +4380,34 @@ function scryfallCardFromText(text) { | |
} | ||
|
||
lines = lines.map(item => item.trim()).filter(item => item != ""); | ||
|
||
var name = lines.shift(); | ||
var manaCost; | ||
var manaCostStartIndex = name.indexOf("{"); | ||
if (manaCostStartIndex > 0) { | ||
manaCost = name.substring(manaCostStartIndex).trim(); | ||
name = name.substring(0, manaCostStartIndex).trim(); | ||
} | ||
|
||
var cardObject = { | ||
"name": name, | ||
"lang": "en" | ||
}; | ||
|
||
if (manaCost !== undefined) { | ||
cardObject.mana_cost = manaCost; | ||
} | ||
|
||
if (lines.count == 0) { | ||
return cardObject; | ||
} | ||
|
||
cardObject.type_line = lines.shift().trim(); | ||
|
||
if (lines.count == 0) { | ||
return cardObject; | ||
} | ||
|
||
var regex = /[0-9+\-*]+\/[0-9+*]+/ | ||
var match = lines[lines.length-1].match(regex); | ||
if (match) { | ||
|
@@ -4412,13 +4416,13 @@ function scryfallCardFromText(text) { | |
cardObject.toughness = pt[1]; | ||
lines.pop(); | ||
} | ||
|
||
if (lines.count == 0) { | ||
return cardObject; | ||
} | ||
|
||
cardObject.oracle_text = lines.join("\n"); | ||
|
||
return cardObject; | ||
} | ||
|
||
|
@@ -4441,7 +4445,7 @@ function changeCardIndex() { | |
}); | ||
rulesText = curlyQuotes(rulesText).replace(/{Q}/g, '{untap}').replace(/{\u221E}/g, "{inf}").replace(/• /g, '• {indent}'); | ||
rulesText = rulesText.replace('(If this card is your chosen companion, you may put it into your hand from outside the game for {3} any time you could cast a sorcery.)', '(If this card is your chosen companion, you may put it into your hand from outside the game for {3} as a sorcery.)') | ||
|
||
if (card.version == 'pokemon') { | ||
if (cardToImport.type_line.toLowerCase().includes('creature')) { | ||
card.text.rules.text = langFontCode + rulesText; | ||
|
@@ -4473,11 +4477,11 @@ function changeCardIndex() { | |
card.text.middleStatTitle.text = ''; | ||
card.text.rightStatTitle.text = ''; | ||
} | ||
|
||
} else { | ||
card.text.rules.text = langFontCode + rulesText; | ||
} | ||
|
||
if (cardToImport.flavor_text) { | ||
var flavorText = cardToImport.flavor_text; | ||
var flavorTextCounter = 1; | ||
|
@@ -4508,7 +4512,7 @@ function changeCardIndex() { | |
} | ||
card.text.rulesnoncreature.text += curlyQuotes(flavorText.replace('\n', '{lns}')); | ||
} | ||
|
||
} else { | ||
if (!cardToImport.oracle_text || cardToImport.oracle_text == '') { | ||
card.text.rules.text += '{i}'; | ||
|
@@ -4518,7 +4522,7 @@ function changeCardIndex() { | |
card.text.rules.text += curlyQuotes(flavorText.replace('\n', '{lns}')); | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
|
@@ -4613,7 +4617,7 @@ function changeCardIndex() { | |
document.querySelector('#info-number').value = number; | ||
} | ||
|
||
|
||
bottomInfoEdited(); | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes it functionally the same as line 699 here.