()
| 67 | } |
| 68 | |
| 69 | function wireAllButton() { |
| 70 | const allBtn = document.getElementById("stemAllBtn"); |
| 71 | if (!allBtn) return; |
| 72 | |
| 73 | function syncAllBtn() { |
| 74 | allBtn.setAttribute("aria-pressed", String(selectedStems.size === STEM_NAMES.length)); |
| 75 | } |
| 76 | |
| 77 | allBtn.addEventListener("click", () => { |
| 78 | const allSelected = selectedStems.size === STEM_NAMES.length; |
| 79 | if (allSelected) { |
| 80 | selectedStems.clear(); |
| 81 | } else { |
| 82 | for (const n of STEM_NAMES) selectedStems.add(n); |
| 83 | } |
| 84 | saveSelectedStems(); |
| 85 | refreshStemChoiceVisuals(); |
| 86 | buildStripStems(); |
| 87 | syncAllBtn(); |
| 88 | }); |
| 89 | |
| 90 | /* Keep All in sync when individual stems are toggled */ |
| 91 | for (const btn of document.querySelectorAll(".stem-choice[data-stem]")) { |
| 92 | btn.addEventListener("click", syncAllBtn); |
| 93 | } |
| 94 | |
| 95 | syncAllBtn(); |
| 96 | } |
| 97 | |
| 98 | // ─── Wire everything up ─── |
| 99 |
no test coverage detected