Add ability to easily hide reminder text

This commit is contained in:
Josh birnholz
2023-07-23 16:10:38 -04:00
parent 01fc5b767d
commit d27352af94
2 changed files with 19 additions and 0 deletions

View File

@@ -276,6 +276,12 @@
</div>
</div>
</div>
<div class='readable-background padding margin-bottom'>
<label class='checkbox-container input'>Hide reminder text
<input id='hide-reminder-text' type='checkbox' onchange='textEdited();'>
<span class='checkmark'></span>
</label>
</div>
<div class='readable-background padding'>
<h5 class='padding input-description'>Add a textbox to your card</h5>
<div class='padding input-grid'>

View File

@@ -2687,6 +2687,19 @@ function writeText(textObject, targetContext) {
//Preps the text string
var splitString = '6GJt7eL8';
var rawText = textObject.text
if (document.querySelector('#hide-reminder-text').checked && textObject.name && textObject.name != 'Title' && textObject.name != 'Type' && textObject.name != 'Mana Cost' && textObject.name != 'Power/Toughness') {
var rulesText = rawText;
var flavorText = '';
var flavorIndex = rawText.indexOf('{flavor}') || rawText.indexOf('///');
if (flavorIndex >= 0) {
flavorText = rawText.substring(flavorIndex);
rulesText = rawText.substring(0, flavorIndex);
}
rulesText = rulesText.replace(/\([^\)]+\)/, '');
rawText = rulesText + flavorText;
}
if (textAllCaps) {
rawText = rawText.toUpperCase();
}