forked from GithubMirrors/cardconjurer
		
	saving set symbols
This commit is contained in:
		| @@ -322,10 +322,22 @@ include('../globalHTML/header-1.php'); | ||||
| 								<button class='input' onclick='resetSetSymbol();'>Reset Set Symbol</button> | ||||
| 							</div> | ||||
| 						</div> | ||||
| 						<div class='readable-background padding'> | ||||
| 						<div class='readable-background padding margin-bottom'> | ||||
| 							<h5 class='padding margin-bottom input-description'>Clears the Set Symbol, making it blank</h5> | ||||
| 							<button class='input margin-bottom' onclick='uploadSetSymbol(blank.src);'>Remove Set Symbol</button> | ||||
| 						</div> | ||||
| 						<div class='readable-background padding'> | ||||
| 							<h5 class='input-description margin-bottom'>Lock the set symbol code (saves between reloads)</h5> | ||||
| 							<label class='checkbox-container input margin-bottom'>Lock set symbol code | ||||
| 								<input id='lockSetSymbolCode' type='checkbox' onchange='lockSetSymbolCode();'> | ||||
| 								<span class='checkmark'></span> | ||||
| 							</label> | ||||
| 							<h5 class='input-description margin-bottom'>Lock the set symbol URL (saves between reloads)</h5> | ||||
| 							<label class='checkbox-container input'>Lock set symbol URL | ||||
| 								<input id='lockSetSymbolURL' type='checkbox' onchange='lockSetSymbolURL();'> | ||||
| 								<span class='checkmark'></span> | ||||
| 							</label> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 					<div id='creator-menu-watermark' class='hidden'> | ||||
| 					<div class='readable-background padding margin-bottom'> | ||||
| @@ -599,6 +611,7 @@ include('../globalHTML/header-1.php'); | ||||
| 				<h4>Elry</h4> | ||||
| 				<h4>Edward E.</h4> | ||||
| 				<h4>Blake M.</h4> | ||||
| 				<h4>Avery D.</h4> | ||||
| 			</div> | ||||
| 			<h4 class='margin-bottom'>And of course, thank you to all of those who have made donations in the past.</h4> | ||||
| 			<div class='supporters margin-bottom'> | ||||
|   | ||||
| @@ -1325,12 +1325,18 @@ function uploadSetSymbol(imageSource, otherParams) { | ||||
| } | ||||
| function setSymbolEdited() { | ||||
| 	card.setSymbolSource = setSymbol.src; | ||||
| 	if (document.querySelector('#lockSetSymbolURL').checked) { | ||||
| 		localStorage.setItem('lockSetSymbolURL', card.setSymbolSource); | ||||
| 	} | ||||
| 	card.setSymbolX = document.querySelector('#setSymbol-x').value / card.width; | ||||
| 	card.setSymbolY = document.querySelector('#setSymbol-y').value / card.height; | ||||
| 	card.setSymbolZoom = document.querySelector('#setSymbol-zoom').value / 100; | ||||
| 	drawCard(); | ||||
| } | ||||
| function resetSetSymbol() { | ||||
| 	if (card.setSymbolBounds == undefined) { | ||||
| 		return; | ||||
| 	} | ||||
| 	document.querySelector('#setSymbol-x').value = Math.round(scaleX(card.setSymbolBounds.x)); | ||||
| 	document.querySelector('#setSymbol-y').value = Math.round(scaleY(card.setSymbolBounds.y)); | ||||
| 	var setSymbolZoom; | ||||
| @@ -1354,6 +1360,9 @@ function resetSetSymbol() { | ||||
| } | ||||
| function fetchSetSymbol() { | ||||
| 	var setCode = document.querySelector('#set-symbol-code').value.toLowerCase() || 'cmd'; | ||||
| 	if (document.querySelector('#lockSetSymbolCode').checked) { | ||||
| 		localStorage.setItem('lockSetSymbolCode', setCode); | ||||
| 	} | ||||
| 	var setRarity = document.querySelector('#set-symbol-rarity').value.toLowerCase() || 'c'; | ||||
| 	if (['cc', 'logan', 'joe'].includes(setCode.toLowerCase())) { | ||||
| 		uploadSetSymbol(fixUri(`/img/setSymbols/${setCode.toLowerCase()}-${setRarity}.svg`), 'resetSetSymbol'); | ||||
| @@ -1361,6 +1370,20 @@ function fetchSetSymbol() { | ||||
| 		imageURL('http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=' + setCode + '&size=large&rarity=' + setRarity, uploadSetSymbol, 'resetSetSymbol'); | ||||
| 	} | ||||
| } | ||||
| function lockSetSymbolCode() { | ||||
| 	var savedValue = ''; | ||||
| 	if (document.querySelector('#lockSetSymbolCode').checked) { | ||||
| 		savedValue = document.querySelector('#set-symbol-code').value; | ||||
| 	} | ||||
| 	localStorage.setItem('lockSetSymbolCode', savedValue); | ||||
| } | ||||
| function lockSetSymbolURL() { | ||||
| 	var savedValue = ''; | ||||
| 	if (document.querySelector('#lockSetSymbolURL').checked) { | ||||
| 		savedValue = card.setSymbolSource; | ||||
| 	} | ||||
| 	localStorage.setItem('lockSetSymbolURL', savedValue); | ||||
| } | ||||
| //WATERMARK TAB | ||||
| function uploadWatermark(imageSource, otherParams) { | ||||
| 	watermark.src = imageSource; | ||||
| @@ -1660,9 +1683,13 @@ function changeCardIndex() { | ||||
| 	document.querySelector('#art-name').value = cardToImport.name; | ||||
| 	fetchScryfallData(cardToImport.name, artFromScryfall, true); | ||||
| 	//set symbol | ||||
| 	document.querySelector('#set-symbol-code').value = cardToImport.set; | ||||
| 	if (!document.querySelector('#lockSetSymbolCode').checked) { | ||||
| 		document.querySelector('#set-symbol-code').value = cardToImport.set; | ||||
| 	} | ||||
| 	document.querySelector('#set-symbol-rarity').value = cardToImport.rarity.slice(0, 1); | ||||
| 	fetchSetSymbol(); | ||||
| 	if (!document.querySelector('#lockSetSymbolURL').checked) { | ||||
| 		fetchSetSymbol(); | ||||
| 	} | ||||
| } | ||||
| function loadAvailableCards(cardKeys = JSON.parse(localStorage.getItem('cardKeys'))) { | ||||
| 	if (!cardKeys) { | ||||
| @@ -2020,6 +2047,26 @@ if ('number' in defaultCollector) { | ||||
| 	document.querySelector('#info-number').value = date.getFullYear(); | ||||
| } | ||||
|  | ||||
| // lock set symbol code (user defaults) | ||||
| if (!localStorage.getItem('lockSetSymbolCode')) { | ||||
| 	localStorage.setItem('lockSetSymbolCode', ''); | ||||
| } | ||||
| document.querySelector('#lockSetSymbolCode').checked = '' != localStorage.getItem('lockSetSymbolCode'); | ||||
| if (document.querySelector('#lockSetSymbolCode').checked) { | ||||
| 	document.querySelector('#set-symbol-code').value = localStorage.getItem('lockSetSymbolCode'); | ||||
| 	fetchSetSymbol(); | ||||
| } | ||||
|  | ||||
| // lock set symbol url (user defaults) | ||||
| if (!localStorage.getItem('lockSetSymbolURL')) { | ||||
| 	localStorage.setItem('lockSetSymbolURL', ''); | ||||
| } | ||||
| document.querySelector('#lockSetSymbolURL').checked = '' != localStorage.getItem('lockSetSymbolURL'); | ||||
| if (document.querySelector('#lockSetSymbolURL').checked) { | ||||
| 	setSymbol.src = localStorage.getItem('lockSetSymbolURL'); | ||||
| } | ||||
|  | ||||
|  | ||||
| // Load / init whatever | ||||
| loadScript('/js/frames/groupStandard-3.js'); | ||||
| loadAvailableCards(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kyle
					Kyle