mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
Update autoframe UI
This commit is contained in:

committed by
Josh birnholz

parent
9c8dd45695
commit
60e42a0359
@@ -585,11 +585,6 @@
|
|||||||
<option value="zht">Traditional Chinese</option>
|
<option value="zht">Traditional Chinese</option>
|
||||||
<option value="ph">Phyrexian</option>
|
<option value="ph">Phyrexian</option>
|
||||||
</select>
|
</select>
|
||||||
<h5 class='padding input-description margin-bottom'>Enable automatically setting card frames</h5>
|
|
||||||
<label class='checkbox-container input margin-bottom'>Automatically set frames
|
|
||||||
<input id='enableAutoFrame' type='checkbox' onchange='enableAutoFrame();'>
|
|
||||||
<span class='checkmark'></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class='readable-background margin-bottom padding'>
|
<div class='readable-background margin-bottom padding'>
|
||||||
<h5 class='padding margin-bottom input-description'>Save your current card</h5>
|
<h5 class='padding margin-bottom input-description'>Save your current card</h5>
|
||||||
@@ -634,11 +629,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='readable-background padding'>
|
<div class='readable-background padding margin-bottom'>
|
||||||
<h5 class='padding input-description'>Auto-set frames</h5>
|
<h5 class='padding input-description'>Automatically update frame</h5>
|
||||||
<div class='padding input-grid'>
|
<div class='padding input-grid'>
|
||||||
<button class='input' onclick='autoFrame("M15");'>M15</button>
|
<select id="autoFrame" class="input" onchange="setAutoFrame()">
|
||||||
<button class='input' onclick='autoFrame("UB");'>Universes Beyond</button>
|
<option value="false">Disabled</option>
|
||||||
|
<option value="M15">Regular</option>
|
||||||
|
<option value="UB">Universes Beyond</option>
|
||||||
|
</select>
|
||||||
|
<!-- <button class='input' onclick='autoFrame("M15");'>M15</button>
|
||||||
|
<button class='input' onclick='autoFrame("UB");'>Universes Beyond</button> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='readable-background padding'>
|
<div class='readable-background padding'>
|
||||||
|
@@ -611,7 +611,10 @@ function cardFrameProperties(colors, manaCost, typeLine, power) {
|
|||||||
'frameRight': frameRight,
|
'frameRight': frameRight,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function autoFrame(frame) {
|
function autoFrame() {
|
||||||
|
var frame = document.querySelector('#autoFrame').value;
|
||||||
|
if (!frame) { return; }
|
||||||
|
|
||||||
var colors = [...new Set(card.text.mana.text.toUpperCase().split('').filter(char => ['W', 'U', 'B', 'R', 'G'].includes(char)))];
|
var colors = [...new Set(card.text.mana.text.toUpperCase().split('').filter(char => ['W', 'U', 'B', 'R', 'G'].includes(char)))];
|
||||||
|
|
||||||
if (frame == 'M15') {
|
if (frame == 'M15') {
|
||||||
@@ -631,7 +634,7 @@ async function autoUBFrame(colors, mana_cost, type_line, power) {
|
|||||||
|
|
||||||
// Set frames
|
// Set frames
|
||||||
|
|
||||||
if (type_line.includes('Legendary')) {
|
if (type_line.toLowerCase().includes('legendary')) {
|
||||||
if (properties.pinlineRulesRight) {
|
if (properties.pinlineRulesRight) {
|
||||||
frames.push(makeM15FrameByLetter(properties.pinlineRulesRight, 'Crown', true));
|
frames.push(makeM15FrameByLetter(properties.pinlineRulesRight, 'Crown', true));
|
||||||
}
|
}
|
||||||
@@ -1289,6 +1292,7 @@ async function drawText() {
|
|||||||
} else {
|
} else {
|
||||||
drawCard();
|
drawCard();
|
||||||
}
|
}
|
||||||
|
autoFrame();
|
||||||
}
|
}
|
||||||
function writeText(textObject, targetContext) {
|
function writeText(textObject, targetContext) {
|
||||||
//Most bits of info about text loaded, with defaults when needed
|
//Most bits of info about text loaded, with defaults when needed
|
||||||
@@ -1324,6 +1328,7 @@ function writeText(textObject, targetContext) {
|
|||||||
if (rawText.includes('//')) {
|
if (rawText.includes('//')) {
|
||||||
rawText = rawText.replace(/\/\//g, '{lns}');
|
rawText = rawText.replace(/\/\//g, '{lns}');
|
||||||
}
|
}
|
||||||
|
rawText = rawText.replace(/ - /g, ' — ');
|
||||||
var splitText = rawText.replace(/\n/g, '{line}').replace(/{-}/g, '\u2014').replace(/{divider}/g, '{/indent}{lns}{bar}{lns}{fixtextalign}').replace(/{flavor}/g, '{/indent}{lns}{bar}{lns}{fixtextalign}{i}').replace(/{oldflavor}/g, '{/indent}{lns}{lns}{up30}{i}').replace(/{/g, splitString + '{').replace(/}/g, '}' + splitString).replace(/ /g, splitString + ' ' + splitString).split(splitString);
|
var splitText = rawText.replace(/\n/g, '{line}').replace(/{-}/g, '\u2014').replace(/{divider}/g, '{/indent}{lns}{bar}{lns}{fixtextalign}').replace(/{flavor}/g, '{/indent}{lns}{bar}{lns}{fixtextalign}{i}').replace(/{oldflavor}/g, '{/indent}{lns}{lns}{up30}{i}').replace(/{/g, splitString + '{').replace(/}/g, '}' + splitString).replace(/ /g, splitString + ' ' + splitString).split(splitString);
|
||||||
splitText = splitText.filter(item => item);
|
splitText = splitText.filter(item => item);
|
||||||
if (textObject.vertical) {
|
if (textObject.vertical) {
|
||||||
@@ -2159,8 +2164,9 @@ function toggleStarDot() {
|
|||||||
function enableImportCollectorInfo() {
|
function enableImportCollectorInfo() {
|
||||||
localStorage.setItem('enableImportCollectorInfo', document.querySelector('#enableImportCollectorInfo').checked);
|
localStorage.setItem('enableImportCollectorInfo', document.querySelector('#enableImportCollectorInfo').checked);
|
||||||
}
|
}
|
||||||
function enableAutoFrame() {
|
function setAutoFrame() {
|
||||||
localStorage.setItem('enableAutoFrame', document.querySelector('#enableAutoFrame').checked);
|
localStorage.setItem('autoFrame', document.querySelector('#autoFrame').value);
|
||||||
|
autoFrame();
|
||||||
}
|
}
|
||||||
function removeDefaultCollector() {
|
function removeDefaultCollector() {
|
||||||
defaultCollector = {}; //{number: year, rarity:'P', setCode:'MTG', lang:'EN', starDot:false};
|
defaultCollector = {}; //{number: year, rarity:'P', setCode:'MTG', lang:'EN', starDot:false};
|
||||||
@@ -2378,9 +2384,7 @@ function changeCardIndex() {
|
|||||||
fetchSetSymbol();
|
fetchSetSymbol();
|
||||||
}
|
}
|
||||||
//autoframe
|
//autoframe
|
||||||
if (localStorage.getItem('enableAutoFrame') == 'true') {
|
autoFrame();
|
||||||
autoM15Frame(cardToImport.colors, cardToImport.mana_cost, cardToImport.type_line, cardToImport.power);
|
|
||||||
}
|
|
||||||
//font size
|
//font size
|
||||||
Object.keys(card.text).forEach(key => {
|
Object.keys(card.text).forEach(key => {
|
||||||
card.text[key].fontSize = 0;
|
card.text[key].fontSize = 0;
|
||||||
@@ -2774,10 +2778,10 @@ if (!localStorage.getItem('enableImportCollectorInfo')) {
|
|||||||
} else {
|
} else {
|
||||||
document.querySelector('#enableImportCollectorInfo').checked = (localStorage.getItem('enableImportCollectorInfo') == 'true');
|
document.querySelector('#enableImportCollectorInfo').checked = (localStorage.getItem('enableImportCollectorInfo') == 'true');
|
||||||
}
|
}
|
||||||
if (!localStorage.getItem('enableAutoFrame')) {
|
if (!localStorage.getItem('autoFrame')) {
|
||||||
localStorage.setItem('enableAutoFrame', 'false');
|
localStorage.setItem('autoFrame', 'false');
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('#enableAutoFrame').checked = (localStorage.getItem('enableAutoFrame') == 'true');
|
document.querySelector('#autoFrame').value = localStorage.getItem('autoFrame');
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock set symbol code (user defaults)
|
// lock set symbol code (user defaults)
|
||||||
|
Reference in New Issue
Block a user