MCPcopy Create free account
hub / github.com/stemdeckapp/stemdeck / wireAllButton

Function wireAllButton

static/js/main.js:69–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67}
68
69function 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

Callers 1

main.jsFile · 0.85

Calls 4

saveSelectedStemsFunction · 0.90
buildStripStemsFunction · 0.90
refreshStemChoiceVisualsFunction · 0.85
syncAllBtnFunction · 0.85

Tested by

no test coverage detected