auto load

This commit is contained in:
Kyle
2021-02-04 11:17:51 -08:00
parent 975531198f
commit 93a918f0f0
5 changed files with 27 additions and 9 deletions

View File

@@ -99,12 +99,18 @@ include('../globalHTML/header-1.php');
<option disabled>Other Frames</option> <option disabled>Other Frames</option>
<option value='Custom'>Custom</option> <option value='Custom'>Custom</option>
<option value='Misc-1'>Old/Misc</option> <option value='Misc-1'>Old/Misc</option>
<option value='Margin'>1/8th Inch Margin</option>
</select> </select>
<select id='selectFramePack' onchange='loadScript("/js/frames/pack" + this.value + ".js")' class='input'></select> <select id='selectFramePack' onchange='loadScript("/js/frames/pack" + this.value + ".js")' class='input'></select>
</div> </div>
<div class='input-grid'> <div class='input-grid margin-bottom'>
<button id='loadFrameVersion' class='input'>Load Frame Version</button> <button id='loadFrameVersion' class='input'>Load Frame Version</button>
</div> </div>
<h5 class='input-description margin-bottom'>Automatically load Frame Version when loading Frame Packs</h5>
<label class='checkbox-container input'>Auto load
<input id='autoLoadFrameVersion' type='checkbox' onchange='autoLoadFrameVersion();' checked>
<span class='checkmark'></span>
</label>
</div> </div>
<div class='readable-background margin-bottom padding'> <div class='readable-background margin-bottom padding'>
<h5 class='margin-bottom padding input-description'>Select a Frame Image and a Mask, then add it to your card</h5> <h5 class='margin-bottom padding input-description'>Select a Frame Image and a Mask, then add it to your card</h5>
@@ -414,5 +420,5 @@ include('../globalHTML/header-1.php');
</h4> </h4>
</div> </div>
</div> </div>
<script defer src='/js/creator-7.js'></script> <script defer src='/js/creator-8.js'></script>
<?php include('../globalHTML/footer.php'); ?> <?php include('../globalHTML/footer.php'); ?>

View File

@@ -406,7 +406,7 @@ textarea.input {
.checkbox-container { .checkbox-container {
display: block; display: block;
position: relative; position: relative;
padding-left: 2rem; padding-left: 2.25rem;
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;

View File

@@ -25,7 +25,7 @@ art.onload = artEdited;
setSymbol = new Image(); setSymbol.crossOrigin = 'anonymous'; setSymbol.src = blank.src; setSymbol = new Image(); setSymbol.crossOrigin = 'anonymous'; setSymbol.src = blank.src;
setSymbol.onerror = function() { setSymbol.onerror = function() {
if (this.src.includes('gatherer.wizards.com')) { if (this.src.includes('gatherer.wizards.com')) {
notify('<a target="_blank" href="http' + this.src.split('http')[2] + '">Loading the set symbol from Gatherer failed. Please check this link to see if it exists. If it does, it may be necessary to manually download and upload the image.</a>', 30); notify('<a target="_blank" href="http' + this.src.split('http')[2] + '">Loading the set symbol from Gatherer failed. Please check this link to see if it exists. If it does, it may be necessary to manually download and upload the image.</a>', 15);
} }
if (!this.src.includes('/img/blank.png')) {this.src = fixUri('/img/blank.png');} if (!this.src.includes('/img/blank.png')) {this.src = fixUri('/img/blank.png');}
} }
@@ -317,6 +317,12 @@ function loadFramePack(frameOptions = availableFrames) {
}) })
document.querySelector('#frame-picker').children[0].click(); document.querySelector('#frame-picker').children[0].click();
if (localStorage.getItem('autoLoadFrameVersion') == 'true') {
document.querySelector('#loadFrameVersion').click();
}
}
function autoLoadFrameVersion() {
localStorage.setItem('autoLoadFrameVersion', document.querySelector('#autoLoadFrameVersion').checked);
} }
function frameOptionClicked(event) { function frameOptionClicked(event) {
var clickedFrameOption = event.target.closest('.frame-option'); var clickedFrameOption = event.target.closest('.frame-option');
@@ -1084,7 +1090,7 @@ function drawCard() {
//DOWNLOADING //DOWNLOADING
async function downloadCard() { async function downloadCard() {
if (card.infoArtist.replace(/ /g, '') == '' && !card.artSource.includes('/img/blank.png') && !card.artZoom == 0) { if (card.infoArtist.replace(/ /g, '') == '' && !card.artSource.includes('/img/blank.png') && !card.artZoom == 0) {
notify('You must credit an artist before downloading!', 10); notify('You must credit an artist before downloading!', 5);
} else { } else {
var download = document.createElement('a'); var download = document.createElement('a');
var imageName = card.text.title.text; var imageName = card.text.title.text;
@@ -1294,7 +1300,7 @@ async function loadCard(selectedCardKey) {
watermarkEdited(); watermarkEdited();
} }
} else { } else {
notify(selectedCardKey + ' failed to load.', 10) notify(selectedCardKey + ' failed to load.', 5)
} }
} }
function deleteCard() { function deleteCard() {
@@ -1379,13 +1385,17 @@ function fetchScryfallData(cardName, callback = console.log) {
callback(JSON.parse(this.responseText)); callback(JSON.parse(this.responseText));
// JSON.parse(this.responseText); // JSON.parse(this.responseText);
} else if (this.readyState == 4 && this.status == 404) { } else if (this.readyState == 4 && this.status == 404) {
notify('No cards found for "' + cardName + '"', 10); notify('No cards found for "' + cardName + '"', 5);
} }
} }
xhttp.open('GET', 'https://api.scryfall.com/cards/search?order=released&unique=art&q=name%3D' + cardName.replace(/ /g, '_'), true); xhttp.open('GET', 'https://api.scryfall.com/cards/search?order=released&unique=art&q=name%3D' + cardName.replace(/ /g, '_'), true);
xhttp.send(); xhttp.send();
} }
//Initialization //Initialization
if (!localStorage.getItem('autoLoadFrameVersion')) {
localStorage.setItem('autoLoadFrameVersion', document.querySelector('#autoLoadFrameVersion').checked);
}
document.querySelector('#autoLoadFrameVersion').checked = 'true' == localStorage.getItem('autoLoadFrameVersion');
document.querySelector('#info-number').value = date.getFullYear(); document.querySelector('#info-number').value = date.getFullYear();
loadScript('/js/frames/groupStandard-2.js'); loadScript('/js/frames/groupStandard-2.js');
loadAvailableCards(); loadAvailableCards();

3
js/frames/groupMargin.js Normal file
View File

@@ -0,0 +1,3 @@
loadFramePacks([
{name:'1/8 Inch Margin', value:'Margin-1'}
])

View File

@@ -3,6 +3,5 @@ loadFramePacks([
{name:'Seventh Edition', value:'Seventh'}, {name:'Seventh Edition', value:'Seventh'},
{name:'Legends Multicolored', value:'Legends'}, {name:'Legends Multicolored', value:'Legends'},
{name:'Misc', value:'disabled'}, {name:'Misc', value:'disabled'},
{name:'Planechase', value:'Planechase'}, {name:'Planechase', value:'Planechase'}
{name:'1/8 Inch Margin', value:'Margin-1'}
]) ])