You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+33-4
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,11 @@ Adds "Ctrl+F" find box to highlight text in the DOM
17
17
findInNw.initialize();
18
18
</script>
19
19
```
20
-
1. Use `CTRL+F` and `ESC` to show/hide the search box
20
+
1. Use `CTRL+F` to display and give focus to the search box
21
+
1. After typing, press `ENTER` to go to highlight/scroll to the next match.
22
+
1. Use `TAB` to navigate to the "previous", "next", and "close" buttons.
23
+
1. Use `ENTER` or `SPACE` to activate a button when focused.
24
+
1. User `ESC` to hide the search box and return focus to the body
21
25
22
26
23
27
@@ -45,6 +49,11 @@ This is used to programmitcally hide the search box. `ESC` will still hide it to
45
49
This is used to programmitcally find text.
46
50
47
51
52
+
### `findInNw.highlightNext();` and `findInNw.highlightPrevious();`
53
+
54
+
This will highlight and scroll to the next or previous match.
55
+
56
+
48
57
### `findInNw.clearTokens();`
49
58
50
59
This is used to remove all the highlighted tokens.
@@ -57,12 +66,22 @@ This is used to remove all the highlighted tokens.
57
66
58
67
### Highlight tokens
59
68
60
-
All highlight tokens of matching searched text will be wrapped in a `<markclass="find-in-nw-token">searched text</mark>`. You can customize this by targeting the following
69
+
All highlight tokens of matching searched text will be wrapped in a `<markclass="find-in-nw-token">searched text</mark>`.
70
+
71
+
They will also contain a `data-find-in-nw-position="4"` data attribute, the number correlates to a zero-based index of all matches.
72
+
73
+
As you navigate from one match to the next, the currently selected match will have a class of `.find-in-nw-current-token`.
74
+
75
+
You can customize this by targeting the following
61
76
62
77
```css
63
78
mark.find-in-nw-token {
64
79
background-color: #00F;
65
80
}
81
+
82
+
mark.find-in-nw-current-token {
83
+
background-color: #38D878;
84
+
}
66
85
```
67
86
68
87
@@ -77,10 +96,20 @@ Each element of the search box is styled by targeting a class. They also all hav
77
96
/* The input field you type in */
78
97
#find-in-nw-input {}
79
98
80
-
/* The count of matching highlighted items */
99
+
/* The current selected match number. Ex: The number 1 in "1/5" */
100
+
#find-in-nw-current {}
101
+
102
+
/* The separator between the current and count. Ex: The slash (/) in "1/5" */
103
+
#find-in-nw-of {}
104
+
105
+
/* The count of matching highlighted items. Ex: The number 5 in "1/5" */
Copy file name to clipboardexpand all lines: dev.html
+1-1
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@
84
84
85
85
Quisque vel semper orci. Praesent sit amet tempor dolor. Sed eu ipsum vel justo maximus cursus nec sed orci. Nullam sagittis urna enim, eget egestas leo pretium quis. Etiam leo justo, semper vitae erat at, commodo vulputate massa. Suspendisse non gravida velit. Morbi commodo dignissim lacus, id laoreet risus. Vestibulum aliquam dapibus turpis quis pharetra. Ut eget ullamcorper magna. Donec et volutpat enim, a elementum lectus. Maecenas a porta turpis, nec venenatis odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
86
86
87
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque mi justo, dapibus eget risus at, dignissim eleifend neque. Pellentesque consequat lacus nec quam auctor, vel euismod arcu pharetra. Duis eget hendrerit justo. Nam sit amet lectus gravida, auctor diam eu, dapibus mauris. Mauris facilisis sapien commodo odio pulvinar, quis venenatis sapien posuere. Aenean nec egestas ipsum. Suspendisse cursus sed elit id consectetur. Fusce volutpat porta odio sed convallis. Proin faucibus sed felis vitae commodo. Suspendisse consequat eget mi ut accumsan. Nulla fermentum ligula eget tempus fermentum. Ut vel libero mollis, consequat ligula non, posuere ante. Etiam diam massa, tempus ut dignissim at, ultrices non urna.
87
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque mi justo, dapibus eget risus at, dignissim eleifend neque. Pellentesque consequat lacus nec quam auctor, vel euismod arcu pharetra. Duis eget hendrerit justo. Nam sit amet lectus gravida, auctor diam eu, dapibus mauris. Mauris dolore facilisis sapien commodo odio pulvinar, quis venenatis sapien posuere. Aenean nec egestas ipsum. Suspendisse cursus sed elit id consectetur. Fusce volutpat porta odio sed convallis. Proin faucibus sed felis vitae commodo. Suspendisse consequat eget mi ut accumsan. Nulla fermentum ligula eget tempus fermentum. Ut vel libero mollis, consequat ligula non, posuere ante. Etiam diam massa, tempus ut dignissim at, ultrices non urna.
88
88
89
89
Pellentesque luctus rutrum enim, ac euismod lacus fermentum vel. In egestas non massa eget mollis. Mauris auctor vitae neque in lacinia. Donec lorem est, eleifend ut ipsum eu, euismod laoreet justo. Maecenas id viverra quam, nec ullamcorper enim. Duis turpis nisl, laoreet vitae dui ac, elementum aliquet nisl. Vivamus gravida sodales volutpat. Donec aliquet massa id interdum eleifend. Maecenas eu egestas lectus, nec venenatis tortor. Suspendisse vel rutrum ligula. Maecenas blandit tincidunt dolor, vel imperdiet ligula semper ullamcorper. Maecenas a lectus elit. Integer a quam ornare, sollicitudin risus at, finibus mi.
0 commit comments