mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 13:21:41 -05:00
QR Codes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
loadFramePacks([
|
||||
{name:'Misc. Custom Frames', value:'MiscCustom'},
|
||||
{name:'Deck Covers', value:'CustomDeckCover'},
|
||||
{name:'Classicshifted', value:'Classicshifted'},
|
||||
{name:'Classicshifted Lands', value:'ClassicshiftedLands'},
|
||||
{name:'Classicshifted Planeswalkers', value:'ClassicshiftedPlaneswalker'},
|
||||
|
49
js/frames/packCustomDeckCover.js
Normal file
49
js/frames/packCustomDeckCover.js
Normal file
@@ -0,0 +1,49 @@
|
||||
//defines available frames
|
||||
availableFrames = [
|
||||
{name:'White Frame', src:'/img/frames/custom/deckCover/w.png'},
|
||||
{name:'Blue Frame', src:'/img/frames/custom/deckCover/u.png'},
|
||||
{name:'Black Frame', src:'/img/frames/custom/deckCover/b.png'},
|
||||
{name:'Red Frame', src:'/img/frames/custom/deckCover/r.png'},
|
||||
{name:'Green Frame', src:'/img/frames/custom/deckCover/g.png'},
|
||||
{name:'Multicolored Frame', src:'/img/frames/custom/deckCover/m.png'},
|
||||
{name:'Colorless Frame', src:'/img/frames/custom/deckCover/c.png'},
|
||||
{name:'White Mana Symbol', src:'/img/manaSymbols/w.svg', bounds:{x:0.1594, y:0.7529, width:0.06, height:0.0429}},
|
||||
{name:'Blue Mana Symbol', src:'/img/manaSymbols/u.svg', bounds:{x:0.23, y:0.7896, width:0.06, height:0.0429}},
|
||||
{name:'Black Mana Symbol', src:'/img/manaSymbols/b.svg', bounds:{x:0.2027, y:0.8486, width:0.06, height:0.0429}},
|
||||
{name:'Red Mana Symbol', src:'/img/manaSymbols/r.svg', bounds:{x:0.116, y:0.8486, width:0.06, height:0.0429}},
|
||||
{name:'Green Mana Symbol', src:'/img/manaSymbols/g.svg', bounds:{x:0.0887, y:0.7896, width:0.06, height:0.0429}}
|
||||
];
|
||||
//disables/enables the "Load Frame Version" button
|
||||
document.querySelector('#loadFrameVersion').disabled = false;
|
||||
//defines process for loading this version, if applicable
|
||||
document.querySelector('#loadFrameVersion').onclick = async function() {
|
||||
//resets things so that every frame doesn't have to
|
||||
await resetCardIrregularities();
|
||||
//sets card version
|
||||
card.version = 'customQRCodeDeckCover';
|
||||
card.onload = '/js/frames/versionQRCode.js';
|
||||
loadScript('/js/frames/versionQRCode.js');
|
||||
//art bounds
|
||||
card.artBounds = {x:0, y:0, width:1, height:0.7162};
|
||||
autoFitArt();
|
||||
//set symbol bounds
|
||||
card.setSymbolBounds = {x:0.5, y:0.9681, width:0.12, height:0.0410, vertical:'center', horizontal: 'center'};
|
||||
resetSetSymbol();
|
||||
//watermark bounds
|
||||
card.watermarkBounds = {x:0.5, y:0.7762, width:0.75, height:0.2305};
|
||||
resetWatermark();
|
||||
//text
|
||||
loadTextOptions({
|
||||
title: {name:'Title', text:'', x:0.0474, y:0.0234, width:0.9054, height:0.0534, oneLine:true, font:'beleren', size:0.0534, color:'white', align:'center', shadowX:0.0027, shadowY:0.002},
|
||||
notes: {name:'Description', text:'', x:0.69, y:0.7358, width:0.27, height:0.18, font:'beleren', size:0.0362, color:'white', align:'center', shadowX:0.002, shadowY:0.0015}
|
||||
});
|
||||
//bottom info
|
||||
await loadBottomInfo({
|
||||
midLeft: {text:'{elemidinfo-set}*{elemidinfo-language} {fontbelerenbsc}{fontsize' + scaleHeight(0.001) + '}{upinline' + scaleHeight(0.0005) + '}\uFFEE{elemidinfo-artist}', x:0.0647, y:0.9548, width:0.8707, height:0.0171, oneLine:true, font:'gothammedium', size:0.0171, color:'white', outlineWidth:0.003},
|
||||
bottomLeft: {text:'NOT FOR SALE', x:0.0647, y:0.9719, width:0.8707, height:0.0143, oneLine:true, font:'gothammedium', size:0.0143, color:'white', outlineWidth:0.003},
|
||||
wizards: {name:'wizards', text:'\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x:0.0647, y:0.9549, width:0.8707, height:0.0167, oneLine:true, font:'mplantin', size:0.0162, color:'white', align:'right', outlineWidth:0.003},
|
||||
bottomRight: {text:'CardConjurer.com', x:0.0647, y:0.972, width:0.8707, height:0.0143, oneLine:true, font:'mplantin', size:0.0143, color:'white', align:'right', outlineWidth:0.003}
|
||||
});
|
||||
}
|
||||
//loads available frames
|
||||
loadFramePack();
|
47
js/frames/versionQRCode.js
Normal file
47
js/frames/versionQRCode.js
Normal file
@@ -0,0 +1,47 @@
|
||||
//checks to see if it needs to run
|
||||
if (!loadedVersions.includes('/js/frames/versionQRCode.js')) {
|
||||
loadedVersions.push('/js/frames/versionQRCode.js');
|
||||
card.qrCode = {
|
||||
x:0.35,
|
||||
y:0.7224,
|
||||
size:0.2143,
|
||||
fgColor:'#fff',
|
||||
fgAlpha:1,
|
||||
bgColor:'#000',
|
||||
bgAlpha:0,
|
||||
padding:0,
|
||||
url:'https://cardconjurer.com/'
|
||||
}
|
||||
sizeCanvas('qrious');
|
||||
sizeCanvas('qrCode');
|
||||
document.querySelector('#creator-menu-tabs').innerHTML += '<h3 class="selectable readable-background" onclick="toggleCreatorTabs(event, `qrCode`)">QR Code</h3>';
|
||||
var newHTML = document.createElement('div');
|
||||
newHTML.id = 'creator-menu-qrCode';
|
||||
newHTML.classList.add('hidden');
|
||||
newHTML.innerHTML = `
|
||||
<div class='readable-background padding'>
|
||||
<h5 class='padding margin-bottom input-description'>Enter the URL of your decklist:</h5>
|
||||
<input id='qr-code-url' class='input' type='URL' oninput='updateQRCode(this.value);'>
|
||||
</div>
|
||||
`;
|
||||
document.querySelector('#creator-menu-sections').appendChild(newHTML);
|
||||
loadScript('/js/qrious.min.js');
|
||||
}
|
||||
|
||||
function updateQRCode(url = card.qrCode.url) {
|
||||
//generate qr code
|
||||
var qr = new QRious({
|
||||
background: card.qrCode.bgColor,
|
||||
backgroundAlpha: card.qrCode.bgAlpha,
|
||||
foreground: card.qrCode.fgColor,
|
||||
foregroundAlpha: card.qrCode.fgAlpha,
|
||||
padding: scaleHeight(card.qrCode.padding),
|
||||
size: scaleHeight(card.qrCode.size),
|
||||
element: qriousCanvas,
|
||||
value: url
|
||||
});
|
||||
//draw cropped qr code to correct location
|
||||
qrCodeCanvas.getContext('2d').drawImage(croppedCanvas(qriousCanvas), scaleWidth(card.qrCode.x), scaleHeight(card.qrCode.y), scaleHeight(card.qrCode.size), scaleHeight(card.qrCode.size));
|
||||
//draw the card
|
||||
drawCard();
|
||||
}
|
Reference in New Issue
Block a user