bowser 2.5.3 → 2.7.0

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.
@@ -1,83 +0,0 @@
1
-
2
- var searchAttr = 'data-search-mode';
3
- function contains(a,m){
4
- return (a.textContent || a.innerText || "").toUpperCase().indexOf(m) !== -1;
5
- };
6
-
7
- //on search
8
- document.getElementById("nav-search").addEventListener("keyup", function(event) {
9
- var search = this.value.toUpperCase();
10
-
11
- if (!search) {
12
- //no search, show all results
13
- document.documentElement.removeAttribute(searchAttr);
14
-
15
- document.querySelectorAll("nav > ul > li:not(.level-hide)").forEach(function(elem) {
16
- elem.style.display = "block";
17
- });
18
-
19
- if (typeof hideAllButCurrent === "function"){
20
- //let's do what ever collapse wants to do
21
- hideAllButCurrent();
22
- } else {
23
- //menu by default should be opened
24
- document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
25
- elem.style.display = "block";
26
- });
27
- }
28
- } else {
29
- //we are searching
30
- document.documentElement.setAttribute(searchAttr, '');
31
-
32
- //show all parents
33
- document.querySelectorAll("nav > ul > li").forEach(function(elem) {
34
- elem.style.display = "block";
35
- });
36
- //hide all results
37
- document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
38
- elem.style.display = "none";
39
- });
40
- //show results matching filter
41
- document.querySelectorAll("nav > ul > li > ul a").forEach(function(elem) {
42
- if (!contains(elem.parentNode, search)) {
43
- return;
44
- }
45
- elem.parentNode.style.display = "block";
46
- });
47
- //hide parents without children
48
- document.querySelectorAll("nav > ul > li").forEach(function(parent) {
49
- var countSearchA = 0;
50
- parent.querySelectorAll("a").forEach(function(elem) {
51
- if (contains(elem, search)) {
52
- countSearchA++;
53
- }
54
- });
55
-
56
- var countUl = 0;
57
- var countUlVisible = 0;
58
- parent.querySelectorAll("ul").forEach(function(ulP) {
59
- // count all elements that match the search
60
- if (contains(ulP, search)) {
61
- countUl++;
62
- }
63
-
64
- // count all visible elements
65
- var children = ulP.children
66
- for (i=0; i<children.length; i++) {
67
- var elem = children[i];
68
- if (elem.style.display != "none") {
69
- countUlVisible++;
70
- }
71
- }
72
- });
73
-
74
- if (countSearchA == 0 && countUl === 0){
75
- //has no child at all and does not contain text
76
- parent.style.display = "none";
77
- } else if(countSearchA == 0 && countUlVisible == 0){
78
- //has no visible child and does not contain text
79
- parent.style.display = "none";
80
- }
81
- });
82
- }
83
- });