summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-05-20 15:23:00 +0200
committerLars-Dominik Braun <lars@6xq.net>2015-05-20 15:23:00 +0200
commit827c4ad1aa0aad730c4ba74a3222d031cae53043 (patch)
tree7a8bf569ba804b3fbf6a95868fb3ef1afa84e377
parent0deefd4d9d7ce24cc193ec0db47152957fdd3da3 (diff)
downloadcomatose-827c4ad1aa0aad730c4ba74a3222d031cae53043.tar.gz
comatose-827c4ad1aa0aad730c4ba74a3222d031cae53043.tar.bz2
comatose-827c4ad1aa0aad730c4ba74a3222d031cae53043.zip
js: Debounce key press
-rw-r--r--data/script.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/data/script.js b/data/script.js
index 9d7354e..f76a862 100644
--- a/data/script.js
+++ b/data/script.js
@@ -1,3 +1,13 @@
+/*
+ * jQuery throttle / debounce - v1.1 - 3/7/2010
+ * http://benalman.com/projects/jquery-throttle-debounce-plugin/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
+
$(document).ready (function () {
function sortproto (by) {
var protolist = $('#protocols');
@@ -31,9 +41,9 @@ $(document).ready (function () {
$('#sort').change (function () {
sortproto ($(this).val ());
});
- $('#filter').keyup (function () {
+ $('#filter').keyup ($.debounce (100, function () {
filterproto ($(this).val ());
- });
+ }));
$('#protosort').show ();
sortproto ($('#sort').val ());
filterproto ($('#filter').val ());