!function(root,factory){if(typeof define==='function'&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){factory(require('jquery'));}else{factory(root.jQuery);}}(this,function($){'use strict';$.fn.typeWatch=function(o){var _edInputTypes=['TEXT','TEXTAREA','','TEL','SEARCH','URL','EMAIL','DATETIME','DATE','MONTH','WEEK','TIME','DATETIME-LOCAL','NUMBER','RANGE','DIV'];var options=$.extend({wait:750,callback:function(){},highlight:true,captureLength:2,allowSubmit:false,inputTypes:_edInputTypes},o);function checkElement(timer,override){var value=timer.type==='DIV'?jQuery(timer.el).html():jQuery(timer.el).val();if((value.length>=options.captureLength&value!=timer.text)||(override&&(value.length>=options.captureLength||options.allowSubmit))||(value.length==0&&timer.text)) {timer.text=value;timer.cb.call(timer.el,value);}};function watchElement(elem){var elementType=(elem.type||elem.nodeName).toUpperCase();if(jQuery.inArray(elementType,options.inputTypes)>=0){var timer={timer:null,text:(elementType==='DIV')?jQuery(elem).html():jQuery(elem).val(),cb:options.callback,el:elem,type:elementType,wait:options.wait};if(options.highlight&elementType!=='DIV') jQuery(elem).focus(function(){this.select();});var startWatch=function(evt){var timerWait=timer.wait;var overrideBool=false;var evtElementType=elementType;if(typeof evt.keyCode!='undefined'&evt.keyCode==13&&evtElementType!=='TEXTAREA'&&elementType!=='DIV'){timerWait=1;overrideBool=true;} var timerCallbackFx=function(){checkElement(timer,overrideBool)} clearTimeout(timer.timer);timer.timer=setTimeout(timerCallbackFx,timerWait);};jQuery(elem).on('keydown paste cut input',startWatch);}};return this.each(function(){watchElement(this);});};}); 52323