vendor/assets/javascripts/uikit/components/search.js in uikit-sass-rails-1.3.0 vs vendor/assets/javascripts/uikit/components/search.js in uikit-sass-rails-1.4.0

- old
+ new

@@ -1,21 +1,21 @@ -/*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(addon) { var component; - if (jQuery && jQuery.UIkit) { - component = addon(jQuery, jQuery.UIkit); + if (window.UIkit) { + component = addon(UIkit); } if (typeof define == "function" && define.amd) { define("uikit-search", ["uikit"], function(){ - return component || addon(jQuery, jQuery.UIkit); + return component || addon(UIkit); }); } -})(function($, UI){ +})(function(UI){ "use strict"; UI.component('search', { defaults: { @@ -50,10 +50,22 @@ this.dropdown.append(this.template({"items":data.results || [], "msgResultsHeader":opts.msgResultsHeader, "msgMoreResults": opts.msgMoreResults, "msgNoResults": opts.msgNoResults})); this.show(); } }, + boot: function() { + + // init code + UI.$html.on("focus.search.uikit", "[data-uk-search]", function(e) { + var ele =UI.$(this); + + if (!ele.data("search")) { + var obj = UI.search(ele, UI.Utils.options(ele.attr("data-uk-search"))); + } + }); + }, + init: function() { var $this = this; this.autocomplete = UI.autocomplete(this.element, this.options); @@ -64,26 +76,17 @@ }).closest("form").on("reset", function(){ $this.value=""; $this.element.removeClass("uk-active"); }); - this.on('uk.autocomplete.select', function(e, data) { + this.on('selectitem.uk.autocomplete', function(e, data) { if (data.url) { location.href = data.url; } else if(data.moreresults) { $this.autocomplete.input.closest('form').submit(); } }); this.element.data("search", this); } }); - - // init code - UI.$html.on("focus.search.uikit", "[data-uk-search]", function(e) { - var ele = $(this); - - if (!ele.data("search")) { - var obj = UI.search(ele, UI.Utils.options(ele.attr("data-uk-search"))); - } - }); -}); \ No newline at end of file +});