You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.2 KiB
2 lines
1.2 KiB
6 years ago
|
(function(a,d){var e="bound.inputEvent",f="value.inputEvent",k="delegated.inputEvent",g="txtinput",n="input,textInput,propertychange,paste,cut,keydown,drop,".split(",").join(".inputEvent "),p=["focusin","mouseover","dragstart",""].join(".inputEvent "),q={TEXTAREA:d,INPUT:d},r={paste:d,cut:d,keydown:d,drop:d,textInput:d};a.event.special.txtinput={setup:function(h,d,o){function o(b){var c=b.target;window.clearTimeout(l);l=null;j||(b.type in r&&!l?l=window.setTimeout(function(){c.value!==a.data(c,f)&&(a(c).trigger(g),a.data(c,f,c.value))},0):"propertychange"==b.type?"value"==b.originalEvent.propertyName&&(a(c).trigger(g),a.data(c,f,c.value),j=!0,window.setTimeout(function(){j=!1},0)):(a(c).trigger(g),a.data(c,f,c.value),j=!0,window.setTimeout(function(){j=!1},0)))}var l,m,i=this,h=a(this),j=!1;i.tagName in q?((m=a.data(i,e)||0)||h.bind(n,o),a.data(i,e,++m),a.data(i,f,i.value)):h.bind(p,function(b){b=b.target;b.tagName in q&&!a.data(i,k)&&((m=a.data(b,e)||0)||b.bind(n,o),a.data(i,k,!0),a.data(b,e,++m),a.data(b,f,b.value))})},teardown:function(){var h=a(this);h.unbind(p);h.find("input, textarea").andSelf().each(function(){(bndCount=a.data(this,e,(a.data(this,e)||1)-1))||h.unbind(n)})}};a.fn.input=function(a){return a?this.bind(g,a):this.trigger(g)}})(jQuery);
|