MCPcopy
hub / github.com/stemdeckapp/stemdeck / wireCatalogRailViews

Function wireCatalogRailViews

static/js/catalog.js:1412–1427  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1410}
1411
1412function wireCatalogRailViews() {
1413 document.querySelector(".rail-library")?.addEventListener("click", () => setCatalogView("library"));
1414 document.querySelector(".rail-favorites")?.addEventListener("click", () => setCatalogView("favorites"));
1415 document.querySelector(".rail-trash")?.addEventListener("click", () => setCatalogView("trash"));
1416 document.getElementById("clearBinBtn")?.addEventListener("click", () => {
1417 const trash = getTrashFolder();
1418 const toDelete = [...(trash?.items || [])];
1419 markJobsDeleted(toDelete); // persist before purge so reload can't re-import
1420 purgeTrash();
1421 saveState();
1422 render();
1423 for (const id of toDelete) {
1424 fetch(`/api/jobs/${id}`, { method: "DELETE" }).catch(() => {});
1425 }
1426 });
1427}
1428
1429function wireCatalogSearch() {
1430 const input = document.getElementById("catalogSearch");

Callers 1

initCatalogFunction · 0.85

Calls 6

setCatalogViewFunction · 0.85
getTrashFolderFunction · 0.85
markJobsDeletedFunction · 0.85
purgeTrashFunction · 0.85
saveStateFunction · 0.85
renderFunction · 0.70

Tested by

no test coverage detected