Files: 4bf486abd8728a501408a60a50a61755cfa49ae3 / example.html
2101 bytesRaw
1 | |
2 | <html> |
3 | <head> |
4 | <meta charset="utf-8"/> |
5 | <title>demo</title> |
6 | </head> |
7 | <body> |
8 | <div> |
9 | <input size="80" id="search" type="search" value="eli"/> |
10 | <input type="button" id="prev-btn" value="←"/> |
11 | <input type="button" id="next-btn" value="→"/> |
12 | </div> |
13 | |
14 | <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum |
15 | id mauris odio. Morbi efficitur tellus tellus, sit amet viverra nibh |
16 | condimentum ac. Morbi lectus urna, hendrerit sed dui sit amet, |
17 | efficitur porta orci. Curabitur et mauris varius, suscipit metus |
18 | luctus, rhoncus elit. Nulla in leo venenatis, aliquet justo ut, laoreet |
19 | ligula. Phasellus condimentum magna nec erat congue mollis. Duis sit |
20 | amet rhoncus felis. Aliquam quis bibendum ex, non aliquam nibh. Mauris |
21 | pretium, nibh in ullamcorper imperdiet, nibh arcu mollis felis, ac |
22 | efficitur lacus orci ac diam. Proin accumsan urna eu elementum aliquam. |
23 | Quisque dapibus sagittis nunc nec accumsan. Aenean mollis, risus eget |
24 | viverra aliquam, mi neque dignissim ipsum, nec congue odio nibh id |
25 | quam.</p> |
26 | |
27 | <p>Quisque a feugiat dolor. Nullam volutpat velit ut justo fringilla, |
28 | eu sodales magna commodo. Suspendisse posuere eget libero eu molestie. |
29 | Suspendisse elit eros, ultrices in bibendum sit amet, dignissim quis |
30 | justo. Praesent auctor massa non varius rhoncus. Pellentesque augue |
31 | elit, dictum in tortor eu, congue semper augue. Phasellus interdum |
32 | malesuada lorem.</p> |
33 | |
34 | <script src="index.js"></script> |
35 | <script> |
36 | var searcher = new Searcher(document.body); |
37 | var input = document.getElementById("search"); |
38 | searcher.setQuery(input.value); |
39 | input.onkeyup = function () { |
40 | searcher.setQuery(this.value); |
41 | }; |
42 | input.onkeypress = function (e) { |
43 | if (e.keyCode == 13) { // Enter |
44 | if (e.shiftKey) |
45 | searcher.selectPrev(); |
46 | else |
47 | searcher.selectNext(); |
48 | } |
49 | }; |
50 | document.getElementById("next-btn").onclick = function () { |
51 | searcher.selectNext(); |
52 | }; |
53 | document.getElementById("prev-btn").onclick = function () { |
54 | searcher.selectPrev(); |
55 | }; |
56 | </script> |
57 | </body> |
58 | </html> |
59 |
Built with git-ssb-web