goba Wed Jan 21 05:31:09 2004 EDT
Modified files:
/phpdoc/scripts/quickref originalafter.js
Log:
Fix some of the errors:
- force spaces to be discarded from the input
- move spacebar handler to the keydown handler, since
that seems to be handled by all browsers I have tested (Mozilla, IE, Opera)
http://cvs.php.net/diff.php/phpdoc/scripts/quickref/originalafter.js?r1=1.9&r2=1.10&ty=u
Index: phpdoc/scripts/quickref/originalafter.js
diff -u phpdoc/scripts/quickref/originalafter.js:1.9
phpdoc/scripts/quickref/originalafter.js:1.10
--- phpdoc/scripts/quickref/originalafter.js:1.9 Thu Jan 1 09:31:00 2004
+++ phpdoc/scripts/quickref/originalafter.js Wed Jan 21 05:31:09 2004
@@ -198,24 +198,9 @@
{
ev=ev||event||null;
if (f_s.value=="quickref"&&ev) {
- var cc=(ev.charCode||ev.charCode==0)?ev.charCode:ev.keyCode||ev.which;
- if (cc==32) { // spacebar autocomplete
- if ((p=f_p.value)=="") return false;
- matches=fh_FindMatches(p);
- if (matches.length==0) return false;
- if (matches.length==1) { // full autocomplete in case of single match
- f_p.value=matches[0];
- return false;
- }
- if (isnotopera) {
- len=0;
- first=matches[0];
- last=matches[matches.length-1]; matches.length--;
- while (len<first.length &&
first.substring(0,len+1)==last.substring(0,len+1)) len++;
- if (f_p.value!=first.substring(0,len)) {
- f_p.value=first.substring(0,len);
- }
- }
+ var cc=ev.charCode||ev.keyCode||ev.which;
+ if (cc==32) {
+ f_p.value = f_p.value.replace(/ /g, "");
return false;
}
//if ((cc>=97&&cc<=122)||(cc>=65&&cc<=90)||(cc>=48&&cc<=57)||cc==95) return
true; // a-z A-Z 0-9 _
@@ -248,6 +233,25 @@
fh_UpdateMenu();
return false;
}
+ if (cc==32) { // spacebar autocomplete
+ if ((p=f_p.value)=="") return false;
+ matches=fh_FindMatches(p);
+ if (matches.length==0) return false;
+ if (matches.length==1) { // full autocomplete in case of single match
+ f_p.value=matches[0];
+ return false;
+ }
+ if (isnotopera) {
+ len=0;
+ first=matches[0];
+ last=matches[matches.length-1]; matches.length--;
+ while (len<first.length &&
first.substring(0,len+1)==last.substring(0,len+1)) len++;
+ if (f_p.value!=first.substring(0,len)) {
+ f_p.value=first.substring(0,len);
+ }
+ }
+ return false;
+ }
}
return true;
}