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

@ -1539,4 +1539,16 @@ body {
font-weight: normal;
cursor: pointer;
}
.cd-toggle input { margin: 0; }
.cd-toggle input { margin: 0; }
.select-all-btn {
margin-left: 8px;
padding: 2px 8px;
font-size: 11px;
font-weight: normal;
cursor: pointer;
border: 1px solid #ccc;
border-radius: 3px;
background: #f0f0f0;
}
.select-all-btn:hover { background: #e0e0e0; }

View file

@ -245,7 +245,7 @@
<!-- Legendary Wards -->
<div class="constraint-section">
<h4>Legendary Wards</h4>
<h4>Legendary Wards <button type="button" id="wardsSelectAll" class="select-all-btn">Select All</button></h4>
<div class="cantrips-grid">
<div class="checkbox-item">
<input type="checkbox" id="protection_flame" value="Legendary Flame Ward">

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
*/