|
|
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-search",["uikit"],function(){return jQuery.UIkit.search||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){"use strict";var n=function(t,s){var o=e(t),a=this;o.data("search")||(this.autocomplete=new i.autocomplete(o,e.extend({},n.defaults,s)),this.autocomplete.dropdown.addClass("uk-dropdown-search"),this.autocomplete.input.on("keyup",function(){o[this.value?"addClass":"removeClass"]("uk-active")}).closest("form").on("reset",function(){this.value="",o.removeClass("uk-active")}),o.on("autocomplete-select",function(t,e){e.url?location.href=e.url:e.moreresults&&a.autocomplete.input.closest("form").submit()}),o.data("search",this))};return n.defaults={msgResultsHeader:"Search Results",msgMoreResults:"More Results",msgNoResults:"No results found",template:'<ul class="uk-nav uk-nav-search uk-autocomplete-results"> {{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}} {{#items && items.length}} {{~items}} <li data-url="{{!$item.url}}"> <a href="{{!$item.url}}"> {{$item.title}} {{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}} </a> </li> {{/items}} {{#msgMoreResults}} <li class="uk-nav-divider uk-skip"></li> <li class="uk-search-moreresults" data-moreresults="true"><a href="javascript:jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li> {{/msgMoreResults}} {{/end}} {{^items.length}} {{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}} {{/end}} </ul>',renderer:function(t){var e=this.options;this.dropdown.append(this.template({items:t.results||[],msgResultsHeader:e.msgResultsHeader,msgMoreResults:e.msgMoreResults,msgNoResults:e.msgNoResults})),this.show()}},i.search=n,e(document).on("focus.search.uikit","[data-uk-search]",function(){var t=e(this);t.data("search")||new n(t,i.Utils.options(t.attr("data-uk-search")))}),n});
|