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

- old
+ new

@@ -1,29 +1,47 @@ -/*! 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-form-password", ["uikit"], function(){ - return component || addon(jQuery, jQuery.UIkit); + return component || addon(UIkit); }); } -})(function($, UI){ +})(function(UI){ + "use strict"; + UI.component('formPassword', { defaults: { "lblShow": "Show", "lblHide": "Hide" }, + boot: function() { + // init code + UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) { + + var ele = UI.$(this); + + if (!ele.data("formPassword")) { + + e.preventDefault(); + + var obj = UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password"))); + ele.trigger("click"); + } + }); + }, + init: function() { var $this = this; this.on("click", function(e) { @@ -42,20 +60,7 @@ this.element.data("formPassword", this); } }); - // init code - UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) { - - var ele = $(this); - if (!ele.data("formPassword")) { - - e.preventDefault(); - - var obj = UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password"))); - ele.trigger("click"); - } - }); - return UI.formPassword; -}); \ No newline at end of file +});