PHP Classes

File: source/asset/assets/js/jquery.inputlimiter.1.3.1.min.js

Recommend this page to a friend!
  Classes of ask sa sa   Rimau waf   source/asset/assets/js/jquery.inputlimiter.1.3.1.min.js   Download  
File: source/asset/assets/js/jquery.inputlimiter.1.3.1.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Rimau waf
Application to configure Web server module options
Author: By
Last change:
Date: 1 year ago
Size: 3,027 bytes
 

Contents

Class file image Download
!function(a){a.fn.inputlimiter=function(b){{var c=a.extend({},a.fn.inputlimiter.defaults,b);a(this)}c.boxAttach&&!a("#"+c.boxId).length&&(a("<div/>").appendTo("body").attr({id:c.boxId,"class":c.boxClass}).css({position:"absolute"}).hide(),a.fn.bgiframe&&a("#"+c.boxId).bgiframe());var d=function(){var b=a(this),d=g(b.val());!c.allowExceed&&d>c.limit&&b.val(h(b.val())),c.boxAttach&&a("#"+c.boxId).css({width:b.outerWidth()-(a("#"+c.boxId).outerWidth()-a("#"+c.boxId).width())+"px",left:b.offset().left+"px",top:b.offset().top+b.outerHeight()-1+"px","z-index":2e3});var e=c.limit-d>0?c.limit-d:0,f=c.remTextFilter(c,e),i=c.limitTextFilter(c);if(c.limitTextShow){a("#"+c.boxId).html(f+" "+i);var j=a("<span/>").appendTo("body").attr({id:"19cc9195583bfae1fad88e19d443be7a","class":c.boxClass}).html(f+" "+i).innerWidth();a("#19cc9195583bfae1fad88e19d443be7a").remove(),j>a("#"+c.boxId).innerWidth()&&a("#"+c.boxId).html(f+"<br />"+i),a("#"+c.boxId).show()}else a("#"+c.boxId).html(f).show()},e=function(b){var d=g(a(this).val());if(!c.allowExceed&&d>c.limit){var e=b.ctrlKey||b.altKey||b.metaKey;if(!e&&b.which>=32&&b.which<=122&&this.selectionStart===this.selectionEnd)return!1}},f=function(){var b=a(this);if(count=g(b.val()),!c.allowExceed&&count>c.limit&&b.val(h(b.val())),c.boxAttach)a("#"+c.boxId).fadeOut("fast");else if(c.remTextHideOnBlur){var d=c.limitText;d=d.replace(/\%n/g,c.limit),d=d.replace(/\%s/g,1===c.limit?"":"s"),a("#"+c.boxId).html(d)}},g=function(b){if("words"===c.limitBy.toLowerCase())return b.length>0?a.trim(b).replace(/\ +(?= )/g,"").split(" ").length:0;var d=b.length,e=b.match(/\n/g);return e&&c.lineReturnCount>1&&(d+=e.length*(c.lineReturnCount-1)),d},h=function(b){return"words"===c.limitBy.toLowerCase()?a.trim(b).replace(/\ +(?= )/g,"").split(" ").splice(0,c.limit).join(" ")+" ":b.substring(0,c.limit)};a(this).each(function(){var g=a(this);(!b||!b.limit)&&c.useMaxlength&&parseInt(g.attr("maxlength"))>0&&parseInt(g.attr("maxlength"))!=c.limit?g.inputlimiter(a.extend({},c,{limit:parseInt(g.attr("maxlength"))})):(!c.allowExceed&&c.useMaxlength&&"characters"===c.limitBy.toLowerCase()&&g.attr("maxlength",c.limit),g.unbind(".inputlimiter"),g.bind("keyup.inputlimiter",d),g.bind("keypress.inputlimiter",e),g.bind("blur.inputlimiter",f))})},a.fn.inputlimiter.remtextfilter=function(a,b){var c=a.remText;return 0===b&&null!==a.remFullText&&(c=a.remFullText),c=c.replace(/\%n/g,b),c=c.replace(/\%s/g,a.zeroPlural?1===b?"":"s":1>=b?"":"s")},a.fn.inputlimiter.limittextfilter=function(a){var b=a.limitText;return b=b.replace(/\%n/g,a.limit),b=b.replace(/\%s/g,a.limit<=1?"":"s")},a.fn.inputlimiter.defaults={limit:255,boxAttach:!0,boxId:"limiterBox",boxClass:"limiterBox",remText:"%n character%s remaining.",remTextFilter:a.fn.inputlimiter.remtextfilter,remTextHideOnBlur:!0,remFullText:null,limitTextShow:!0,limitText:"Field limited to %n character%s.",limitTextFilter:a.fn.inputlimiter.limittextfilter,zeroPlural:!0,allowExceed:!1,useMaxlength:!0,limitBy:"characters",lineReturnCount:1}}(jQuery);