META-INF.resources.butterfaces-dist-js.butterfaces-maxlength.jquery.min.js Maven / Gradle / Ivy
!function(t){t.fn.butterMaxLength=function(e){return this.each(function(n,i){new ButterFaces.MaxLengthIndicator(t(i),e)})}}(jQuery);var ButterFaces;!function(t){var e=function(){function e(t,e){this.rootElement=t,this.options=e,this.valueElement=this.rootElement.find("textarea"),this.maxLengthElement=$("").addClass("butter-component-maxlength-counter"),this.maxLengthElement.insertAfter(this.valueElement),this.initializeComponent()}return e.prototype.initializeComponent=function(){console.log("ButterFaces.MaxLengthIndicator - initializeComponent"),this.hasInitialValidationError=this.rootElement.hasClass("has-error"),console.log(this.valueElement);var t=this;this.valueElement.on("focus blur keyup cut paste",function(){t.checkValue()}),this.checkValue()},e.prototype.checkValue=function(){var e=this.valueElement.val();if(!t.ObjectStatics.isNullOrUndefined(e)){console.log("ButterFaces.MaxLengthIndicator: updating maxlength value");var n=this.options.maxLength-e.length,i=t.String.format(this.options.maxLengthText,[n,this.options.maxLength]);this.maxLengthElement.text(i),this.hasInitialValidationError||(n<0?(this.rootElement.addClass("has-error"),this.valueElement.addClass("is-invalid")):(this.rootElement.removeClass("has-error"),this.valueElement.removeClass("is-invalid")))}},e}();t.MaxLengthIndicator=e}(ButterFaces||(ButterFaces={}));
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJ1dHRlcmZhY2VzLW1heGxlbmd0aC5qcXVlcnkudHMiXSwibmFtZXMiOlsiJCIsImZuIiwib3B0aW9ucyIsInRoaXMiLCJlYWNoIiwiaW5kZXgiLCJlbGVtZW50IiwiQnV0dGVyRmFjZXMiLCJNYXhMZW5ndGhJbmRpY2F0b3IiLCJqUXVlcnkiLCJyb290RWxlbWVudCIsInZhbHVlRWxlbWVudCIsImZpbmQiLCJtYXhMZW5ndGhFbGVtZW50IiwiYWRkQ2xhc3MiLCJpbnNlcnRBZnRlciIsImluaXRpYWxpemVDb21wb25lbnQiLCJwcm90b3R5cGU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ICAgICAgICAgICAgICAgICAgICB0aGlzLnJvb3RFbGVtZW50LmFkZENsYXNzKEVSUk9SX1NUWUxFX0NMQVNTKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmFsdWVFbGVtZW50LmFkZENsYXNzKElOVkFMSURfU1RZTEVfQ0xBU1MpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yb290RWxlbWVudC5yZW1vdmVDbGFzcyhFUlJPUl9TVFlMRV9DTEFTUyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZhbHVlRWxlbWVudC5yZW1vdmVDbGFzcyhJTlZBTElEX1NUWUxFX0NMQVNTKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn0iXX0=
© 2015 - 2024 Weber Informatics LLC | Privacy Policy