Skip to content

Commit

Permalink
Merge pull request #13200 from vince-roll20/New1eUpdates
Browse files Browse the repository at this point in the history
AD&D1e Revised
  • Loading branch information
NorWhal committed Aug 13, 2024
2 parents 1b070a2 + 51ce082 commit 7ee13a1
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions ADnD_1E_Revised/1ESheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ <h5 class="right two-columns">
<span class="left">
<span>v<span name="attr_sheet_version">
</span>
<span class="right"> • 8/7/24'</span>
<span class="right"> • 8/10/24'</span>
</h5>
<ul>
<li>Included a check when changing the character_name that tests for illegal characters. Specifically ')', ']', '}', or '|'. These may break sheet rolls/macros if included in a character's name. Underscores, dashes, and apostrophes should be fine.</li>
<li>Updated the background-image url for parchment.</li>
<li>Fixed Thief/Monk/Assassin Save vs Spell @levels 5-8. Corrected the threshold from "12" to "13".</li>
<li>Added Friend/Foe indicator at the top of the sheet. This is purely a visual indicator and does not impact the sheet.</li>
Expand Down Expand Up @@ -103,7 +104,7 @@ <h5>
<!-- NPC/Monster statblock1-4 -->
<section class="npc-box statblock1">
<input type="checkbox" name="attr_character_name_error" class="hidden toggle-input-error" value="1" checked />
<input type="text" class="height-short text-large left" name="attr_character_name" title="@{character_name} | NOTE: Including any non-alpha-numeric characters may break sheet rolls/macros. Underscores, dashes, and apostrophes should also be fine." placeholder="Character Name" style="width: calc(50vw - 3em);min-width:17.5em;" />
<input type="text" class="height-short text-large left" name="attr_character_name" title="@{character_name} | NOTE: Including non-alpha-numeric characters 'may' break sheet rolls/macros. Specifically ')', ']', '}', or '|'. Underscores, dashes, and apostrophes should be fine." placeholder="Character Name" style="width: calc(50vw - 3em);min-width:17.5em;" />
<span class="inline-label">
<label>
<span>TYPE:</span>
Expand Down Expand Up @@ -400,7 +401,7 @@ <h5>
<!--Details-->
<div class="heading-box">
<input type="checkbox" name="attr_character_name_error" class="hidden toggle-input-error" value="1" checked/>
<input type="text" class="width-fill border text-large" name="attr_character_name" title="@{character_name} | NOTE: Including any non-alpha-numeric characters may break sheet rolls/macros. Underscores, dashes, and apostrophes should also be fine." placeholder="Character Name">
<input type="text" class="width-fill border text-large" name="attr_character_name" title="@{character_name} | NOTE: Including non-alpha-numeric characters 'may' break sheet rolls/macros. Specifically ')', ']', '}', or '|'. Underscores, dashes, and apostrophes should be fine." placeholder="Character Name">
<label class="inline-label">
<span>Race:</span>
<input type="text" class="width-fill" name="attr_race" title="@{race}" placeholder="Description" />
Expand Down Expand Up @@ -5391,12 +5392,17 @@ <h4 style="grid-row: 1/3; justify-self: left;">ADVANCED Options:</h4>
};

// Character Name Validation
/*
const isAlphaNumeric = (attr) => {
// only alpha-numeric characters are allowed
return /^[a-zA-Z0-9]+$/.test(attr) ? 1 : 0;
};
*/
const isAlphaNumericWithSpaces = (attr) => {
// Check for alpha-numeric characters and spaces
if (/^[a-zA-Z0-9\s]+$/.test(attr)) {
return true;
}
// Check for specific characters that can break a macro
if (/[),|\}]/.test(attr)) {
return false;
}
return true;
};

// Number Validation
const numbersOnly = (attr) => {
Expand All @@ -5419,21 +5425,19 @@ <h4 style="grid-row: 1/3; justify-self: left;">ADVANCED Options:</h4>
};

// Validate input for illegal characters
/*
on('change:character_name', (eventInfo) => {
clog(`Change Detected:${eventInfo.sourceAttribute}`);
// clog(`Change Detected:${eventInfo.sourceAttribute}`);
getAttrs(['character_name'], (v) => {
const output = {};
const attr = v[`${eventInfo.sourceAttribute}`];
// validate input
const isText = isAlphaNumeric(attr);
clog(`Valid Input?: ${isText}`);
const isText = isAlphaNumericWithSpaces(attr);
// clog(`Valid Input?: ${isText}`);
// write to a hidden checkbox in html ie 'X_error', CSS to style
output[`${eventInfo.sourceAttribute}_error`] = isText;
setAttrs(output, {silent: true});
});
});
*/

// Validate input for +/- adjustment
on(
Expand Down

0 comments on commit 7ee13a1

Please sign in to comment.