Skip to content

Commit

Permalink
support for alphabetically sorted for the 5e OGL Character sheet (#10)
Browse files Browse the repository at this point in the history
* include check for OLD5e-ogl-character-sheet and update for next version

* check is Module active and is option active for sort

* include new option for 5e ogl charsheet

* update version and compatible core version

* update README.md
  • Loading branch information
stillday authored Jul 2, 2021
1 parent 6d1e712 commit e0977d3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ The module also depends on [Babele](https://foundryvtt.com/packages/babele) for

Also see the [releases page](https://github.com/League-of-Foundry-Developers/foundryvtt-dnd5e-lang-de/releases).

### Version 1.0.1
- update the Module to Foundry Version 0.8.6 and DND 5E system version 1.3.3
- include sorted alphabetically for D&D 5e OGL Character Sheet. [Project page](https://foundryvtt.com/packages/5e-ogl-character-sheet)
- new option to active the alphabetically sorted for 5e OGL Character Sheet

### Version 1.0.0

- Added compendium content translations using the Babele module
Expand Down
14 changes: 11 additions & 3 deletions dnd5e-de.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Hooks.once('init', () => {
});
Converters(module_id);
}

// Sort skills alphabetically
// Thanks to Elvis Pereira for the polish translation
// Fixed in upstream 1.3.0 (https://gitlab.com/foundrynet/dnd5e/-/issues/1070)
if (!isNewerVersion(game.system.data.version, '1.2.4')) {
async function sortSkillsAlpha() {
if (!isNewerVersion(game.system.data.version, '1.3.3')) {
async function sortSkillsAlpha() {
const lists = document.getElementsByClassName('skills-list');
for (let list of lists) {
const competences = list.childNodes;
Expand All @@ -58,6 +58,14 @@ Hooks.once('init', () => {
}

Hooks.on('renderActorSheet', async function () {
// Sort the skills from 5e OGL Character Sheet
if (game.modules.get('5e-ogl-character-sheet')?.active &&
game.i18n.lang === module_lang &&
game.system.id === module_sys &&
game.settings.get(module_id, 'oglOverrideSkillSortAlpha')) {
sortSkillsAlpha();
}

if (game.i18n.lang === module_lang &&
game.system.id === module_sys &&
game.settings.get(module_id, 'overrideSkillSortAlpha')) {
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "FoundryVTT-dnd5e-DE",
"title": "DnD5e German Translation (Deutsch)",
"description": "German language support for the D&D5e system",
"version": "1.0.0",
"version": "1.0.1",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.8.2",
"compatibleCoreVersion": "0.8.6",
"author": "Fallayn#6414, Hydroxi#0366, Smicman#1404, ThoGri#6692, Morvar#0915, crash#7509",
"esmodules": [
"dnd5e-de.js"
Expand Down
14 changes: 13 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default [
{
name: 'overrideSkillSortAlpha',
onlyUntilSystemVersionIncluding: '1.2.4',
onlyUntilSystemVersionIncluding: '1.3.3',
data: {
name: 'Fertigkeiten alphabetisch sortieren',
hint: 'Sortiert die Fertigkeitenliste alphabetisch.',
Expand All @@ -11,6 +11,18 @@ export default [
default: true
},
},
{
name: 'oglOverrideSkillSortAlpha',
onlyUntilSystemVersionIncluding: '1.3.3',
data: {
name: 'Fertigkeiten alphabetisch sortieren im 5e OGL Character Sheet',
hint: 'Sortiert die Fertigkeitenliste alphabetisch.',
scope: 'client',
type: Boolean,
config: true,
default: false
},
},
{
name: 'enableCompendiumTranslation',
data: {
Expand Down

0 comments on commit e0977d3

Please sign in to comment.