|
16 | 16 | <!-- Typekit --> |
17 | 17 | <script type="text/javascript" src="http://use.typekit.com/jpd0pfm.js"></script> |
18 | 18 | <script type="text/javascript">try{Typekit.load();}catch(e){}</script> |
| 19 | + |
| 20 | + <!-- REDOX: add JS dependencies --> |
| 21 | + <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |
| 22 | + <script type="text/javascript" src="/js/typeahead.min.js"></script> |
| 23 | + <script type="text/javascript" src="/js/hogan.js"></script> |
| 24 | + <script type="text/javascript" src="/js/algoliasearch.min.js"></script> |
| 25 | + <!-- END REDOX: add JS dependencies --> |
| 26 | + |
| 27 | + <!-- REDOX: typeahead styling --> |
| 28 | + <style type="text/css"> |
| 29 | + .search-form-wrapper { |
| 30 | + width: 600px; |
| 31 | + margin: 30px auto; |
| 32 | + border: 3px solid #FF6600; |
| 33 | + } |
| 34 | + |
| 35 | + .search-form-wrapper h5 { |
| 36 | + color: #FF6600; |
| 37 | + font-size: 16px; |
| 38 | + margin-top: 10px; |
| 39 | + } |
| 40 | + |
| 41 | + .search-form { |
| 42 | + height: 40px; |
| 43 | + margin: 20px; |
| 44 | + } |
| 45 | + |
| 46 | + .twitter-typeahead, input.search-input, .tt-hint, .tt-query { |
| 47 | + width: 100%; |
| 48 | + height: 100%; |
| 49 | + font-size: 24px; |
| 50 | + } |
| 51 | + |
| 52 | + .tt-dropdown-menu { |
| 53 | + right: 0px !important; |
| 54 | + } |
| 55 | + |
| 56 | + .tt-suggestions { |
| 57 | + font-size: 18px; |
| 58 | + background: white; |
| 59 | + margin-top: 2px; |
| 60 | + padding: 5px 0; |
| 61 | + border: 1px solid rgba(0,0,0,.2); |
| 62 | + } |
| 63 | + |
| 64 | + .tt-suggestion .hit { |
| 65 | + margin: 10px; |
| 66 | + padding: 10px; |
| 67 | + } |
| 68 | + |
| 69 | + .tt-suggestion .hit .url { |
| 70 | + font-size: 12px; |
| 71 | + text-align: right; |
| 72 | + } |
| 73 | + |
| 74 | + .tt-suggestion .hit .title { |
| 75 | + margin: 0px; |
| 76 | + font-size: 18px; |
| 77 | + text-align: left; |
| 78 | + color: #080808; |
| 79 | + font-weight: normal; |
| 80 | + } |
| 81 | + |
| 82 | + .tt-suggestion .hit em { |
| 83 | + font-weight: bold; |
| 84 | + font-style: normal; |
| 85 | + } |
| 86 | + |
| 87 | + .tt-is-under-cursor { |
| 88 | + background: #FF6600; |
| 89 | + color: white; |
| 90 | + } |
| 91 | + </style> |
| 92 | + <!-- END REDOX: typeahead styling --> |
19 | 93 | </head> |
20 | 94 | <body> |
21 | 95 |
|
|
25 | 99 | </script> |
26 | 100 | <!-- ClickTale end of Top part --> |
27 | 101 |
|
| 102 | +<!-- REDOX: search bar --> |
| 103 | +<div class="search-form-wrapper"> |
| 104 | + <h5>Show HN: Search bar showing relevant and highlighted results after the first keystroke.</h5> |
| 105 | + <center>See <a href="">my commit to add this search-form</a></center> |
| 106 | + <div class="search-form"> |
| 107 | + <input type="text" name="q" class="search-input" placeholder="Search" id="blog-search-input" /> |
| 108 | + </div> |
| 109 | +</div> |
| 110 | +<hr /> |
| 111 | +<script> |
| 112 | + var apiClient = new AlgoliaSearch('{{ site.algolia.application_id }}', '{{ site.algolia.search_only_api_key }}'); |
| 113 | + var idx = apiClient.initIndex('{{ site.algolia.index_name }}'); |
| 114 | + function go() { |
| 115 | + idx.search($('#blog-search-input').val(), function(success, content) { |
| 116 | + if (success && content.hits.length > 0) { |
| 117 | + // for now, go to the first match |
| 118 | + window.location.href = content.hits[0].url; |
| 119 | + } |
| 120 | + }); |
| 121 | + } |
| 122 | + $('#blog-search-input').typeahead({ |
| 123 | + name: 'blogposts', |
| 124 | + remote: idx.getTypeaheadTransport(), |
| 125 | + engine: Hogan, |
| 126 | + template: '<div class="hit">' + |
| 127 | + '<div class="title">{{ "{{{" }} _highlightResult.title.value }}}</div>' + |
| 128 | + '<div class="url">{{ "{{{" }} _highlightResult.url.value }}}</div>' + |
| 129 | + '</div>' |
| 130 | + }).on('keydown', function(e) { |
| 131 | + if (e.which == 13) { |
| 132 | + go(); |
| 133 | + } |
| 134 | + }).on('typeahead:selected', function(e) { |
| 135 | + go(); |
| 136 | + }).focus(); |
| 137 | +</script> |
| 138 | +<!-- END REDOX: search bar --> |
| 139 | + |
28 | 140 | <div class="site"> |
29 | 141 | <div class="title"> |
30 | 142 | <a href="/">Tom Preston-Werner</a> |
|
56 | 168 | </div> |
57 | 169 | </div> |
58 | 170 |
|
59 | | -<a href="http://github.com/mojombo"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" /></a> |
| 171 | +<a href="http://github.com/redox/mojombo.github.io"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" /></a> |
60 | 172 |
|
61 | 173 | <!-- ClickTale Bottom part --> |
62 | 174 | <div id="ClickTaleDiv" style="display: none;"></div> |
|
0 commit comments