Files
cardconjurer/index.html
2018-11-11 13:41:55 -08:00

616 lines
21 KiB
HTML

<!DOCTYPE html5>
<html>
<head>
<title>Card Conjurer</title>
<!-- <div class="title">Card Conjurer</div> -->
<img src="images/title.png" height="100px">
<!-- Favicon craziness! -->
<!-- <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#64ca2f"> -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<!-- <meta name="msapplication-TileColor" content="#00a300">
<meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#64ca2f"> -->
<meta charset="UTF-8">
</head>
<!-- <img src="data/background.png"></img> -->
<body>
<div class="row">
<div class="column-1"><canvas id="canvas" width="749" height="1044"></canvas></div>
<div class="column-2" id="optionsColumn">
<!--OPTIONS-->
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Card Border</div>
<div class="togglee shown">
Border
<span class="dropdown">
<select id="borderSelection" onchange="changeTemplate()">
<option value="m15/">M15</option>
<option value="map/">Map (Ixalan)</option>
<option value="plane/">Plane</option>
<option value="8th/">8th</option>
</select>
</span>
<br/>
Color
<span class="dropdown">
<select id="colorSelection" onchange="updateBorder()">
<option value="white">White</option>
</select>
</span>
<br/>
<div class="checkbox">
<input type="checkbox" id="checkboxSecondColor" onchange="updateBorder()" />
<label for="checkboxSecondColor" />
<div>Second Color</div>
</div>
<span class="dropdown">
<select id="secondColorSelection" onchange="updateBorder()"></select>
</span>
<br/>
<div class="checkbox">
<input type="checkbox" id="checkboxThirdColor" onchange="updateBorder()" />
<label for="checkboxThirdColor" />
<div>Third Color</div>
</div>
<span class="dropdown">
<select id="thirdColorSelection" onchange="updateBorder()"></select>
</span>
<br/>
<div class="checkbox">
<input type="checkbox" id="checkboxCreature" />
<label for="checkboxCreature" />
<div>Power/Toughness</div>
</div>
<input id="inputPowerToughness" class="input" value="" type="text"></input>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Border (Advanced)</div>
<div class="togglee">
<div class="checkbox">
<input type="checkbox" id="checkboxLegendary" onchange="updateBorder()" />
<label for="checkboxLegendary" />
<div>Legendary</div>
</div>
<div class="checkbox">
<input type="checkbox" id="checkboxNyx" onchange="updateBorder()" />
<label for="checkboxNyx" />
<div>Nyx</div>
</div>
<div class="checkbox">
<input type="checkbox" id="checkboxMiracle" onchange="updateBorder()" />
<label for="checkboxMiracle" />
<div>Miracle</div>
</div>
<div class="checkbox">
<input type="checkbox" id="checkboxRareStamp" onchange="updateBorder()" />
<label for="checkboxRareStamp" />
<div>Rare Stamp</div>
</div>
<div class="checkbox">
<input type="checkbox" id="checkboxFlipIcon" onchange="updateBorder()" />
<label for="checkboxFlipIcon" />
<div>Flip Icon</div>
</div>
<span class="dropdown">
<select id="inputFlipIcon" onchange="updateBorder()">
<option value="blank.png">Blank</option>
<option value="day.png">Day</option>
<option value="night.png">Night</option>
<option value="compass.png">Compass</option>
<option value="moon.png">Moon</option>
<option value="eldrazi.png">Eldrazi</option>
<option value="planeswalker.png">Planeswalker</option>
<option value="creature.png">Creature</option>
<option value="instant.png">Instant</option>
<option value="sorcery.png">Sorcery</option>
<option value="enchantment.png">Enchantment</option>
<option value="artifact.png">Artifact</option>
<option value="land.png">Land</option>
<option value="multitype.png">Multitype</option>
<option value="planeshift.png">Planeshift</option>
<option value="structure.png">Structure</option>
</select>
</span>
<div class="checkbox">
<input type="checkbox" id="checkboxFlipTip" onchange="updateBorder()" />
<label for="checkboxFlipTip" />
<div>Flip Tip</div>
</div>
<input id="inputFlipTip" value="" type="text" class="input"></input>
<div class="checkbox">
<input type="checkbox" id="checkboxFlippedDark" onchange="updateBorder()" />
<label for="checkboxFlippedDark" />
<div>Flipped (Darker)</div>
</div>
<div class="checkbox">
<input type="checkbox" id="checkboxSilverBorder" onchange="updateBorder()" />
<label for="checkboxSilverBorder" />
<div>Silver Border</div>
</div>
<input type="color" id="inputColor" onchange="updateBorder()"> Border Color</input>
<div class="checkbox">
<input type="checkbox" id="checkboxFoil" />
<label for="checkboxFoil" />
<div>Foil</div>
</div>
<div class="checkbox">
<input type="checkbox" id="checkboxIdentity" onchange="updateBorder()" />
<label for="checkboxIdentity" />
<div>Color Identity</div>
</div>
<input id="inputIdentity" type="text" class="input" onchange="updateBorder()"></input>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Name, Mana Cost, Type</div>
<div class="togglee">
Name
<input id="inputName" type="text" class="input"></input>
<br/>
Mana Cost
<input id="inputCost" type="text" class="input"></input>
<br/>
Type
<input id="inputType" type="text" class="input"></input>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Rules Text</div>
<div class="togglee">
Rules Text
<br/>
<textarea id="inputText" class="input" rows="5" cols="40" style="width: 100%; resize: none; height: 200px"></textarea>
<br/>
Rules Text Font Size
<input id="textSize" type="number" class="input" min="0" max="100" value="37" step="0.5"></input>
<br/>
Pixels Between Paragraphs
<input id="textShift" type="number" class="input" min="0" max="300" value="13"></input>
<br/>
Shift All Text Down
<input id="textDown" type="number" class="input" min="0" max="300" value="0"></input>
<br/>
Shift Mana Symbols Down
<input id="inputSymbolDown" type="number" class="input" value="0"></input>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Card Art</div>
<div class="togglee">
Image
<input type="file" class="input" accept="image/*" onchange="loadImage(event, imgArt, true)" id="inputPicture"></input>
<br/>
<input type="text" class="input" placeholder="Or use a URL" onchange="imageURL(this, imgArt)"></input>
<br/>
Image Zoom
<input id="imageSize" type="number" class="input" value="100" step="0.1"></input>
<br/>
Image Left
<input id="imageLeft" type="number" class="input" value="0" step="1"></input>
<br/>
Image Up
<input id="imageUp" type="number" class="input" value="0" step="1"></input>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Bottom Information</div>
<div class="togglee">
Other Info
<input id="inputInfo" value="Not A Real Card" type="text" class="input"></input>
<br/>
Card Number
<input id="inputNumber" value="001/001" type="text" class="input"></input>
<br/>
Rarity
<input id="inputRarity" value="C" type="text" class="input"></input>
<br/>
Set Abbreviation
<input id="inputSet" value="MTG" type="text" class="input"></input>
<br/>
Language
<input id="inputLanguage" value="EN" type="text" class="input"></input>
<br/>
Artist Credit
<input id="inputArtist" value="" type="text" class="input"></input>
<br/>
<div class="checkbox">
<input type="checkbox" id="checkboxArtistColor" />
<label for="checkboxArtistColor" />
<div>Black Bottom Info</div>
</div>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Set Symbol and Watermark</div>
<div class="togglee">
<div class="checkbox">
<input type="checkbox" id="checkboxSetSymbol" checked="true" />
<label for="checkboxSetSymbol" />
<div>Set Symbol</div>
</div>
Set Code
<input type="text" onchange="loadSetSymbol()" value="hm" id="setSymbolCode" class="input"></input>
<br>
Set Symbol Rarity
<input type="text" onchange="loadSetSymbol()" value="C" id="setSymbolRarity" class="input"></input>
<br>
Custom Set Symbol
<input type="file" class="input" accept="image/*" onchange="loadImage(event, imgSetSymbol, true)" id="inputSetSymbol"></input>
<br/>
<input type="text" class="input" placeholder="Or use a URL" onchange="imageURL(this, imgSetSymbol)"></input>
<br/>
Scale Set Symbol
<input id="setSymbolSize" type="number" class="input" value="100" step="0.5"></input>
<br/><br/>
<div class="checkbox">
<input type="checkbox" id="checkboxWatermark" checked="true" />
<label for="checkboxWatermark" />
<div>Watermark</div>
</div>
<input type="file" class="input" accept="image/*" onchange="loadImage(event, imgWatermark, true)" id="inputWatermark"></input>
<br/>
<input type="text" class="input" placeholder="Or use a URL" onchange="imageURL(this, imgWatermark)"></input>
<br/>
<input type="text" class="input" placeholder="Or use a set code" onchange="loadSetSymbolWatermark()" id="inputWatermarkSetCode"></input>
<br/>
Watermark Color
<br/>
<span class="dropdown">
<select id="watermarkColorSelection">
<!-- <option value="#f3f2ef">White</option>
<option value="#1d7097">Blue</option>
<option value="#31302e">Black</option>
<option value="#bf544c">Red</option>
<option value="#1c6449">Green</option>
<option value="#e3d591">Gold</option>
<option value="#e0e0e0">Artifact/Colorless</option> -->
<option value="#afa360">White</option>
<option value="#04527c">Blue</option>
<option value="#494949">Black</option>
<option value="#a3280d">Red</option>
<option value="#0f4f14">Green</option>
<option value="#7f5f00">Gold</option>
<option value="#616b72">Artifact/Colorless</option>
</select>
</span>
<br/>
<div class="checkbox">
<input type="checkbox" id="checkboxSecondWatermarkColor" />
<label for="checkboxSecondWatermarkColor" />
<div>Second Watermark Color</div>
</div>
<span class="dropdown">
<select id="secondWatermarkColorSelection">
<option value="#afa360">White</option>
<option value="#04527c">Blue</option>
<option value="#494949">Black</option>
<option value="#a3280d">Red</option>
<option value="#0f4f14">Green</option>
<option value="#7f5f00">Gold</option>
<option value="#616b72">Artifact/Colorless</option>
</select>
</span>
Watermark Opacity
<input type="number" id="inputWatermarkOpacity" class="input" value="0.4" max="1" min="0" step="0.01"></input>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Download/Options</div>
<div class="togglee">
Frame Rate
<input type="number" class="input" id="inputFPS" value="10" min="0" onchange="window.clearInterval(cardClockInterval); cardClockInterval = setInterval(cardClock, 1000 / document.getElementById('inputFPS').value)"></input>
<a onclick="downloadCardImage(this)" id="downloadCardImage" href="" target="_blank" download="card.png">Download</a>
</div>
</div>
<!--END-->
</div>
</div>
<div class="row">
<div class="column-4">
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Mana Symbol Codes</div>
<div class="togglee shown">
Use the following codes to get the respective symbol in the card's mana cost and rules text. In the mana cost, make sure to include spaces in between the codes, and in the rules text include '<' before each code and '>' after. These codes are caps sensative.<br/>
<div id="symbolList" style="overflow: hidden;"></div>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Other Codes</div>
<div class="togglee">
Like the mana symbols, each of the following codes must include '<' before each code and '>' after. These codes are also caps sensative.<br/>
&#8226 line &#8594 Skips to the next line<br/>
&#8226 bar &#8594 Just like line, except adds the bar that usually seperates flavor text<br/>
&#8226 lineNoSpace &#8594 Just like line, except stays closer to the previous line<br/>
&#8226 i &#8594 Text is italicized<br/>
&#8226 /i &#8594 Text returns to normal<br/>
&#8226 left &#8594 Text aligns to the left<br/>
&#8226 center &#8594 Text aligns to the center<br/>
&#8226 right &#8594 Text aligns to the right<br/>
&#8226 plane &#8594 Creates a large <img src="data/manaSymbols/56.png" style="height: 1em; background-color: var(--main-text-color);"></img> and shifts the following text to the right. This is designed for planar cards.
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Set Abbreviations</div>
<div class="togglee">
Every set in Magic: The Gathering has an associated 2-3 letter code. For example, Homelands is HM and Innistrad is ISD. This program uses the codes from <a href="http://gatherer.wizards.com" target="_blank">The Gatherer</a>, the official Magic card database. A handy list of all sets and their codes can be found on <a href="https://en.wikipedia.org/wiki/List_of_Magic:_The_Gathering_sets" target="_blank">Wikipedia</a>
</div>
</div>
<div class="section">
<div class="toggler" onclick="toggleSection(this)">Choosing Your Border</div>
<div class="togglee">
Under the 'Card Border' tab use the following guidelines:<br/>
&#8226 Border &#8594 Selects the border style, such as planar card, m15 card, etc...<br/>
&#8226 Color &#8594 Selects the card's primary color<br/>
&#8226 Second Color &#8594 Selects the card's secondary color which only affects the right half of the card. This creates the same effect as seen on hybrid cards.<br/>
&#8226 Third Color &#8594 Selects the card's tertiary color which will affect the entire card, including power and toughness. This is used to create two-colored gold cards.<br/>
Under the 'Border (Advanced)' tab the checkboxes are fairly straightforward. Try each feature out to see what it does.
</div>
</div>
<div class="section" style="overflow: hidden; border-top: hidden;">
Check out some samples! <br/>
<img id="sampleCardA" class="column-3"></img>
<img id="sampleCardB" class="column-3"></img>
<img id="sampleCardC" class="column-3"></img>
</div>
</div>
</div>
<footer class="row info" style="">For Terms of Use and Disclaimer, see <a href="https://github.com/ImKyle4815/CardConjurer" target="_blank" class="info">the Github page</a>.</footer>
</body>
<!--CSS-->
<style>
/*fonts*/
@font-face {
font-family: relaymedium;
src: url("data/fonts/relay-medium.ttf");
}
@font-face {
font-family: belerenb;
src: url("data/fonts/beleren-b.ttf");
}
@font-face {
font-family: belerenbsc;
src: url("data/fonts/beleren-bsc.ttf");
}
@font-face {
font-family: matrixbsc;
src: url("data/fonts/matrix-bsc.ttf");
}
@font-face {
font-family: matrix;
src: url("data/fonts/matrix.ttf");
}
@font-face {
font-family: matrixb;
src: url("data/fonts/matrix-b.ttf");
}
@font-face {
font-family: mplantin;
src: url("data/fonts/mplantin.ttf");
}
@font-face {
font-family: mplantini;
src: url("data/fonts/mplantin-i.ttf");
}
/*Color Palette*/
:root {
--title-text-color: rgb(100, 200, 50); /*TITLE*/
--main-text-color: rgb(150, 150, 150); /*REGULAR*/
--input-text-color: rgb(100, 200, 50); /*INPUTS*/
--dark-text-color: rgb(96, 96, 96); /*DARK*/
--section-background-color: rgba(0, 0, 0, 0.5); /*BACKGROUND*/
--section-border-color: rgba(128, 255, 128, 0.25); /*BORDER*/
--solid-border-color: rgb(39, 71, 39); /*Opaque Border*/
}
/*General style things*/
* {
text-align: center;
font-family: belerenb;
font-size: 5vw;
color: var(--main-text-color);
user-select: none;
box-sizing: border-box;
}
html {
background-color: rgb(16, 16, 16);
}
/*Applies to most elements (with rows and columns)*/
.row::after{
content: "";
display: block;
clear: both;
margin-bottom: 5px;
}
[class*="column-"] {
width: 100%;
float: left;
padding: 5px;
}
/*Style for sections, togglers, and togglees*/
.section {
border: 0.04em solid var(--section-border-color);
background-color: var(--section-background-color);
width: 100%;
}
.toggler:hover {
color: var(--title-text-color);
}
.togglee {
text-align: left;
border-width: 0.04em;
border-color: var(--section-border-color);
border-style: dashed solid solid solid;
display: none;
padding: 5px;
}
.shown {
display: block;
}
/*Specific input element styles*/
.input {
border-radius: 0.25em;
padding-left: 0.25em;
text-align: left;
border: none;
background-color: var(--section-border-color);
color: var(--input-text-color);
width: 100%;
}
input[type="color"] {
border-radius: 0.25em;
border: none;
background-color: var(--section-border-color);
padding-top: 0px;
padding-bottom: 0px;
}
/*Custom checkboxes!*/
.checkbox {
height: 1em;
margin: 5px 0px;
position: relative;
}
.checkbox label {
display: inline-block;
width: 1em;
height: 1em;
border-radius: 0.25em;
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
background: var(--section-border-color);
}
.checkbox input[type=checkbox]:checked + label {
background: var(--title-text-color);
}
.checkbox input {
opacity: 0;
}
.checkbox div {
white-space: pre;
position: relative;
top: -0.1em;
left: 1.1em;
}
/*Custom select box (dropdown)*/
.dropdown {
position: relative;
display: inline-block;
width: 100%;
}
.dropdown select {
border-radius: 0.25em;
padding-left: 0.25em;
width: inherit;
background-color: var(--section-border-color);
color: var(--title-text-color);
border: none;
-moz-appearance: none;
-webkit-appearance:none;
appearance: none;
}
.dropdown select option {
border-radius: 0.25em;
color: var(--title-text-color);
background-color: var(--solid-border-color);
}
.dropdown::after {
content: "\25BC";
font-size: 0.5em;
position: absolute;
pointer-events: none;
color: var(--title-text-color);
right: 0.65em;
top: 0.65em;
}
/*List of all mana symbols and their associated codes*/
#symbolList img {
position: relative;
top: 0.25em;
height: 1.2em;
}
#symbolList div {
float: left;
width: 5.5em;
}
/*Other*/
.title {
text-align: center;
color: var(--title-text-color);
font-family: belerenbsc;
font-size: 60px;
}
.info {
color: var(--dark-text-color);
font-family: belerenbsc;
font-size: 0.75rem;
}
/*Hyperlinks*/
a:link {
color: var(--main-text-color);
background-color: rgba(100, 200, 0, 0.1);
border-radius: 0.25em;
}
a:visited {
color: var(--main-text-color);
}
a:hover {
color: var(--title-text-color);
}
a:active {
color: var(--title-text-color);
}
.column-2 {
margin-bottom: 20px;
}
/*Adjustments For Desktop*/
@media only screen and (orientation: landscape) {
.column-3 {width: 33.33%;}
}
@media only screen and (min-width: 1130px) {
/*The card manipulator menu can be side-by-side with the regular card*/
.column-1:not(.wide) {width: auto;}
.column-2:not(.wide) {
width: calc(100% - 759px);
margin-bottom: 0px;
}
}
@media only screen and (min-width: 1455px) {
/*The card manipulator menu can be side-by-side with the wide card*/
.column-1.wide {width: auto;}
.column-2.wide {
width: calc(100% - 1084px);
margin-bottom: 0px;
}
}
@media only screen and (min-width: 801px) {
html {
background:url(data/background.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
* {
font-size: 25px;
cursor: url(images/cursor.png), auto;
}
}
</style>
<script src="data/scripts/loadScript.js"></script>
<script src="data/scripts/loadImage.js"></script>
<script src="data/scripts/loadColors.js"></script>
<script src="data/scripts/mask.js"></script>
<script src="data/scripts/autocrop.js"></script>
<script src="data/scripts/whiteToTransparent.js"></script>
<script src="data/scripts/main.js"></script>
<html>