cesiumDoc.js
1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(function() {
var filterType = document.getElementById('filterType');
var classFilter = document.getElementById('ClassFilter');
var classList = document.getElementById('ClassList');
function filter() {
var value = classFilter.value.toLowerCase();
var items = classList.getElementsByTagName('li');
for (var i = 0; i < items.length; i++) {
var item = items[i];
var itemName = item.getAttribute('data-name') || '';
itemName = itemName.toLowerCase().replace(/\s/g, '');
if (itemName.indexOf(value) >= 0) {
item.style.display = '';
} else {
item.style.display = 'none';
}
}
}
classFilter.onkeyup = filter;
function getQueryParameter(name) {
var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var show = getQueryParameter('show');
if (show) {
document.getElementById('filterType').value = show;
}
var searchTerm = getQueryParameter('classFilter') || '';
classFilter.value = searchTerm;
filter();
function resetFilter() {
classFilter.value = '';
filter();
}
function updateMenuLinks() {
var links = classList.getElementsByTagName('a');
var searchTerm = classFilter.value;
for (var i = 0; i < links.length; i++) {
var link = links[i];
var prefix = link.href.split('?')[0];
link.href = prefix + (searchTerm === '' ? '' : '?classFilter=' + searchTerm);
}
}
var menuLinks = classList.getElementsByTagName('a');
for (var i = 0; i < menuLinks.length; i++) {
menuLinks[i].onclick = function() {
updateMenuLinks();
}
}
})();