diff options
Diffstat (limited to 'static/functions/jquery.autocomplete.js')
-rw-r--r-- | static/functions/jquery.autocomplete.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/static/functions/jquery.autocomplete.js b/static/functions/jquery.autocomplete.js index 3bbf9ba..d7fd96a 100644 --- a/static/functions/jquery.autocomplete.js +++ b/static/functions/jquery.autocomplete.js @@ -180,6 +180,7 @@ that.el.on('blur.autocomplete', function () { that.onBlur(); }); that.el.on('focus.autocomplete', function () { that.fixPosition(); }); that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); + that.el.on('paste.autocomplete', function () { that.onPaste(); }); }, onBlur: function () { @@ -355,7 +356,7 @@ that.findBestHint(); if (that.options.deferRequestBy > 0) { // Defer lookup in case when value changes very quickly: - that.onChangeInterval = setInterval(function () { + that.onChangeInterval = setTimeout(function () { that.onValueChange(); }, that.options.deferRequestBy); } else { @@ -364,6 +365,23 @@ } }, + onPaste: function () { + var that = this; + + if (that.disabled) { + return; + } + + clearInterval(that.onChangeInterval); + + setTimeout(function () { + if (that.currentValue !== that.el.val()) { + that.findBestHint(); + that.onValueChange(); + } + }, 100); + }, + onValueChange: function () { var that = this, q; |