From 8882ebf85858787c9df3fc0a61025f03b843a63d Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sat, 7 Dec 2019 19:23:18 -0800 Subject: [PATCH] fix --- data/images/imageCSV.csv | 72 +++++++++++++++++++-------------------- data/m15 - Shortcut.lnk | Bin 1497 -> 0 bytes data/scripts/main.js | 62 +++++++++++++++++++-------------- data/versions/m15.js | 16 ++++----- 4 files changed, 81 insertions(+), 69 deletions(-) delete mode 100644 data/m15 - Shortcut.lnk diff --git a/data/images/imageCSV.csv b/data/images/imageCSV.csv index 41baa3d8..08dd6ff4 100644 --- a/data/images/imageCSV.csv +++ b/data/images/imageCSV.csv @@ -1,36 +1,36 @@ -displayName,imagePath,maskOptions -White,m15WFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Blue,m15UFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Black,m15BFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Red,m15RFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Green,m15GFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Multicolored,m15MFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Artifact,m15AFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Land,m15LFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Vehicle,m15VFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -White PT,m15WPT.png,Full-567-921-140-81 -Blue PT,m15UPT.png,Full-567-921-140-81 -Black PT,m15BPT.png,Full-567-921-140-81 -Red PT,m15RPT.png,Full-567-921-140-81 -Green PT,m15GPT.png,Full-567-921-140-81 -Multicolored PT,m15MPT.png,Full-567-921-140-81 -Artifact PT,m15APT.png,Full-567-921-140-81 -Vehicle PT,m15VPT.png,Full-567-921-140-81 -White Legendary,m15WLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Blue Legendary,m15ULegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Black Legendary,m15BLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Red Legendary,m15RLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Green Legendary,m15GLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Multicolored Legendary,m15MLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Artifact Legendary,m15ALegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Colorless Legendary,m15CLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -White Rare Stamp,m15WRareStamp.png,Full-327-943-91-22 -Blue Rare Stamp,m15URareStamp.png,Full-327-943-91-22 -Black Rare Stamp,m15BRareStamp.png,Full-327-943-91-22 -Red Rare Stamp,m15RRareStamp.png,Full-327-943-91-22 -Green Rare Stamp,m15GRareStamp.png,Full-327-943-91-22 -Multicolored Rare Stamp,m15MRareStamp.png,Full-327-943-91-22 -Artifact Rare Stamp,m15ARareStamp.png,Full-327-943-91-22 -Colorless Rare Stamp,m15CRareStamp.png,Full-327-943-91-22 -Holo Stamp,stamp.png,Full-340-953-70-38 -Black Border,masks/Border.png,Full-0-0-744-1039;BoxTopper-0-0-744-1039 \ No newline at end of file +displayName,imagePath,maskOptions,framePickerOptions +White,m15WFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Blue,m15UFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Black,m15BFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Red,m15RFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Green,m15GFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Multicolored,m15MFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Artifact,m15AFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Land,m15LFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Vehicle,m15VFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +White PT,m15WPT.png,Full-567-921-140-81,Regular +Blue PT,m15UPT.png,Full-567-921-140-81,Regular +Black PT,m15BPT.png,Full-567-921-140-81,Regular +Red PT,m15RPT.png,Full-567-921-140-81,Regular +Green PT,m15GPT.png,Full-567-921-140-81,Regular +Multicolored PT,m15MPT.png,Full-567-921-140-81,Regular +Artifact PT,m15APT.png,Full-567-921-140-81,Regular +Vehicle PT,m15VPT.png,Full-567-921-140-81,Regular +White Legendary,m15WLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Blue Legendary,m15ULegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Black Legendary,m15BLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Red Legendary,m15RLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Green Legendary,m15GLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Multicolored Legendary,m15MLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Artifact Legendary,m15ALegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Colorless Legendary,m15CLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +White Rare Stamp,m15WRareStamp.png,Full-327-943-91-22,Regular +Blue Rare Stamp,m15URareStamp.png,Full-327-943-91-22,Regular +Black Rare Stamp,m15BRareStamp.png,Full-327-943-91-22,Regular +Red Rare Stamp,m15RRareStamp.png,Full-327-943-91-22,Regular +Green Rare Stamp,m15GRareStamp.png,Full-327-943-91-22,Regular +Multicolored Rare Stamp,m15MRareStamp.png,Full-327-943-91-22,Regular +Artifact Rare Stamp,m15ARareStamp.png,Full-327-943-91-22,Regular +Colorless Rare Stamp,m15CRareStamp.png,Full-327-943-91-22,Regular +Holo Stamp,stamp.png,Full-340-953-70-38,Regular +Black Border,masks/Border.png,Full-0-0-744-1039;BoxTopper-0-0-744-1039,Regular \ No newline at end of file diff --git a/data/m15 - Shortcut.lnk b/data/m15 - Shortcut.lnk deleted file mode 100644 index 05c28d0c618548d70912817625da846ae18f7075..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1497 zcmc&!TS$~a6#mwH(6Cx-Gqa1UkQkz9u~bWnwW3Q|e`Qw0JhbhurS3)c5*ZZrR8hSc zLP3T_r9l=&7YvM`hoBovVU+bCT^_n2LPalKzVrXPtCrDYvz(dPGiSc}zB6b3S^y?X z3VYzT-lO^u(qQKNzHj2BjcfZ&)*my*jQS$iO-6jOuSl^Vcg>&{v%a@CnomDVLs4mI zhaDw*+lsQDc#rO?Zf|aDvENI(RKUFj7`m0oy?ajVK0mzsiK)*1ushw?Z&I(1FI>t~ zEm)5-9XmtY*<(gcW5gNV3REB+socA26%NWu31f0U3zvy{^hlSp_$F%5hzOjBf?JWr z-oUhJMJ6*G%hpvnv^{jKh@%RktO@Fs0YNl!GlF{O!XvohLI@s?K?Kl5^bou>Ae%^u z6AF1k(C5M8IJQm8G1;_29s6a4ATAt%)n}<|yNT!{GB6dZllu2jzsD7E0rn)%y*(M) zK3)Brad|eh_7TTL_1p#vHpJ2Lv||=Cwgy8UZzzn)QFyW?bjMZU>TRyJKNu!G}ln%t#~#WZPAS|)7*?c&$6PN_{e z?5aLY1!`rh&ud*C4Ml4i;%zQ}V_;ixiyPQn`z7y?^Ht^k+N-f6?v!C` z?8+?l;9chRyC1uo7Zrc}*SdoRmrnd%VwcsesryvgH{ig*nyzoLX=lO>`5p92eIS=s zO&fbDRusa)GEu1K6&V+$uoA5-D=(~At`}=WFIJ1#NAKld~lOSDY z2FGf?WJ5wj{H}}_C%Y$0U?nZ_sgnPFG~scs$z539{y6j6Q{2{`XU9&_KUV^Thm-by z()G9c5@x^>nvlPo<*({F(&FrLR+gM8-+6cr{o5r#h}ZvI@O|bpmR7$}TH;T%U%z%d AP5=M^ diff --git a/data/scripts/main.js b/data/scripts/main.js index 94665c22..901b629f 100644 --- a/data/scripts/main.js +++ b/data/scripts/main.js @@ -12,6 +12,7 @@ function testFunction() { /* Initiate! */ window.onload = initiate; function initiate() { + window.CSVList = [] window.version = {} window.cardWidth = 744; window.cardHeight = 1039; @@ -79,33 +80,36 @@ function initiate() { /* Loads all the image info from the CSV! */ -function loadImageCSV() { - var xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (this.readyState == 4) { - var splitImageCSV = xhttp.responseText.split("\n"); - for (var i = 1; i < splitImageCSV.length; i++) { - var splitIndividualImageCSV = splitImageCSV[i].split(","); - frameList[frameList.length] = new frameImage(splitIndividualImageCSV[0], "data/images/" + splitIndividualImageCSV[1], splitIndividualImageCSV[2]); - } - for (var i = 0; i < frameList.length; i++) { - document.getElementById("framePicker").appendChild(frameList[i].framePickerElement()); - } - //I don't like these here, because even though they run, it doesn't populate the mask options - // document.getElementsByClassName("frameOption")[0].classList.add("frameOptionSelected"); - // selectedMask = document.getElementsByClassName("frameOption")[0].id.replace("frameIndex", ""); - console.log("image csv loaded, happy card conjuring!"); - setTimeout(testFunction, 0); //deleteme - } - } - xhttp.open("GET", "data/images/imageCSV.csv", true); - xhttp.send(); +function loadImageCSV(targetCSV) { + if (!CSVList.includes(targetCSV)) { + CSVList[CSVList.length] = targetCSV; + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4) { + var splitImageCSV = xhttp.responseText.split("\n"); + for (var i = 1; i < splitImageCSV.length; i++) { + var splitIndividualImageCSV = splitImageCSV[i].split(","); + frameList[frameList.length] = new frameImage(splitIndividualImageCSV[0], "data/images/" + splitIndividualImageCSV[1], splitIndividualImageCSV[2], splitIndividualImageCSV[3].toString()); + if (i == 1) { + frameList[0].image.onload = testFunction; + } + } + for (var i = 0; i < frameList.length; i++) { + document.getElementById("framePicker").appendChild(frameList[i].framePickerElement()); + } + console.log("image csv loaded, happy card conjuring!"); + // setTimeout(testFunction, 0); //deleteme + } + } + xhttp.open("GET", targetCSV, true); + xhttp.send(); + } } /* Image Class */ class frameImage { - constructor(display, path, masks) { + constructor(display, path, masks, classes) { this.displayName = display; this.image = new Image(); this.image.src = path; @@ -123,6 +127,10 @@ class frameImage { this.widthList[i] = scale(parseInt(splitIndividualMasks[3])); this.heightList[i] = scale(parseInt(splitIndividualMasks[4])); } + this.framePickerClasses =["frameOption"] + if (classes[0] == "f") { + this.framePickerClasses = ("frameOption;" + classes.slice(0,classes.length - 1)).replace(/;/g, ";frameClass").split(";"); + } } cardMasterElement(targetMask) { var tempElement = document.createElement("div"); @@ -134,7 +142,9 @@ class frameImage { framePickerElement(targetElement) { var tempElement = document.createElement("div"); tempElement.id = "frameIndex" + frameList.indexOf(this); - tempElement.classList.add("frameOption"); + for (var i = 0; i < this.framePickerClasses.length; i++) { + tempElement.classList.add(this.framePickerClasses[i]); + } tempElement.onclick = frameOptionClicked; tempElement.innerHTML = "" return tempElement; @@ -276,7 +286,7 @@ function cardImageUpdated() { function changeVersionTo(versionToChangeTo) { loadScript("data/versions/" + versionToChangeTo + ".js") } -function finishChangingVersion() { +function finishChangingVersion(targetCSV = false) { for (var i = 0; i < version.textList.length; i ++) { document.getElementById("inputWhichTextTabs").innerHTML += "
" + version.textList[i][0] + "
" if (i == 0) { @@ -284,7 +294,9 @@ function finishChangingVersion() { } } console.log("version changed, time to load the image csv") - loadImageCSV(); + if (targetCSV != false) { + loadImageCSV(targetCSV); + } } diff --git a/data/versions/m15.js b/data/versions/m15.js index 43c2bde9..ccd7fc78 100644 --- a/data/versions/m15.js +++ b/data/versions/m15.js @@ -4,10 +4,10 @@ version.currentVersion = "m15" version.artX = scale(58) version.artY = scale(118) -version.setSymbolRight = scale(688) -version.setSymbolVertical = scale(613) +version.setSymbolRight = scale(684) +version.setSymbolVertical = scale(614) version.setSymbolWidth = scale(90) -version.setSymbolHeight = scale(38) +version.setSymbolHeight = scale(40) version.bottomInfoFunction = "m15BottomInfo" version.manaCostX = scale(653) version.manaCostY = scale(60) @@ -24,8 +24,8 @@ version.watermarkY = scale(800) //Name, text, x, y, width, height, font, size, color, other version.textList = [ ["Title", "", scale(64), scale(83), scale(630), 0, "belerenb", 37, "black", "oneLine=true"], - ["Type", "", scale(65), scale(615), scale(630), 0, "belerenb", 37, "black", "oneLine=true"], - ["Rules Text", "", scale(66), scale(662), scale(612), scale(292), "mplantin", 38, "black", "lineSpace=0.97"], + ["Type", "", scale(64), scale(615), scale(630), 0, "belerenb", 33, "black", "oneLine=true"], + ["Rules Text", "", scale(64), scale(662), scale(616), scale(292), "mplantin", 38, "black", "lineSpace=0.97"], ["Power Toughness", "", scale(587), scale(958), scale(110), 0, "belerenb", 38, "black", "oneLine=true,textAlign='center'"]/*, ["Flip PT", "", scale(588), scale(902), scale(100), 0, "belerenb", 28, "#666", "oneLine=true,textAlign='right'"]*/ ] @@ -33,8 +33,8 @@ version.textList = [ function m15BottomInfo() { //remember to ctrl+f for 'artistBrushWidth' and adjust that when fixing these values! bottomInfoContext.clearRect(0, 0, cardWidth, cardHeight) - bottomInfoContext.writeText(document.getElementById("inputInfoNumber").value + " " + document.getElementById("inputInfoRarity").value + " *Not For Sale*", scale(43), scale(980), scale(329), 0, "gothammedium", 17, "white", "oneLine=true") - bottomInfoContext.writeText(document.getElementById("inputInfoSet").value + " \u2022 " + document.getElementById("inputInfoLanguage").value + " {font:belerenbsc}{artistBrush}{fontsize1}" + document.getElementById("inputInfoArtist").value, scale(43), scale(1000), scale(375), 0, "gothammedium", 17, "white", "oneLine=true") + bottomInfoContext.writeText(document.getElementById("inputInfoNumber").value + " " + document.getElementById("inputInfoRarity").value + " *Not For Sale*", scale(46), scale(980), scale(329), 0, "gothammedium", 17, "white", "oneLine=true") + bottomInfoContext.writeText(document.getElementById("inputInfoSet").value + " \u2022 " + document.getElementById("inputInfoLanguage").value + " {font:belerenbsc}{artistBrush}{fontsize1}" + document.getElementById("inputInfoArtist").value, scale(46), scale(1000), scale(375), 0, "gothammedium", 17, "white", "oneLine=true") var copyrightShift = 0; for (var i = 0; i < cardMaster.children.length; i++) { if (parseInt(cardMaster.children[i].id.replace("frameIndex", "")) != -1 && frameList[parseInt(cardMaster.children[i].id.replace("frameIndex", ""))].image.src.includes("PT")) { @@ -46,4 +46,4 @@ function m15BottomInfo() { } // setTimeout(m15BottomInfo, 250) -finishChangingVersion() +finishChangingVersion("data/images/imageCSV.csv")