Skip to content

Commit 4bbc32d

Browse files
committed
优化jsdoc 侧边栏搜索速度
1 parent 0e959f5 commit 4bbc32d

File tree

1 file changed

+13
-13
lines changed
  • build/jsdocs/template/static/scripts

1 file changed

+13
-13
lines changed

build/jsdocs/template/static/scripts/main.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,36 @@ $(function () {
77
var li = $('.sidebar-menu').find('li');
88
if (term.length === 0) {
99
li.each(function () {
10-
var el=$(this);
11-
el.show(0);
10+
var el = $(this);
11+
el.css("display", "block");
1212
el.removeClass('active');
13-
if (el.data('lte.pushmenu.active')) {
14-
el.addClass('active');
15-
}
1613
});
14+
$('.sidebar-menu').find('.itemMembers').hide();
1715
return;
1816
}
1917
var regexp = new RegExp(term, 'i');
20-
18+
2119
li.hide();
2220
li.removeClass('pushmenu-search-found', false);
2321
li.removeClass('active');
24-
var start = new Date();
2522
li.each(function () {
26-
var el=$(this);
23+
var el = $(this);
2724
if (el.text() && regexp.test(el.text())) {
28-
el.show();
25+
el.css("display", "block");
2926
el.addClass('pushmenu-search-found');
3027

3128
if (el.is('.treeview')) {
3229
el.addClass('active');
3330
}
3431

35-
var parent =el.parents('li').first();
32+
var parent = el.parents('li').first();
3633
if (parent.is('.treeview')) {
3734
parent.show();
3835
}
36+
var parentUl = el.parents('ul').first();
37+
if (parentUl.is('.treeview-menu')) {
38+
parentUl.show();
39+
}
3940

4041
}
4142
if (el.is('.header')) {
@@ -45,7 +46,7 @@ $(function () {
4546
});
4647

4748
$('.sidebar-menu li.pushmenu-search-found.treeview').each(function () {
48-
var el=$(this);
49+
var el = $(this);
4950
el.find('.pushmenu-search-found').show();
5051
el.find('.pushmenu-search-found').closest('.itemMembers').show();
5152
});
@@ -58,7 +59,6 @@ $(function () {
5859
$(this).parent().find('.itemMembers').toggle();
5960
});
6061
// // Show an item related a current documentation automatically
61-
debugger
6262
var filename = $('.page-title').data('filename').replace(/\.[a-z]+$/, '');
6363
var $currentItem = $('.main-sidebar .item[data-name="' + filename + '"]:eq(0)');
6464

@@ -83,6 +83,6 @@ $(function () {
8383
};
8484

8585
$(window).on('resize', _onResize);
86-
_onResize();
86+
_onResize();
8787
});
8888
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy