summaryrefslogtreecommitdiff
path: root/template/search_files.st
diff options
context:
space:
mode:
authortim b <timb@camcompu.home>2010-06-10 07:33:17 -0700
committertim b <timb@camcompu.home>2010-06-10 07:33:17 -0700
commitc0422040dbb2a9f0025709f037f7f17362d862bc (patch)
tree08cb430d3368b7956043ec2c06d305324590f23e /template/search_files.st
parentbfb0e761c5d295c19ea2be1c31e57395ca9d28c9 (diff)
don't spam search requests
Diffstat (limited to 'template/search_files.st')
-rw-r--r--template/search_files.st11
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)