@okjavis/nodebb-theme-javis 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"static/lib/theme.js"
|
|
19
19
|
],
|
|
20
20
|
"modules": {
|
|
21
|
-
"../admin/plugins/javis.js": "public/admin.js"
|
|
21
|
+
"../admin/plugins/javis.js": "public/admin.js",
|
|
22
|
+
"forum/search": "public/src/client/search.js"
|
|
22
23
|
},
|
|
23
24
|
"templates": "templates",
|
|
24
25
|
"screenshot": "screenshot.png",
|
|
@@ -257,12 +257,14 @@ define('forum/search', [
|
|
|
257
257
|
categoryFilter.init(dropdownEl, {
|
|
258
258
|
selectedCids: _selectedCids,
|
|
259
259
|
updateButton: false, // prevent categoryFilter module from updating the button
|
|
260
|
+
states: [], // FIX: Disable watch states to remove "Watched categories" from dropdown
|
|
261
|
+
showLinks: true, // FIX: Show regular category links
|
|
260
262
|
onSelect: function (data) {
|
|
261
|
-
// Update selectedCids immediately when a category is clicked
|
|
263
|
+
// FIX: Update selectedCids immediately when a category is clicked
|
|
262
264
|
ajaxify.data.selectedCids = data.selectedCids;
|
|
263
265
|
selectedCids = data.selectedCids;
|
|
264
266
|
|
|
265
|
-
// Trigger search immediately
|
|
267
|
+
// FIX: Trigger search immediately without requiring additional clicks
|
|
266
268
|
const searchFiltersNew = getSearchDataFromDOM();
|
|
267
269
|
if (JSON.stringify(searchFilters) !== JSON.stringify(searchFiltersNew)) {
|
|
268
270
|
searchFilters = searchFiltersNew;
|
package/static/lib/theme.js
CHANGED
|
@@ -8,10 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
var carouselCounter = 0;
|
|
10
10
|
|
|
11
|
+
// Patch search module to fix category filter
|
|
12
|
+
$(window).on('action:ajaxify.end', function(ev, data) {
|
|
13
|
+
if (data.url && data.url.startsWith('search')) {
|
|
14
|
+
patchSearchCategoryFilter();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
11
18
|
// Theme initialization
|
|
12
19
|
$(document).ready(function() {
|
|
13
20
|
console.log('JAVIS Community Theme initialized');
|
|
14
21
|
|
|
22
|
+
// Patch search if we're already on the search page
|
|
23
|
+
if (window.location.pathname.includes('/search')) {
|
|
24
|
+
setTimeout(patchSearchCategoryFilter, 500);
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
// Initialize sidebar toggle handler
|
|
16
28
|
initSidebarToggle();
|
|
17
29
|
|
|
@@ -658,6 +670,64 @@
|
|
|
658
670
|
});
|
|
659
671
|
}
|
|
660
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Patch search page category filter to:
|
|
675
|
+
* 1. Remove "Watched categories" from dropdown
|
|
676
|
+
* 2. Auto-apply category filter on selection (no additional click needed)
|
|
677
|
+
*/
|
|
678
|
+
function patchSearchCategoryFilter() {
|
|
679
|
+
var $categoryFilter = $('[component="search/filters"] [component="category/filter"]');
|
|
680
|
+
if (!$categoryFilter.length || $categoryFilter.attr('data-javis-patched')) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
$categoryFilter.attr('data-javis-patched', 'true');
|
|
684
|
+
|
|
685
|
+
console.log('JAVIS: Patching search category filter');
|
|
686
|
+
|
|
687
|
+
// Function to remove "Watched categories" from the dropdown
|
|
688
|
+
function removeWatchedCategories() {
|
|
689
|
+
// Method 1: Remove by data-cid="watched"
|
|
690
|
+
var $watchedItem = $categoryFilter.find('[component="category/list"] li[data-cid="watched"]');
|
|
691
|
+
if ($watchedItem.length) {
|
|
692
|
+
$watchedItem.remove();
|
|
693
|
+
console.log('JAVIS: Removed "Watched categories" by data-cid');
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Method 2: Remove by text content (fallback)
|
|
698
|
+
$categoryFilter.find('[component="category/list"] li').each(function() {
|
|
699
|
+
var $li = $(this);
|
|
700
|
+
var text = $li.text().toLowerCase().trim();
|
|
701
|
+
if (text.includes('watched') && text.includes('categor')) {
|
|
702
|
+
$li.remove();
|
|
703
|
+
console.log('JAVIS: Removed "Watched categories" by text match');
|
|
704
|
+
return false; // break the loop
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// Remove immediately
|
|
710
|
+
removeWatchedCategories();
|
|
711
|
+
|
|
712
|
+
// Also remove when dropdown opens (in case categories are loaded dynamically)
|
|
713
|
+
$categoryFilter.on('shown.bs.dropdown', function() {
|
|
714
|
+
setTimeout(removeWatchedCategories, 100);
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// Add immediate search trigger on category selection
|
|
718
|
+
$categoryFilter.on('click', '[component="category/list"] [data-cid]', function(e) {
|
|
719
|
+
var $item = $(this);
|
|
720
|
+
var cid = $item.attr('data-cid');
|
|
721
|
+
|
|
722
|
+
// Let the original handler update the selection state first
|
|
723
|
+
setTimeout(function() {
|
|
724
|
+
// Trigger the search by closing the dropdown (which triggers the existing onHidden handler)
|
|
725
|
+
$categoryFilter.find('.dropdown-toggle').dropdown('hide');
|
|
726
|
+
console.log('JAVIS: Auto-triggering search for category:', cid);
|
|
727
|
+
}, 50);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
|
|
661
731
|
/**
|
|
662
732
|
* Initialize immediate category filter navigation on feed page
|
|
663
733
|
* When a category is selected, navigate immediately instead of waiting for dropdown close
|