/* jQWidgets v4.0.0 (2016-Jan) Copyright (c) 2011-2016 jQWidgets. License: http://jqwidgets.com/license/ */ (function(a){a.jqx.jqxWidget("jqxPasswordInput","",{});a.extend(a.jqx._jqxPasswordInput.prototype,{defineInstance:function(){var b={width:null,height:null,disabled:false,rtl:false,placeHolder:null,showStrength:false,showStrengthPosition:"right",maxLength:null,minLength:null,showPasswordIcon:true,strengthTypeRenderer:null,passwordStrength:null,changeType:null,localization:{passwordStrengthString:"Password strength",tooShort:"Too short",weak:"Weak",fair:"Fair",good:"Good",strong:"Strong",showPasswordString:"Show Password"},strengthColors:{tooShort:"rgb(170, 0, 51)",weak:"rgb(170, 0, 51)",fair:"rgb(255, 204, 51)",good:"rgb(45, 152, 243)",strong:"rgb(118, 194, 97)"}};a.extend(true,this,b);return b},createInstance:function(b){this.render()},render:function(){var e=this;var c=a.jqx.browser.browser;var b=a.jqx.browser.version;this._browserCheck=c!="msie"||(b!="7.0"&&b!="8.0");this.widgetID=e.element.id;var f=e.host;var d="Invalid input type. Please set the type attribute of the input element to password.";if(f.attr("type")!="password"){throw d}e._hidden=true;e._setTheme();e._setAttributes();e._showPassword();e._showStrength()},refresh:function(c){var b=this;if(c==true){return}b.removeHandler(b.host,"change.passwordinput"+b.widgetID);b.removeHandler(b.host,"focus.passwordinput"+b.widgetID);b.removeHandler(b.host,"blur.passwordinput"+b.widgetID);b.removeHandler(b.host,"click.passwordinput"+b.widgetID);b.removeHandler(a(window),"resize.passwordinput"+b.widgetID);b.removeHandler(b.host,"keyup.passwordinput"+b.widgetID);b.removeHandler(b.icon,"mousedown.passwordinput"+b.iconID);b.removeHandler(b.icon,"mouseup.passwordinput"+b.iconID);b.removeHandler(a(document),"mousedown.passwordinput"+b.iconID);b._setAttributes();b._setTheme();b._showPassword();b._showStrength()},val:function(d){var c=this,e=c.element.value,b="placeholder" in c.element;if(a.isEmptyObject(d)&&d!=""){if(!b&&e===c.placeHolder){e=""}return e}else{if(b&&d===e){return}if(!b){if(d===""){if(e!==c.placeHolder){c.element.value=c.placeHolder;c.host.attr("type","text")}return}else{c.host.attr("type","password")}}c.element.value=d;if(c.showStrength===true){c._evaluateStrength()}}},propertyChangedHandler:function(b,c,f,e){var d=this.host;if(c==="theme"){a.jqx.utilities.setTheme(f,e,b.host);return}if(c=="disabled"){if(b.disabled==true){b.host.attr("disabled","disabled");b.host.addClass(b.toThemeProperty("jqx-fill-state-disabled"))}else{b.host.removeAttr("disabled");b.host.removeClass(b.toThemeProperty("jqx-fill-state-disabled"))}return}if(c=="placeHolder"){if(this._browserCheck){if("placeholder" in this.element){d.attr("placeholder",this.placeHolder)}else{if(d.val()==""){d.attr("type","text");b.element.value=e}else{if(d.val()==f){b.element.value=e}}}}}else{this.refresh()}},resize:function(c,b){this.width=c;this.height=b;this.host.width(this.width);this.host.height(this.height)},_setAttributes:function(){var b=this;var c=b.host;c.width(b.width);c.height(b.height);if(b.maxLength){c.attr("maxlength",b.maxLength)}if(b.minLength){c.attr("minLength",b.minLength)}if(b.placeHolder&&b._browserCheck){if("placeholder" in b.element){c.attr("placeholder",b.placeHolder)}else{if(c.val()==""){c.attr("type","text");b.element.value=b.placeHolder}}}if(b.disabled==true){c.attr("disabled","disabled");c.addClass(this.toThemeProperty("jqx-fill-state-disabled"))}else{c.removeAttr("disabled");c.removeClass(b.toThemeProperty("jqx-fill-state-disabled"))}b.addHandler(c,"change.passwordinput"+b.widgetID,function(d){d.stopImmediatePropagation();d.preventDefault();d.stopPropagation();b.raiseEvent()});b.addHandler(c,"click.passwordinput"+b.widgetID,function(){if(b.showPasswordIcon&&b.icon){b.icon.show();b._positionIcon()}});b.interval=null;b.addHandler(c,"keydown.passwordinput"+b.widgetID,function(){b.changeType="keyboard";if(b.showPasswordIcon&&b.icon){if(b.interval){clearInterval(b.interval)}var d=0;b.interval=setInterval(function(){if(b.icon[0].style.display!="none"){b._positionIcon();d++;if(d>5){clearInterval(b.interval)}}else{clearInterval(b.interval)}},100)}});b.addHandler(c,"focus.passwordinput"+b.widgetID,function(){b._focused=true;b.host.addClass(b.toThemeProperty("jqx-fill-state-focus"));if(b.placeHolder&&b._browserCheck&&!("placeholder" in b.element)&&c.val()==b.placeHolder){c.val("");if(b._hidden==true){c.attr("type","password")}}if(b.val().length>0){if(b.showStrength==true){var d=c.jqxTooltip("content");if(d){c.jqxTooltip("open")}}}if(b.showPasswordIcon&&b.icon){b.icon.show();b._positionIcon()}});b.addHandler(c,"blur.passwordinput"+b.widgetID,function(){b._focused=false;b.host.removeClass(b.toThemeProperty("jqx-fill-state-focus"));if(b.placeHolder&&b._browserCheck&&!("placeholder" in b.element)&&c.val()==""){b.element.value=b.placeHolder;c.attr("type","text")}if(b.showPasswordIcon==true&&b._browserCheck){if(b.rtl==false){b.host.removeClass(b.toThemeProperty("jqx-passwordinput-password-icon-ltr"))}else{b.host.removeClass(b.toThemeProperty("jqx-passwordinput-password-icon-rtl"))}}if(b.showStrength==true){c.jqxTooltip("close")}if(b.showPasswordIcon&&b.icon){b.icon.hide()}})},destroy:function(){if(this.host.jqxTooltip){this.host.jqxTooltip("destroy")}this.host.remove()},_setTheme:function(){var c=this.host;var b=this;c.addClass(b.toThemeProperty("jqx-widget"));c.addClass(b.toThemeProperty("jqx-widget-content"));c.addClass(b.toThemeProperty("jqx-input"));c.addClass(b.toThemeProperty("jqx-rc-all"));if(b.rtl==true){c.addClass(b.toThemeProperty("jqx-rtl"));c.css("direction","rtl")}else{c.removeClass(b.toThemeProperty("jqx-rtl"));c.css("direction","ltr")}},_showPassword:function(){if(this.showPasswordIcon==true&&this._browserCheck){var f=this;this.iconID=this.widgetID+"-password-icon";a("").insertAfter(f.host);var e=a("#"+f.iconID);f.icon=e;e.addClass(f.toThemeProperty("jqx-passwordinput-password-icon"));e.attr("title",f.localization.showPasswordString);f._positionIcon();var d=function(){f.host.attr("type","password");f._hidden=true;e.attr("title",f.localization.showPasswordString)};var b=function(){if(f._hidden==false){d()}else{if(f._hidden==true){f.host.attr("type","text");f._hidden=false}}};var c=a.jqx.mobile.isTouchDevice();if(c){f.addHandler(f.icon,"mousedown.passwordinput"+f.iconID,function(g){b();return false})}else{f.addHandler(f.icon,"mousedown.passwordinput"+f.iconID,function(g){b();return false});f.addHandler(f.icon,"mouseup.passwordinput"+f.iconID,function(g){d();return false});f.addHandler(a(document),"mousedown.passwordinput"+f.iconID,function(g){if(f._focused){d()}})}}},_positionIcon:function(){var c=this.host.offset();var b=this.host.outerWidth();var d=this.host.outerHeight();if(this.rtl==true){this.icon.offset({top:parseInt(c.top+d/2-10/2),left:c.left+2})}else{this.icon.offset({top:parseInt(c.top+d/2-10/2),left:c.left+b-18})}},_showStrength:function(){var g=this;if(g.showStrength==true){if(g.host.jqxTooltip!=undefined){var e=g.widgetID+"Strength";var i=e+"Value";var c=e+"Indicator";var f;if(!g.strengthTypeRenderer){f="