Skip to content

Commit

Permalink
yarn grunt build
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Data-is-a-lie committed May 19, 2024
1 parent d7b1fcd commit dbc5aa3
Show file tree
Hide file tree
Showing 10 changed files with 484 additions and 261 deletions.
146 changes: 65 additions & 81 deletions build/index.html

Large diffs are not rendered by default.

483 changes: 343 additions & 140 deletions build/js/awesomeSheet.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/js/awesomeSheet.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 26,7 @@ function clickClearAllAbilitiesButton() {
}

// Select the clearExistingDataButton element
const clearExistingDataButton_to_click = document.getElementById("clearExistingDataButton");
var clearExistingDataButton_to_click = document.getElementById("clearExistingDataButton");

// Add an event listener to the clearExistingDataButton button
clearExistingDataButton_to_click.addEventListener('click', function() {
Expand Down
9 changes: 8 additions & 1 deletion build/js/display_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 206,11 @@ function display_character_description(characterDescriptionElement, characterDat
characterDescriptionElement.focus();
}
// Export the function
export { displayFeatsInfo, displayTraitsInfo, displayArchetypeInfo, displaybodyslotsInfo, display_abilties, display_character_description };
// export { displayFeatsInfo, displayTraitsInfo, displayArchetypeInfo, displaybodyslotsInfo, display_abilties, display_character_description };

window.displayFeatsInfo = displayFeatsInfo
window.displayTraitsInfo = displayTraitsInfo
window.displayArchetypeInfo = displayArchetypeInfo
window.displaybodyslotsInfo = displaybodyslotsInfo
window.display_abilties = display_abilties
window.display_character_description = display_character_description
4 changes: 3 additions & 1 deletion build/js/mostRecentTabValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 194,7 @@ function clickMostRecentTab(characterData, updateMostRecentTabValue) {
}
}

export { clickMostRecentTab };
// export { clickMostRecentTab };

window.clickMostRecentTab = clickMostRecentTab

6 changes: 5 additions & 1 deletion build/js/skill_ranks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 19,10 @@ function skill_ranks_func (skillRanksObject, includeCustomCheckbox) {
// Update the value/text content as before
if (element.tagName.toLowerCase() === 'input') {
element.value = skillRank;
console.log("element.value", element.value)
} else {
element.textContent = skillRank;
console.log("element.textContent", element.textContent)
}

}
Expand All @@ -36,4 38,6 @@ function skill_ranks_func (skillRanksObject, includeCustomCheckbox) {



export { skill_ranks_func }
// export { skill_ranks_func }

window.skill_ranks_func = skill_ranks_func
82 changes: 51 additions & 31 deletions build/js/updateCharacterDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 48,31 @@ document.addEventListener('DOMContentLoaded', function () {

(async () => {
try {
const featsInfoModule = await import('./display_functions.js');
const displayFeatsInfo = featsInfoModule.displayFeatsInfo;
const displayTraitsInfo = featsInfoModule.displayTraitsInfo;
const displayArchetypeInfo = featsInfoModule.displayArchetypeInfo;
const displaybodyslotsInfo = featsInfoModule.displaybodyslotsInfo;
const display_abilties = featsInfoModule.display_abilties;
const display_character_description = featsInfoModule.display_character_description;
// const featsInfoModule = await import('./display_functions.js');
// const displayFeatsInfo = featsInfoModule.displayFeatsInfo;
// const displayTraitsInfo = featsInfoModule.displayTraitsInfo;
// const displayArchetypeInfo = featsInfoModule.displayArchetypeInfo;
// const displaybodyslotsInfo = featsInfoModule.displaybodyslotsInfo;
// const display_abilties = featsInfoModule.display_abilties;
// const display_character_description = featsInfoModule.display_character_description;

window.displayFeatsInfo = displayFeatsInfo;
window.displayTraitsInfo = displayTraitsInfo;
window.displayArchetypeInfo = displayArchetypeInfo;
window.displaybodyslotsInfo = displaybodyslotsInfo;
window.display_abilties = display_abilties;
window.display_character_description = display_character_description;

const featsDescriptionElement = document.getElementById('statistics-feats-notes');
const traitsDescriptionElement = document.getElementById('statistics-traits-notes');
const archetypeDescriptionElement = document.getElementById('statistics-archetypes-notes');
const bodyslotsDescriptionElement = document.getElementById('equipment-body-slots-notes');
const info = characterData.equip_descrip;
var featsDescriptionElement = document.getElementById('statistics-feats-notes');
var traitsDescriptionElement = document.getElementById('statistics-traits-notes');
var archetypeDescriptionElement = document.getElementById('statistics-archetypes-notes');
var bodyslotsDescriptionElement = document.getElementById('equipment-body-slots-notes');
var info = characterData.equip_descrip;

const abilitiesDescriptionElement = document.getElementById('statistics-abilities-notes');
var abilitiesDescriptionElement = document.getElementById('statistics-abilities-notes');
class_features = characterData['class features'];

const characterDescriptionElement = document.getElementById('basics-character-description');
var characterDescriptionElement = document.getElementById('basics-character-description');

displayFeatsInfo(featsDescriptionElement, characterData);
displayTraitsInfo(traitsDescriptionElement, characterData);
Expand All @@ -81,40 88,51 @@ document.addEventListener('DOMContentLoaded', function () {

(async () => {
try {
const featsInfoModule = await import('./variableMappings.js');
const variableMappings = featsInfoModule.variableMappings_data;
variableMappings.forEach((mapping, index) => {
// Ensure variableMappings_data is correctly assigned to the window object
window.variableMappings_data = variableMappings_data;

// Log the data to confirm it's correctly assigned
console.log("window.variableMappings_data", window.variableMappings_data);

// Iterate through window.variableMappings_data instead of window.variableMappings
window.variableMappings_data.forEach((mapping, index) => {
const element = document.getElementById(mapping.elementId);
if (element) {
let value;
if (Array.isArray(mapping.dataKey)) {
const [objectKey, nestedKey] = mapping.dataKey;
value = characterData[objectKey] ? characterData[objectKey][nestedKey] : undefined;
console.log("value array", value);
} else {
const keys = mapping.dataKey.split('.');
value = keys.reduce((acc, key) => acc ? acc[key] : undefined, characterData);
console.log("value non array", value);
}

if (value !== undefined) {
console.log("value assigned to element", value);
element.value = value;
element.focus();
stats.render();
classes.render();
textBlock.render();
textareaBlock.render();
}
} else {
console.warn(`Element with ID ${mapping.elementId} not found`);
}
});

} catch (error) {
console.error('Error during dynamic import:', error);
console.error('Error during dynamic import or execution:', error);
}
})();


(async () => {
try {
const tabValueModule = await import('./mostRecentTabValue.js');
const clickMostRecentTab = tabValueModule.clickMostRecentTab;
// const tabValueModule = await import('./mostRecentTabValue.js');
window.clickMostRecentTab = clickMostRecentTab;
clickMostRecentTab(characterData, updateMostRecentTabValue);

} catch (error) {
Expand All @@ -124,14 142,16 @@ document.addEventListener('DOMContentLoaded', function () {

(async () => {
try {
const skillRanksString = characterData.skill_ranks;
const skillRanksObject = JSON.parse(skillRanksString);
const skillRanksModule = await import('./skill_ranks.js');
const skill_ranks_func = skillRanksModule.skill_ranks_func;
const includeCustomCheckbox = document.getElementById('skills-ranks-include-custom');
var skillRanksString = characterData.skill_ranks;
var skillRanksObject = JSON.parse(skillRanksString);
console.log("skillRanksObject", skillRanksObject);
// var skillRanksModule = await import('./skill_ranks.js');
var includeCustomCheckbox = document.getElementById('skills-ranks-include-custom');
console.log("includeCustomCheckbox", includeCustomCheckbox);
window.skill_ranks_func = skill_ranks_func

skill_ranks_func(skillRanksObject, includeCustomCheckbox);
skills.render();
window.skill_ranks_func(skillRanksObject, includeCustomCheckbox);
// skills.render();

} catch (error) {
console.error('Error during dynamic import:', error);
Expand All @@ -143,7 163,7 @@ document.addEventListener('DOMContentLoaded', function () {
})
.catch(error => {
console.error('Error fetching or parsing character data:', error);
const characterDescriptionElement = document.getElementById('basics-character-description');
var characterDescriptionElement = document.getElementById('basics-character-description');
if (characterDescriptionElement) {
characterDescriptionElement.innerHTML = `<pre>Error: ${error.message}</pre>`;
}
Expand All @@ -152,7 172,7 @@ document.addEventListener('DOMContentLoaded', function () {
});
}

const updateDescriptionButton = document.getElementById('updateDescriptionButton');
var updateDescriptionButton = document.getElementById('updateDescriptionButton');

function updatespells_known_and_spells_per_day() {
// Early return if either list is empty
Expand Down
7 changes: 5 additions & 2 deletions build/js/variableMappings.js
Original file line number Diff line number Diff line change
@@ -1,4 1,5 @@
const variableMappings_data = [

var variableMappings_data = [
{ elementId: 'basics-character-name', dataKey: 'character_full_name' },
// { elementId: 'basics-character-description', dataKey: 'professions' },

Expand Down Expand Up @@ -85,4 86,6 @@ const variableMappings_data = [

];

export { variableMappings_data };
// export { variableMappings_data };
// Manually add to the window object
window.variableMappings_data = variableMappings_data;
Loading

0 comments on commit dbc5aa3

Please sign in to comment.