From de9605609ebdda7f085f62a89755c68ba7a6bd06 Mon Sep 17 00:00:00 2001 From: GaboGG Date: Tue, 4 Aug 2026 14:59:09 -0400 Subject: [PATCH] v0.16.2 - Fix ',' settings key to work on any page; robust MB/HVUT detection --- scripts/hv-unified.user.js | 29 ++++++++++++++++++----------- scripts/latest.user.js | 29 ++++++++++++++++++----------- src/config.js | 2 +- src/header.user.js | 2 +- src/keybindings.js | 15 ++++++++------- src/public-api.js | 10 ++++++++-- 6 files changed, 54 insertions(+), 33 deletions(-) diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index 8989692..8c42c40 100644 --- a/scripts/hv-unified.user.js +++ b/scripts/hv-unified.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.16.1 +// @version 0.16.2 // @description HV Unified — Bridge & Strategy/Gear Advisor for HentaiVerse (complements Monsterbation & HVUtils) // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* @@ -18,7 +18,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.16.1'; +const VERSION = '0.16.2'; const CFG = { // — Battle strategy advisory @@ -1670,14 +1670,15 @@ function setupKeybindings() { keybindingsSetup = true; document.addEventListener('keydown', function(e) { - // Settings — comma key (non-conflicting with Monsterbation) + // Settings — comma key (non-conflicting with Monsterbation). + // Works on ANY page the script loads (battle, character, bazaar...). if (e.keyCode === KEYS.COMMA) { - if (isBattlePage()) { - e.preventDefault(); - STATE.settingsVisible = !STATE.settingsVisible; - toggleSettings(); - return; - } + // Don't swallow comma when typing in an input/textarea (e.g. auction bids) + const tag = (document.activeElement || {}).tagName; + if (tag === 'INPUT' || tag === 'TEXTAREA') return; + e.preventDefault(); + STATE.settingsVisible = !STATE.settingsVisible; + toggleSettings(); } }); @@ -3648,8 +3649,14 @@ window.HV = { tier: STATE.tier, // Community script detection scripts: { - monsterbation: typeof window.unsafeWindow !== 'undefined' || !!(document.querySelector('script[src*="hvmonsterbate"], [class*="monsterbation"], #homosex, #gay_sex')), - hvutils: !!(document.querySelector('[id*="hvut"], [class*="hvut"], #hvut')), + monsterbation: !!(document.getElementById('homosex') || + document.getElementById('mbcfgbt') || + document.getElementById('gay_sex') || + typeof window.Monsterbation !== 'undefined'), + hvutils: !!(document.getElementById('hvut_menu') || + document.getElementById('hvut') || + window.HVUT || + document.querySelector('[class*="hvut"], [id*="hvut"]')), unified: true, }, // State availability diff --git a/scripts/latest.user.js b/scripts/latest.user.js index 8989692..8c42c40 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.16.1 +// @version 0.16.2 // @description HV Unified — Bridge & Strategy/Gear Advisor for HentaiVerse (complements Monsterbation & HVUtils) // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* @@ -18,7 +18,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.16.1'; +const VERSION = '0.16.2'; const CFG = { // — Battle strategy advisory @@ -1670,14 +1670,15 @@ function setupKeybindings() { keybindingsSetup = true; document.addEventListener('keydown', function(e) { - // Settings — comma key (non-conflicting with Monsterbation) + // Settings — comma key (non-conflicting with Monsterbation). + // Works on ANY page the script loads (battle, character, bazaar...). if (e.keyCode === KEYS.COMMA) { - if (isBattlePage()) { - e.preventDefault(); - STATE.settingsVisible = !STATE.settingsVisible; - toggleSettings(); - return; - } + // Don't swallow comma when typing in an input/textarea (e.g. auction bids) + const tag = (document.activeElement || {}).tagName; + if (tag === 'INPUT' || tag === 'TEXTAREA') return; + e.preventDefault(); + STATE.settingsVisible = !STATE.settingsVisible; + toggleSettings(); } }); @@ -3648,8 +3649,14 @@ window.HV = { tier: STATE.tier, // Community script detection scripts: { - monsterbation: typeof window.unsafeWindow !== 'undefined' || !!(document.querySelector('script[src*="hvmonsterbate"], [class*="monsterbation"], #homosex, #gay_sex')), - hvutils: !!(document.querySelector('[id*="hvut"], [class*="hvut"], #hvut')), + monsterbation: !!(document.getElementById('homosex') || + document.getElementById('mbcfgbt') || + document.getElementById('gay_sex') || + typeof window.Monsterbation !== 'undefined'), + hvutils: !!(document.getElementById('hvut_menu') || + document.getElementById('hvut') || + window.HVUT || + document.querySelector('[class*="hvut"], [id*="hvut"]')), unified: true, }, // State availability diff --git a/src/config.js b/src/config.js index 9fcd21d..ce3d02b 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.16.1'; +const VERSION = '0.16.2'; const CFG = { // — Battle strategy advisory diff --git a/src/header.user.js b/src/header.user.js index debb486..c695cd3 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.16.1 +// @version 0.16.2 // @description HV Unified — Bridge & Strategy/Gear Advisor for HentaiVerse (complements Monsterbation & HVUtils) // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* diff --git a/src/keybindings.js b/src/keybindings.js index 3611d4c..15c26cf 100644 --- a/src/keybindings.js +++ b/src/keybindings.js @@ -9,14 +9,15 @@ function setupKeybindings() { keybindingsSetup = true; document.addEventListener('keydown', function(e) { - // Settings — comma key (non-conflicting with Monsterbation) + // Settings — comma key (non-conflicting with Monsterbation). + // Works on ANY page the script loads (battle, character, bazaar...). if (e.keyCode === KEYS.COMMA) { - if (isBattlePage()) { - e.preventDefault(); - STATE.settingsVisible = !STATE.settingsVisible; - toggleSettings(); - return; - } + // Don't swallow comma when typing in an input/textarea (e.g. auction bids) + const tag = (document.activeElement || {}).tagName; + if (tag === 'INPUT' || tag === 'TEXTAREA') return; + e.preventDefault(); + STATE.settingsVisible = !STATE.settingsVisible; + toggleSettings(); } }); diff --git a/src/public-api.js b/src/public-api.js index 4f98e54..b445e51 100644 --- a/src/public-api.js +++ b/src/public-api.js @@ -41,8 +41,14 @@ window.HV = { tier: STATE.tier, // Community script detection scripts: { - monsterbation: typeof window.unsafeWindow !== 'undefined' || !!(document.querySelector('script[src*="hvmonsterbate"], [class*="monsterbation"], #homosex, #gay_sex')), - hvutils: !!(document.querySelector('[id*="hvut"], [class*="hvut"], #hvut')), + monsterbation: !!(document.getElementById('homosex') || + document.getElementById('mbcfgbt') || + document.getElementById('gay_sex') || + typeof window.Monsterbation !== 'undefined'), + hvutils: !!(document.getElementById('hvut_menu') || + document.getElementById('hvut') || + window.HVUT || + document.querySelector('[class*="hvut"], [id*="hvut"]')), unified: true, }, // State availability