2016-03-19 01:51:35 +00:00
|
|
|
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2016-01-30 20:28:43 +00:00
|
|
|
(function(addon) {
|
|
|
|
|
|
|
|
var component;
|
|
|
|
|
|
|
|
if (window.UIkit) {
|
|
|
|
component = addon(UIkit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof define == "function" && define.amd) {
|
|
|
|
define("uikit-form-password", ["uikit"], function(){
|
|
|
|
return component || addon(UIkit);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
})(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();
|
|
|
|
|
2016-03-19 01:51:35 +00:00
|
|
|
UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
|
2016-01-30 20:28:43 +00:00
|
|
|
ele.trigger("click");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
var $this = this;
|
|
|
|
|
|
|
|
this.on("click", function(e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
if($this.input.length) {
|
|
|
|
var type = $this.input.attr("type");
|
|
|
|
$this.input.attr("type", type=="text" ? "password":"text");
|
2016-03-19 01:51:35 +00:00
|
|
|
$this.element.html($this.options[type=="text" ? "lblShow":"lblHide"]);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
|
2016-03-19 01:51:35 +00:00
|
|
|
this.element.html(this.options[this.input.is("[type='password']") ? "lblShow":"lblHide"]);
|
|
|
|
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
this.element.data("formPassword", this);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return UI.formPassword;
|
|
|
|
});
|