v0.14.37 - Fix gear panel: buttons were submitting the armory form

Root cause: both buttons were inserted inside the armory <form>.
HTML <button> defaults to type=submit — clicking submitted the form,
the page reloaded, and the panel (which renders 300ms later) was
destroyed. The split-second flash was the panel before the reload.

Fix: type='button' on both buttons. Panel now stays up.
This commit is contained in:
GaboGG 2026-07-31 09:02:16 -04:00
parent f3561bb435
commit b2e96c6191
5 changed files with 15 additions and 21 deletions

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.36
// @version 0.14.37
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
// @author GaboGG + Hermes
// @match *://*.hentaiverse.org/*
@ -17,7 +17,7 @@
// CONFIG — default settings
// ═══════════════════════════════════════════════════════════════════════
const VERSION = '0.14.36';
const VERSION = '0.14.37';
const CFG = {
// — Battle automation
@ -3857,7 +3857,6 @@ function analyzeGear() {
// ── UI ──
function buildGearPanel() {
console.log('%c[HV] 📊 buildGearPanel called', 'color:#0f0');
// Remove old panel
const old = document.getElementById('hv-gear-panel');
if (old) old.remove();
@ -3884,7 +3883,6 @@ function buildGearPanel() {
panel.appendChild(title);
const { results } = analyzeGear();
console.log(`%c[HV] 📊 Analysis: ${results.length} slots`, 'color:#0f0');
results.forEach(({ slot, current, cands }) => {
const block = document.createElement('div');
@ -3935,7 +3933,6 @@ function buildGearPanel() {
});
document.body.appendChild(panel);
console.log(`%c[HV] 📊 Panel rendered (${document.getElementById('hv-gear-panel') ? 'in DOM' : 'MISSING from DOM'})`, 'color:#0f0');
}
function enhanceGearAnalysis() {
@ -3954,6 +3951,7 @@ function enhanceGearAnalysis() {
// Analyze button
const analyzeBtn = document.createElement('button');
analyzeBtn.type = 'button'; // CRITICAL: prevent form submit (inside armory form)
analyzeBtn.textContent = '🔍 Analyze Gear';
analyzeBtn.style.cssText = css({
padding: '3px 8px', background: '#2a2a4a', color: '#fff',
@ -3961,12 +3959,11 @@ function enhanceGearAnalysis() {
fontSize: '11px', fontFamily: 'monospace',
});
analyzeBtn.onclick = () => {
console.log('%c[HV] 🔍 Analyze clicked', 'color:#0f0');
try {
autoScrapeGear();
} catch (e) { console.error('[HV] scrape failed:', e); }
setTimeout(() => {
try { buildGearPanel(); console.log('%c[HV] 📊 Panel built', 'color:#0f0'); }
try { buildGearPanel(); }
catch (e) { console.error('[HV] gear panel failed:', e); }
}, 300);
};
@ -3974,6 +3971,7 @@ function enhanceGearAnalysis() {
// Rescan button (clears buy data then rescrapes)
const rescanBtn = document.createElement('button');
rescanBtn.type = 'button'; // CRITICAL: prevent form submit (inside armory form)
rescanBtn.textContent = '🔄 Clear Buy + Rescan';
rescanBtn.style.cssText = css({
padding: '3px 8px', background: '#3a2a2a', color: '#fff',

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.36
// @version 0.14.37
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
// @author GaboGG + Hermes
// @match *://*.hentaiverse.org/*
@ -17,7 +17,7 @@
// CONFIG — default settings
// ═══════════════════════════════════════════════════════════════════════
const VERSION = '0.14.36';
const VERSION = '0.14.37';
const CFG = {
// — Battle automation
@ -3857,7 +3857,6 @@ function analyzeGear() {
// ── UI ──
function buildGearPanel() {
console.log('%c[HV] 📊 buildGearPanel called', 'color:#0f0');
// Remove old panel
const old = document.getElementById('hv-gear-panel');
if (old) old.remove();
@ -3884,7 +3883,6 @@ function buildGearPanel() {
panel.appendChild(title);
const { results } = analyzeGear();
console.log(`%c[HV] 📊 Analysis: ${results.length} slots`, 'color:#0f0');
results.forEach(({ slot, current, cands }) => {
const block = document.createElement('div');
@ -3935,7 +3933,6 @@ function buildGearPanel() {
});
document.body.appendChild(panel);
console.log(`%c[HV] 📊 Panel rendered (${document.getElementById('hv-gear-panel') ? 'in DOM' : 'MISSING from DOM'})`, 'color:#0f0');
}
function enhanceGearAnalysis() {
@ -3954,6 +3951,7 @@ function enhanceGearAnalysis() {
// Analyze button
const analyzeBtn = document.createElement('button');
analyzeBtn.type = 'button'; // CRITICAL: prevent form submit (inside armory form)
analyzeBtn.textContent = '🔍 Analyze Gear';
analyzeBtn.style.cssText = css({
padding: '3px 8px', background: '#2a2a4a', color: '#fff',
@ -3961,12 +3959,11 @@ function enhanceGearAnalysis() {
fontSize: '11px', fontFamily: 'monospace',
});
analyzeBtn.onclick = () => {
console.log('%c[HV] 🔍 Analyze clicked', 'color:#0f0');
try {
autoScrapeGear();
} catch (e) { console.error('[HV] scrape failed:', e); }
setTimeout(() => {
try { buildGearPanel(); console.log('%c[HV] 📊 Panel built', 'color:#0f0'); }
try { buildGearPanel(); }
catch (e) { console.error('[HV] gear panel failed:', e); }
}, 300);
};
@ -3974,6 +3971,7 @@ function enhanceGearAnalysis() {
// Rescan button (clears buy data then rescrapes)
const rescanBtn = document.createElement('button');
rescanBtn.type = 'button'; // CRITICAL: prevent form submit (inside armory form)
rescanBtn.textContent = '🔄 Clear Buy + Rescan';
rescanBtn.style.cssText = css({
padding: '3px 8px', background: '#3a2a2a', color: '#fff',

View file

@ -2,7 +2,7 @@
// CONFIG — default settings
// ═══════════════════════════════════════════════════════════════════════
const VERSION = '0.14.36';
const VERSION = '0.14.37';
const CFG = {
// — Battle automation

View file

@ -149,7 +149,6 @@ function analyzeGear() {
// ── UI ──
function buildGearPanel() {
console.log('%c[HV] 📊 buildGearPanel called', 'color:#0f0');
// Remove old panel
const old = document.getElementById('hv-gear-panel');
if (old) old.remove();
@ -176,7 +175,6 @@ function buildGearPanel() {
panel.appendChild(title);
const { results } = analyzeGear();
console.log(`%c[HV] 📊 Analysis: ${results.length} slots`, 'color:#0f0');
results.forEach(({ slot, current, cands }) => {
const block = document.createElement('div');
@ -227,7 +225,6 @@ function buildGearPanel() {
});
document.body.appendChild(panel);
console.log(`%c[HV] 📊 Panel rendered (${document.getElementById('hv-gear-panel') ? 'in DOM' : 'MISSING from DOM'})`, 'color:#0f0');
}
function enhanceGearAnalysis() {
@ -246,6 +243,7 @@ function enhanceGearAnalysis() {
// Analyze button
const analyzeBtn = document.createElement('button');
analyzeBtn.type = 'button'; // CRITICAL: prevent form submit (inside armory form)
analyzeBtn.textContent = '🔍 Analyze Gear';
analyzeBtn.style.cssText = css({
padding: '3px 8px', background: '#2a2a4a', color: '#fff',
@ -253,12 +251,11 @@ function enhanceGearAnalysis() {
fontSize: '11px', fontFamily: 'monospace',
});
analyzeBtn.onclick = () => {
console.log('%c[HV] 🔍 Analyze clicked', 'color:#0f0');
try {
autoScrapeGear();
} catch (e) { console.error('[HV] scrape failed:', e); }
setTimeout(() => {
try { buildGearPanel(); console.log('%c[HV] 📊 Panel built', 'color:#0f0'); }
try { buildGearPanel(); }
catch (e) { console.error('[HV] gear panel failed:', e); }
}, 300);
};
@ -266,6 +263,7 @@ function enhanceGearAnalysis() {
// Rescan button (clears buy data then rescrapes)
const rescanBtn = document.createElement('button');
rescanBtn.type = 'button'; // CRITICAL: prevent form submit (inside armory form)
rescanBtn.textContent = '🔄 Clear Buy + Rescan';
rescanBtn.style.cssText = css({
padding: '3px 8px', background: '#3a2a2a', color: '#fff',

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.36
// @version 0.14.37
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
// @author GaboGG + Hermes
// @match *://*.hentaiverse.org/*