feat(suitbuilder): Select All / Clear All toggle for Legendary Wards

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-25 21:24:52 +02:00
parent 09bde83325
commit 4bc51a1f48
3 changed files with 34 additions and 3 deletions

View file

@ -152,13 +152,32 @@ function setupEventListeners() {
// Main action buttons
document.getElementById('searchSuits').addEventListener('click', performSuitSearch);
document.getElementById('clearAll').addEventListener('click', clearAllConstraints);
document.getElementById('wardsSelectAll').addEventListener('click', toggleAllWards);
// Slot control buttons
document.getElementById('lockSelectedSlots').addEventListener('click', lockSelectedSlots);
document.getElementById('clearAllLocks').addEventListener('click', clearAllLocks);
document.getElementById('resetSlotView').addEventListener('click', resetSlotView);
}
// Legendary Ward checkboxes (toggled together by the "Select All" button).
const WARD_IDS = [
'protection_flame', 'protection_frost', 'protection_acid', 'protection_storm',
'protection_slashing', 'protection_piercing', 'protection_bludgeoning', 'protection_armor'
];
/**
* Toggle all Legendary Ward checkboxes. If every ward is already checked,
* clears them; otherwise selects all. The button label tracks the state.
*/
function toggleAllWards() {
const boxes = WARD_IDS.map(id => document.getElementById(id)).filter(Boolean);
const allChecked = boxes.every(cb => cb.checked);
boxes.forEach(cb => { cb.checked = !allChecked; });
const btn = document.getElementById('wardsSelectAll');
if (btn) btn.textContent = allChecked ? 'Select All' : 'Clear All';
}
/**
* Setup slot interaction functionality
*/