commit b39994578fc761c92c886f7974777cc442d5bfce
parent 707e86dac06557efd1dca292fb17c36d139599c1
Author: Alexander Burger <abu@software-lab.de>
Date: Wed, 30 Nov 2011 08:34:22 +0100
Removing "onblur" in Hint field
Diffstat:
M | lib/form.js | | | 46 | ++++++++++++++++++---------------------------- |
1 file changed, 18 insertions(+), 28 deletions(-)
diff --git a/lib/form.js b/lib/form.js
@@ -1,4 +1,4 @@
-/* 29nov11abu
+/* 30nov11abu
* (c) Software Lab. Alexander Burger
*/
@@ -27,7 +27,6 @@ function formKey(event) {
return false;
if (event.keyCode == 27) {
Hint.style.visibility = "hidden";
- Item = -1;
return false;
}
}
@@ -306,10 +305,6 @@ function doHint(field) {
Hint.appendChild(Hints);
}
field.parentNode.appendChild(Hint);
- field.onblur = function() {
- Hint.style.visibility = "hidden";
- Item = -1;
- }
var top = field.offsetHeight + 2;
var left = 3;
for (var obj = field; obj.id != "main" && obj.id != "menu"; obj = obj.offsetParent) {
@@ -318,7 +313,6 @@ function doHint(field) {
}
Hint.style.top = top + "px";
Hint.style.left = left + "px";
- Item = -1;
}
}
@@ -329,28 +323,26 @@ function hintKey(field, event, tok, coy) {
return true;
if (event.keyCode == 9 || event.keyCode == 27)
return false;
- if (Item >= 0 && event.keyCode == 13) {
- setHint(field, Hints.childNodes[Item]);
- return false;
- }
- if (event.keyCode == 38) { // Up
- if (Hint.style.visibility == "hidden")
- return true;
- if (Item > 0) {
- hintOff(Item);
- hintOn(--Item);
+ if (Hint.style.visibility == "visible") {
+ if (Item >= 0 && event.keyCode == 13) {
+ setHint(field, Hints.childNodes[Item]);
+ return false;
}
- return false;
- }
- if (event.keyCode == 40) { // Down
- if (Hint.style.visibility == "hidden")
- return true;
- if (Item < (lst = Hints.childNodes).length-1) {
- if (Item >= 0)
+ if (event.keyCode == 38) { // Up
+ if (Item > 0) {
hintOff(Item);
- hintOn(++Item);
+ hintOn(--Item);
+ }
+ return false;
+ }
+ if (event.keyCode == 40) { // Down
+ if (Item < (lst = Hints.childNodes).length-1) {
+ if (Item >= 0)
+ hintOff(Item);
+ hintOn(++Item);
+ }
+ return false;
}
- return false;
}
if (HintReq.readyState > 0 && HintReq.readyState < 4)
return false;
@@ -365,7 +357,6 @@ function hintKey(field, event, tok, coy) {
if (event.keyCode != 45) { // INS
if (Beg == End) {
Hint.style.visibility = "hidden";
- Item = -1;
return false;
}
if (coy && Hint.style.visibility == "hidden")
@@ -447,7 +438,6 @@ function setHint(field, item) {
field.onchange = function() {
return fldChg(field)
};
- Item = -1;
}
function hintOn(i) {