Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 69 lines (68 sloc) 2.666 kb
e26da32 @tmcw Works
authored
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>DC Municipal Regulations</title>
1909c49 @tmcw Reorganize, write.
authored
5 <link href='css/reset.css' type='text/css' rel='stylesheet' />
6 <link href='css/style.css' type='text/css' rel='stylesheet' />
e26da32 @tmcw Works
authored
7 </head>
8 <body>
89c2c76 @tmcw Update style
authored
9 <div class='left'>
10 <div class='header'>
11 <h1>DC Municipal Regulations</h1>
1909c49 @tmcw Reorganize, write.
authored
12 <p>This is an <em>unofficial</em> version of the Washington, DC
89c2c76 @tmcw Update style
authored
13 municipal regulations.</p>
14 </div>
e26da32 @tmcw Works
authored
15 <form action='POST'>
1909c49 @tmcw Reorganize, write.
authored
16 <input type='text' id='search' placeholder='search' autofocus />
e26da32 @tmcw Works
authored
17 </form>
1909c49 @tmcw Reorganize, write.
authored
18 <div id='autocomplete'>
19 </div>
89c2c76 @tmcw Update style
authored
20 </div>
21 <div class='right'>
22 <div id='output'></div>
23 </div>
1909c49 @tmcw Reorganize, write.
authored
24 <script src='js/jquery.js'></script>
25 <script src='js/search.js'></script>
e26da32 @tmcw Works
authored
26 <script>
27 var indexes = {}, titles;
28 $.getJSON('titles.json', function(o) {
29 titles = o;
30 });
31 var $output = $('#output');
1909c49 @tmcw Reorganize, write.
authored
32 var $autocomplete = $('#autocomplete');
33 var s = search();
34 $('#search').keyup(function(e) {
35 $autocomplete.empty();
36 s.autocomplete(this.value, function(results) {
37 $autocomplete.empty();
38 for (var i = 0; i < results.length; i++) {
39 var a = document.createElement('a');
40 a.innerHTML = results[i];
41 a.className = 'autocomplete-option';
42 a.onclick = function() {
43 var s = $('#search').val();
44 var terms = s.split(/\s+/);
45 if (!terms) return;
46 terms[terms.length - 1] = this.innerHTML;
47 $('#search').val(terms.join(' ')).keyup().focus();
48 }
49 $autocomplete[0].appendChild(a);
50 }
51 });
52 });
53 $('#search').keyup(function(e) {
54 s.query(this.value, function(results) {
55 $output.empty();
56 for (var i = 0; i < results.length; i++) {
57 var h3 = document.createElement('h3');
58 var a = document.createElement('a');
59 a.href = 'text/' + results[i].id + '.txt'
60 a.innerHTML = results[i].title;
61 h3.appendChild(a);
62 $output[0].appendChild(h3);
e26da32 @tmcw Works
authored
63 }
1909c49 @tmcw Reorganize, write.
authored
64 });
e26da32 @tmcw Works
authored
65 });
66 </script>
67 </body>
68 </html>
Something went wrong with that request. Please try again.