summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-05-17 22:17:19 +0200
committerandi <andi@splitbrain.org>2005-05-17 22:17:19 +0200
commit32c04430626da6095e213cfe6effafa577f9e3ab (patch)
tree0bf6fcbd9586d33ca2fc4bb5d478d58a11b59b6b /inc
parentf330ee2babdb79935de1bf551f415518ddb73de6 (diff)
downloadrpg-32c04430626da6095e213cfe6effafa577f9e3ab.tar.gz
rpg-32c04430626da6095e213cfe6effafa577f9e3ab.tar.bz2
some ajax quicksearch tweaking
added a half second delay before the suggstions appear, moved the postion to appear besides the browsers autocomplete... I'm still not sure if this is useful at all. darcs-hash:20050517201719-9977f-6e71a415dd08a84af38bd3643860beb7002088f5.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/template.php25
1 files changed, 22 insertions, 3 deletions
diff --git a/inc/template.php b/inc/template.php
index 0720a12f6..2baa6f77e 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -331,7 +331,7 @@ function tpl_actionlink($type,$pre='',$suf=''){
*/
function tpl_searchform(){
global $lang;
- print '<form action="'.wl().'" accept-charset="utf-8" class="search" onsubmit="return svchk()">';
+ print '<form action="'.wl().'" accept-charset="utf-8" class="search" name="search" onsubmit="return svchk()">';
//FIXME this should be moved somewhere else
?>
@@ -340,17 +340,36 @@ function tpl_searchform(){
ajax = new sack('<?=DOKU_BASE?>ajax.php');
ajax.AjaxFailedAlert = '';
- function ajax_qsearch(value){
+ var qr = null;
+ function ajax_runqsearch(){
+ ajax_stopqsearch();
+ qr = window.setTimeout('ajax_qsearch()',500);
+ }
+
+ function ajax_stopqsearch(){
+ document.getElementById('ajax_qsearch').innerHTML = '';
+ if(qr != null){
+ window.clearTimeout(qr);
+ qr = null;
+ }
+ }
+
+ function ajax_qsearch(){
+ var value = document.search.id.value;
+ if(value=='') return;
ajax.element = 'ajax_qsearch';
ajax.encodeURIString = false;
var call = 'call=qsearch&q=';
call += encodeURI(value);
ajax.runAJAX(call);
+
+ ajax_stopqsearch()
}
</script>
<?php
print '<input type="hidden" name="do" value="search" />';
- print '<input type="text" accesskey="f" name="id" class="edit" onkeyup="ajax_qsearch(this.value)" />';
+ #print '<input type="text" accesskey="f" name="id" class="edit" autocomplete="off" onkeyup="ajax_qsearch(this.value)" />';
+ print '<input type="text" accesskey="f" name="id" class="edit" onkeypress="ajax_runqsearch()" />';
print '<input type="submit" value="'.$lang['btn_search'].'" class="button" />';
print '<div id="ajax_qsearch" class="ajax_qsearch"></div>';
print '</form>';