git ssb

0+

cel / text-node-searcher



Tree: a7f543f01ad4471c001726e7a96a4048c7824f8e

Files: a7f543f01ad4471c001726e7a96a4048c7824f8e / example.html

2355 bytesRaw
1<!doctype html>
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"/>
10 <input type="button" id="prev-btn" value="&larr;"/>
11 <input type="button" id="next-btn" value="&rarr;"/>
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>
35 function toStr(obj) {
36 var str = '';
37 for (var key in obj) {
38 if (str) str += ', ';
39 str += key + ': ' + obj[key];
40 }
41 return '{' + str + '}';
42 }
43 window.addEventListener("error", function (e) {
44 log(e.message, e.filename, e.lineno + ":" + e.colno)
45 }, false);
46 // document.body.appendChild(document.createElement("blockquote"))
47 // .appendChild(document.createTextNode(e.toString()));
48 </script>
49 <script src="index.js"></script>
50 <script>
51 var searcher = new Searcher(document.body);
52 searcher.setQuery("dolor");
53 document.getElementById("search").onkeypress = function () {
54 searcher.setQuery(this.value);
55 // searcher.highlight();
56 };
57 document.getElementById("next-btn").onclick = function () {
58 searcher.selectNext();
59 };
60 document.getElementById("prev-btn").onclick = function () {
61 searcher.selectPrev();
62 };
63 </script>
64 </body>
65</html>
66

Built with git-ssb-web