refactor: Use jQuery-wrapped HTML object for settings UI element lookups.
This commit is contained in:
parent
3612afc928
commit
44368a974f
1 changed files with 7 additions and 6 deletions
|
|
@ -97,16 +97,17 @@ Hooks.once('init', () => {
|
||||||
* Handle Settings UI Visibility
|
* Handle Settings UI Visibility
|
||||||
*/
|
*/
|
||||||
Hooks.on('renderSettingsConfig', (app, html, data) => {
|
Hooks.on('renderSettingsConfig', (app, html, data) => {
|
||||||
const iconTypeSelect = html.find(`select[name="${MODULE_ID}.iconType"]`);
|
const $html = $(html);
|
||||||
const themeSelect = html.find(`select[name="${MODULE_ID}.colorTheme"]`);
|
const iconTypeSelect = $html.find(`select[name="${MODULE_ID}.iconType"]`);
|
||||||
|
const themeSelect = $html.find(`select[name="${MODULE_ID}.colorTheme"]`);
|
||||||
|
|
||||||
const updateVisibility = () => {
|
const updateVisibility = () => {
|
||||||
const iconType = iconTypeSelect.val();
|
const iconType = iconTypeSelect.val();
|
||||||
const theme = themeSelect.val();
|
const theme = themeSelect.val();
|
||||||
|
|
||||||
// Icon Inputs
|
// Icon Inputs
|
||||||
const presetGroup = html.find(`select[name="${MODULE_ID}.presetIcon"]`).closest('.form-group');
|
const presetGroup = $html.find(`select[name="${MODULE_ID}.presetIcon"]`).closest('.form-group');
|
||||||
const customIconGroup = html.find(`input[name="${MODULE_ID}.customIcon"]`).closest('.form-group');
|
const customIconGroup = $html.find(`input[name="${MODULE_ID}.customIcon"]`).closest('.form-group');
|
||||||
|
|
||||||
if (iconType === 'preset') {
|
if (iconType === 'preset') {
|
||||||
presetGroup.show();
|
presetGroup.show();
|
||||||
|
|
@ -117,8 +118,8 @@ Hooks.on('renderSettingsConfig', (app, html, data) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color Inputs
|
// Color Inputs
|
||||||
const fullColorGroup = html.find(`input[name="${MODULE_ID}.fullColor"]`).closest('.form-group');
|
const fullColorGroup = $html.find(`input[name="${MODULE_ID}.fullColor"]`).closest('.form-group');
|
||||||
const emptyColorGroup = html.find(`input[name="${MODULE_ID}.emptyColor"]`).closest('.form-group');
|
const emptyColorGroup = $html.find(`input[name="${MODULE_ID}.emptyColor"]`).closest('.form-group');
|
||||||
|
|
||||||
if (theme === 'custom') {
|
if (theme === 'custom') {
|
||||||
fullColorGroup.show();
|
fullColorGroup.show();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue