25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
// ═══════════════════════════════════════════════════════════════════════
|
|
// KEYBINDINGS — keyboard shortcuts for battle
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
|
|
let keybindingsSetup = false;
|
|
|
|
function setupKeybindings() {
|
|
if (keybindingsSetup) return;
|
|
keybindingsSetup = true;
|
|
|
|
document.addEventListener('keydown', function(e) {
|
|
// Settings — comma key (non-conflicting with Monsterbation).
|
|
// Works on ANY page the script loads (battle, character, bazaar...).
|
|
if (e.keyCode === KEYS.COMMA) {
|
|
// 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();
|
|
toggleSettings(); // toggleSettings owns the settingsVisible flag
|
|
}
|
|
});
|
|
|
|
console.log('%c⌨ [HV] Key: ,=settings (Battle input managed by Monsterbation)', 'color:#0f0;font-size:11px');
|
|
}
|
|
|