tt-rss or tiny tiny rss. How keep colapsed category 'Special' except user click…
- User
tt-rss or tiny tiny rss. How keep colapsed category 'Special' except user click expand(uncolapse)?
- Assistant
tt-rss or tiny tiny rss. How keep colapsed category 'Special' except user click expand(uncolapse)?
In Tiny Tiny RSS (tt-rss), categories (labels/groups in the sidebar) generally remember their expanded or collapsed state on a per-user basis using client-side localStorage or cookies, or sometimes server-side user preferences, depending on the version and configuration.
Problem: You want the category named "Special" to be collapsed by default upon loading tt-rss and remain collapsed unless the user clicks to expand it (then keep it expanded in that session or subsequent visits).
localStorage (keyed by user/session)Since the state is stored in localStorage, you can override the default by injecting JavaScript code to force the category "Special" to be collapsed on page load, unless the user has previously expanded it.
Use browser inspector to find the DOM element corresponding to category "Special". Usually categories have IDs like:
category_<categoryID>
or classes like:
category
with the category name inside.
Expand/collapse state is often saved in a localStorage key like tt-rss-tree-state.
This key contains a JSON structure keyed by category IDs, with booleans indicating collapse/expand.
Create a small user script or inject JavaScript via browser extension, or modify the tt-rss template (if you self-host) to include JavaScript that on load:
document.addEventListener('DOMContentLoaded', function () {
const STORAGE_KEY = 'tt-rss-tree-state';
// Load current saved state
let treeState = localStorage.getItem(STORAGE_KEY);
let state = treeState ? JSON.parse(treeState) : {};
// Find the category ID for "Special"
// You have to replace <categoryID> below.
// For example, if your Special category id is 5:
const specialCatId = 5;
// If no record or currently expanded (= true), then collapse it
if (!state.hasOwnProperty(specialCatId) || state[specialCatId]) {
state[specialCatId] = false; // false means collapsed
// Save updated state back
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
// Optionally, force UI collapse of the category now
// Get the category element
const catEl = document.getElementById(`category_${specialCatId}`);
if (catEl && catEl.classList.contains('expanded')) {
// Simulate a click to collapse (if ui events are set up)
catEl.querySelector('.category-header').click();
}
}
});
<li> or <div> for category will have an id like category_5 where 5 is the id.Or verify in your backend database table ttrss_categories for the category named "Special".
If you want this to be hardcoded on the server:
./js/classes/EntryRenderer.js or the PHP templates).localStorage key tt-rss-tree-state.If you want, I can help you write a complete userscript or provide instructions for your tt-rss version! Just let me know.
Not yet included in a published release.