From 4bc51a1f48b75aef08d18b500ff0d45213ddc4aa Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 25 Jun 2026 21:24:52 +0200 Subject: [PATCH] feat(suitbuilder): Select All / Clear All toggle for Legendary Wards Co-Authored-By: Claude Opus 4.8 --- static/suitbuilder.css | 14 +++++++++++++- static/suitbuilder.html | 2 +- static/suitbuilder.js | 21 ++++++++++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/static/suitbuilder.css b/static/suitbuilder.css index a3bef448..db10085b 100644 --- a/static/suitbuilder.css +++ b/static/suitbuilder.css @@ -1539,4 +1539,16 @@ body { font-weight: normal; cursor: pointer; } -.cd-toggle input { margin: 0; } \ No newline at end of file +.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; } \ No newline at end of file diff --git a/static/suitbuilder.html b/static/suitbuilder.html index 9868ad4e..52412f2e 100644 --- a/static/suitbuilder.html +++ b/static/suitbuilder.html @@ -245,7 +245,7 @@
-

Legendary Wards

+

Legendary Wards

diff --git a/static/suitbuilder.js b/static/suitbuilder.js index 066ea81e..72558a08 100644 --- a/static/suitbuilder.js +++ b/static/suitbuilder.js @@ -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 */