forked from GithubMirrors/cardconjurer
Update main.js
This commit is contained in:
@@ -507,7 +507,7 @@ CanvasRenderingContext2D.prototype.writeText = function(text = "", textX = 0, te
|
|||||||
var currentLineX = textCanvasesPadding
|
var currentLineX = textCanvasesPadding
|
||||||
var currentLineY = textY + (textSize * 0.45) //+ textCanvasesPadding
|
var currentLineY = textY + (textSize * 0.45) //+ textCanvasesPadding
|
||||||
var uniqueSplitter = "9dn57gwbt4sh"
|
var uniqueSplitter = "9dn57gwbt4sh"
|
||||||
var splitString = text.replace(/ /g, uniqueSplitter + " " + uniqueSplitter).replace(/{/g, uniqueSplitter + "{").replace(/}/g, "}" + uniqueSplitter).split(uniqueSplitter)
|
var splitString = text.replace(/\n/g, "{line}").replace(/ /g, uniqueSplitter + " " + uniqueSplitter).replace(/{/g, uniqueSplitter + "{").replace(/}/g, "}" + uniqueSplitter).split(uniqueSplitter)
|
||||||
splitString[splitString.length] = " "
|
splitString[splitString.length] = " "
|
||||||
var lastWordAdded = ""
|
var lastWordAdded = ""
|
||||||
for (var i = 0; i < splitString.length; i++) {
|
for (var i = 0; i < splitString.length; i++) {
|
||||||
@@ -574,7 +574,7 @@ CanvasRenderingContext2D.prototype.writeText = function(text = "", textX = 0, te
|
|||||||
} else {
|
} else {
|
||||||
wordToWrite = splitString[i]
|
wordToWrite = splitString[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wordToWrite != "" || finishLine == true) {
|
if (wordToWrite != "" || finishLine == true) {
|
||||||
//We're left with a word. Write it.
|
//We're left with a word. Write it.
|
||||||
var currentWordWidth = lineContext.measureText(wordToWrite).width
|
var currentWordWidth = lineContext.measureText(wordToWrite).width
|
||||||
@@ -948,8 +948,8 @@ function toggleFrameOptionVisibility() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//inputCardNameNumberTextImport
|
||||||
|
var savedImportResponse = ""
|
||||||
function inputCardNameTextImport(cardName) {
|
function inputCardNameTextImport(cardName) {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
@@ -970,7 +970,7 @@ function inputCardNameNumberTextImport(index) {
|
|||||||
var importCardTextResponse = savedImportResponse[index]//.split('{"object":"related_card"')[0]
|
var importCardTextResponse = savedImportResponse[index]//.split('{"object":"related_card"')[0]
|
||||||
importText(beforeAfter(importCardTextResponse, '"name":"', '",'), "Title");
|
importText(beforeAfter(importCardTextResponse, '"name":"', '",'), "Title");
|
||||||
importText(beforeAfter(importCardTextResponse, '"type_line":"', '",'), "Type");
|
importText(beforeAfter(importCardTextResponse, '"type_line":"', '",'), "Type");
|
||||||
importText(beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/\\n/g, "{line}").replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D'), "Rules Text");
|
importText(beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/\\n/g, "\n").replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D'), "Rules Text");
|
||||||
if (importCardTextResponse.includes('"power":"')) {
|
if (importCardTextResponse.includes('"power":"')) {
|
||||||
importText(beforeAfter(importCardTextResponse, '"power":"', '",') + "/" + beforeAfter(importCardTextResponse, '"toughness":"', '",'), "Power Toughness");
|
importText(beforeAfter(importCardTextResponse, '"power":"', '",') + "/" + beforeAfter(importCardTextResponse, '"toughness":"', '",'), "Power Toughness");
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user