diff options
| -rw-r--r-- | template/search_files.st | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/template/search_files.st b/template/search_files.st index 304c01d..88a3dab 100644 --- a/template/search_files.st +++ b/template/search_files.st @@ -2,6 +2,9 @@ <head> <title>dump.fm image search</title> $head()$ + <style> + img { max-width: 400px; max-height: 400px;} + </style> </head> <body> @@ -61,7 +64,7 @@ } } - function keyHandler(){ + function doSearch(){ term = jQuery("#search-query").val().trim() if (term.length < 3) { setMessage("search query too small") @@ -70,6 +73,12 @@ addScript(term) } } + + // only search every 500ms while someone is typing + function keyHandler(){ + if (keyHandler.timeout) clearTimeout(keyHandler.timeout); + keyHandler.timeout = setTimeout(doSearch, 250) + } jQuery("#search-query").keyup(keyHandler) |
