diff --git a/scripts/module.js b/scripts/module.js index b9569f6..e8be08d 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -51,8 +51,9 @@ Hooks.once('init', () => { // Hook to handle conditional settings in the UI Hooks.on('renderSettingsConfig', (app, html, data) => { // Search for our specific inputs with safer selectors (ending with key) - const animSelect = html.find('select[name$="critAnimation"]'); - const colorInput = html.find('input[name$="pulseColor"]'); + const $html = $(html); + const animSelect = $html.find('select[name$="critAnimation"]'); + const colorInput = $html.find('input[name$="pulseColor"]'); // Ensure we found the color input to transform it if (colorInput.length) { @@ -130,7 +131,8 @@ Hooks.on('renderChatMessage', (message, html, data) => { if (isCriticalHit(roll)) { const anim = game.settings.get('dh-immersive-crits', 'critAnimation'); if (anim && anim !== 'none') { - const content = html.find('.message-content'); + const $html = $(html); + const content = $html.find('.message-content'); content.addClass(`dh-crit-${anim}`); // Apply custom color for Pulse @@ -173,7 +175,7 @@ Hooks.on('renderChatMessage', (message, html, data) => { } // Also add a general class for easier targeting if needed - html.addClass('dh-critical-hit'); + $html.addClass('dh-critical-hit'); } } });