Sha256: d63c7da6585b776c1bc3c09de4ed50850eaeada5b11c70a707fb425df5a1d129
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
<div id="suggestion-search" class="suggestion-search"> <input class="uikit-text-input uikit-text-input--block suggestion-search__input" placeholder="{{ include.placeholder }}" type="text"> </div> <script type="text/javascript"> document.addEventListener("DOMContentLoaded", function(e) { var getSearchTermsFromTokensAndDescription = function(obj) { return obj.tokens.concat(obj.shortDescription.split(' ')) }; var data = new Bloodhound({ datumTokenizer: getSearchTermsFromTokensAndDescription, queryTokenizer: Bloodhound.tokenizers.whitespace, local: searchResults }); $('.suggestion-search__input').typeahead({ classNames: { wrapper: 'suggestion-search__root', menu: 'suggestion-search__menu' cursor: 'suggestion-search-item__highlighted' }, hint: true, highlight: true, minLength: 1 }, { name: 'data', source: data, display: 'shortDescription', limit: 5, templates: { suggestion: function(result) { return `<div role="option" aria-selected="false" class="suggestion-search__item"><a class="suggestion-search__link" href="${result.link}">${result.shortDescription}</a></div>`; }, } }); $('#suggestion-search .search-input').bind('typeahead:select', function(e, suggestion) { window.location.href = suggestion.link; }); }); </script>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dta_rapid-1.3.10 | _includes/lists/suggestion-search.html |