Sha256: e9bf979f3f73428da84b2d75c311edb317d9835f7a4f510fc08e1ec8bba4e935
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
<div class="suggestion-search"> <label class="suggestion-search__icon" for="suggestion-search"> <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 12 12"><g class="suggestion-search__svg" stroke-width="2" fill="none"><path d="M11.29 11.71l-4-4"/><circle cx="5" cy="5" r="4"/></g></svg> </label> <input class="uikit-text-input uikit-text-input--block suggestion-search__input" placeholder="{{ include.placeholder }}" id="suggestion-search" 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__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.4.1 | _includes/lists/suggestion-search.html |