mirror of
https://github.com/vinta/awesome-python.git
synced 2026-05-09 22:53:49 +08:00
feat(website): mirror index layout on category pages
Add search input, filter chips, no-results block, and back-to-top button to category/group/subcategory pages. Pass filter_urls_json to all page types so tag-chip navigation works site-wide. Fix JS so filter-clear and no-results-clear redirect to / on non-index pages instead of trying to filter a non-existent local table. Remove the now-redundant .category-results CSS overrides. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+10
-4
@@ -341,6 +341,10 @@ tags.forEach(function (tag) {
|
||||
|
||||
if (filterClear) {
|
||||
filterClear.addEventListener("click", function () {
|
||||
if (!isIndexPage()) {
|
||||
window.location.href = "/";
|
||||
return;
|
||||
}
|
||||
activeFilter = null;
|
||||
applyFilters();
|
||||
});
|
||||
@@ -349,6 +353,10 @@ if (filterClear) {
|
||||
const noResultsClear = document.querySelector(".no-results-clear");
|
||||
if (noResultsClear) {
|
||||
noResultsClear.addEventListener("click", function () {
|
||||
if (!isIndexPage()) {
|
||||
window.location.href = "/";
|
||||
return;
|
||||
}
|
||||
if (searchInput) searchInput.value = "";
|
||||
activeFilter = null;
|
||||
applyFilters();
|
||||
@@ -451,10 +459,8 @@ if (backToTop) {
|
||||
) {
|
||||
activeSort = { col: sort, order: order };
|
||||
}
|
||||
if (isIndexPage()) {
|
||||
const matched = urlToFilter[location.pathname];
|
||||
if (matched) activeFilter = matched;
|
||||
}
|
||||
const matched = urlToFilter[location.pathname];
|
||||
if (matched) activeFilter = matched;
|
||||
if (q || activeFilter || sort) {
|
||||
sortRows();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user