Sha256: e77f309ea41dde9a0d34099aedfc940fc7d401d1ddc1eee78b42b98062948034
Contents?: true
Size: 1.41 KB
Versions: 2
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dta_rapid-1.4.0 | _includes/lists/suggestion-search.html |
dta_rapid-1.3.11 | _includes/lists/suggestion-search.html |