X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Futil.js;h=035c59da00c8e5e2ecb601629c63f72c9a554c6b;hb=2836c4e561d6ded72086735cb59d737b3aa74aa7;hp=ea1dd18476f9920d3949f3d5a4db39586351431a;hpb=749367e12f9742d7fd5ee028230fefa627599125;p=quix0rs-gnu-social.git diff --git a/js/util.js b/js/util.js index ea1dd18476..035c59da00 100644 --- a/js/util.js +++ b/js/util.js @@ -85,6 +85,19 @@ var SN = { // StatusNet SN.U.Counter(form); }); + var delayedUpdate= function(e) { + // Cut and paste events fire *before* the operation, + // so we need to trigger an update in a little bit. + // This would be so much easier if the 'change' event + // actually fired every time the value changed. :P + window.setTimeout(function() { + SN.U.Counter(form); + }, 50); + }; + // Note there's still no event for mouse-triggered 'delete'. + NDT.bind('cut', delayedUpdate) + .bind('paste', delayedUpdate); + NDT.bind('keydown', function(e) { SN.U.SubmitOnReturn(e, form); });