Skip to content

Commit

Permalink
v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mouse0270 committed Oct 10, 2022
1 parent 859d623 commit 620ff8d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# version 1.0.4 - GM Theme
- Fixed issue with GM Theme not hiding Configure Theme Button with Fantasy RPG UI
- Fixed GM Theme not applying to user when logging into world
- Updated GM Theme logic to only update changed setting on players end, This should make it more efficient when changing settings

# version 1.0.3 - You can't replace Integers with a string...
- Fixed `number` control not working correctly if default was set to a value that wasn't a string.

Expand Down
15 changes: 7 additions & 8 deletions scripts/_settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ Hooks.once('setup', () => {
config: false,
onChange: (event) => {
if (MODULE.setting('enableMasterTheme') && !game.user.isGM) {
MODULE.setting('themeSettings', event).then(response => {
for (const [key, theme] of Object.entries(MODULE.setting('registeredThemes'))) {
game.modules.get(MODULE.ID).API.register(foundry.utils.mergeObject(theme, {
id: key
}, { inplace: false }));
for (const [key, value] of Object.entries(event)) {
if (MODULE.setting('themeSettings')[key].value != value.value) {
game.modules.get(MODULE.ID).API.setCSSVariable(key, value.value)
}
});
};
MODULE.setting('themeSettings', event);
}
}
});
Expand Down Expand Up @@ -62,10 +61,10 @@ Hooks.once('setup', () => {
scope: 'world',
onChange: (event) => {
if (MODULE.setting('enableMasterTheme') && !game.user.isGM) {
document.querySelector('#settings-game button[data-action="themer"]').classList.add('hidden');
document.querySelector('#settings-game button[data-action="themer"]').style.display = 'none';
document.querySelector('#lib-themer-dialog .header-button.close').click() ?? false;
}else{
document.querySelector('#settings-game button[data-action="themer"]').classList.remove('hidden');
document.querySelector('#settings-game button[data-action="themer"]').style.removeProperty('display');
}
}
});
Expand Down
6 changes: 5 additions & 1 deletion scripts/module.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ export class Themer {
}

static init = () => {
if (!game.user.isGM && MODULE.setting('enableMasterTheme')) {
MODULE.setting('themeSettings', MODULE.setting('masterTheme'))
}

this.installAPI();
this.getThemes();

Expand Down Expand Up @@ -438,7 +442,7 @@ export class Themer {
</button>`);

if (MODULE.setting('enableMasterTheme') && !game.user.isGM) {
elem[0].querySelector('#settings-game button[data-action="themer"]').classList.add('hidden');
elem[0].querySelector('#settings-game button[data-action="themer"]').style.display = 'none';
}

elem[0].querySelector('#settings-game button[data-action="themer"]').addEventListener('click', async (event) => {
Expand Down

0 comments on commit 620ff8d

Please sign in to comment.