/*! keypress-log - v1.0.0 - 2016-03-08 * https://github.com/xtratio/jquery-keypress-log * Copyright (c) 2016 xtratio; Licensed MIT */ !function(a,b,c,d){"use strict";function e(b,c){this.$element=a(b),this.options=a.extend({},h,c),this._defaults=h,this._name=g,this._keysLog="",this._init()}function f(a){return null===a.which?a.keyCode<32?null:String.fromCharCode(a.keyCode):0!==a.which&&0!==a.charCode?a.which<32?null:String.fromCharCode(a.which):null}var g="keyPressLog",h={keysLimit:0};a.extend(e.prototype,{_init:function(){this._bind()},get:function(){return this._keysLog},_bind:function(){var b=this,c=b.options;a(b.$element).off("keypress."+g).on("keypress."+g,function(d){var e=f(d);if(null!==e){var h=a.Event("logChange."+g);if(b.$element.trigger(h,{"char":e}),h.isDefaultPrevented())return;c.keysLimit&&b._keysLog.length+1>parseInt(c.keysLimit)?b._keysLog=e:b._keysLog+=e;var i=a.Event("logChanged."+g);b.$element.trigger(i,{"char":e,log:b._keysLog})}})},destroy:function(){this.$element.off("keypress."+g),this.$element.data(g,null)}}),a.fn[g]=function(b){this.each(function(){var c=a(this),d=c.data(g);d||c.data(g,d=new e(this,"object"==typeof b&&b)),"string"!=typeof b||b.startsWith("_")||d[b].call(d)})}}(jQuery,window,document);