Admin UI: categories default EXPANDED (collapse is opt-in) so the Tools tab never looks empty
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q8t9GEyyLZbUQu26na1JQg
This commit is contained in:
+3
-5
@@ -26,7 +26,7 @@ function updateCards(form){
|
||||
});
|
||||
}
|
||||
|
||||
/* ---- Collapsible categories + per-card minimize (keeps the Tools tab light) ---- */
|
||||
/* ---- Collapsible categories + per-card minimize. Default EXPANDED; collapse is opt-in. ---- */
|
||||
var LSKEY='asktamMcpCatCollapsed';
|
||||
function loadState(){try{return JSON.parse(localStorage.getItem(LSKEY)||'{}')||{};}catch(e){return {};}}
|
||||
function saveState(m){try{localStorage.setItem(LSKEY,JSON.stringify(m));}catch(e){}}
|
||||
@@ -34,7 +34,6 @@ function saveState(m){try{localStorage.setItem(LSKEY,JSON.stringify(m));}catch(e
|
||||
function initCollapsibleTools(){
|
||||
var form=document.getElementById('asktam-mcp-tools-form');
|
||||
if(!form)return;
|
||||
var firstVisit=!localStorage.getItem(LSKEY);
|
||||
var state=loadState();
|
||||
var cats=form.querySelectorAll('.asktam-mcp-category');
|
||||
|
||||
@@ -70,8 +69,8 @@ function initCollapsibleTools(){
|
||||
caret.textContent='▾';
|
||||
header.insertBefore(caret,header.firstChild);
|
||||
}
|
||||
// Default: collapsed (keeps the page from rendering hundreds of cards at once)
|
||||
var collapsed=(id in state)?!!state[id]:true;
|
||||
// Default EXPANDED; only collapse if the user previously collapsed this category.
|
||||
var collapsed=(id in state)?!!state[id]:false;
|
||||
cat.classList.toggle('is-collapsed',collapsed);
|
||||
if(header && !header.dataset.collBound){
|
||||
header.dataset.collBound='1';
|
||||
@@ -83,7 +82,6 @@ function initCollapsibleTools(){
|
||||
});
|
||||
}
|
||||
});
|
||||
if(firstVisit){cats.forEach(function(cat){state[cat.getAttribute('data-category')||'']=true;});saveState(state);}
|
||||
|
||||
// Per-card minimize (hides description + slug for that one tool)
|
||||
form.querySelectorAll('.asktam-mcp-tool-card').forEach(function(card){
|
||||
|
||||
Reference in New Issue
Block a user