diff options
author | 2009-05-26 23:52:54 +0200 | |
---|---|---|
committer | 2009-05-26 23:52:54 +0200 | |
commit | 5967d904d18835d7f2dac806ffe5279d6ee2a0f2 (patch) | |
tree | 2a7e5672f2e305e1e62ade76114cec696b8b3103 /examples/scripts | |
parent | 4a5416b2e200471d445806b9c3e24fb44b1ad630 (diff) |
fixed hint tag for input fields
Diffstat (limited to 'examples/scripts')
-rw-r--r-- | examples/scripts/linkfollow.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/scripts/linkfollow.js b/examples/scripts/linkfollow.js index 9b7d811..2adc03b 100644 --- a/examples/scripts/linkfollow.js +++ b/examples/scripts/linkfollow.js @@ -110,7 +110,7 @@ function setHints(r){ var item = items.snapshotItem(i); if(re.test(item) && isVisible(item) && elementInViewport(item)){ var h = generateHint(item,c); - item.appendChild(h); + item.parentNode.insertBefore(h,item); c++; } } @@ -132,15 +132,21 @@ function keyPressHandler(e) { doc.body.removeAttribute("onkeyup"); } } +function next(elem){ + do { + elem = elem.nextSibling; + } while (elem && elem.nodeType != 1); + return elem; +} function followLink(follow){ var m = new Matcher(follow); - var elements = doc.evaluate("//*/div[@class='"+uzblclass+"']",doc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); + var elements = doc.evaluate("//div[@class='"+uzblclass+"']",doc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); // filter var matched = []; for (var i = 0; i < elements.snapshotLength;i++){ var item = elements.snapshotItem(i); - if(m.test(item.parentNode)){ - matched.push(item.parentNode); + if(m.test(next(item))){ + matched.push(next(item)); } } clearHints(); @@ -150,7 +156,8 @@ function followLink(follow){ var item = matched[parseInt(m.numbers,10)-1]; } if (item) { - item.style.backgroundColor = "blue"; + item.style.borderStyle = "dotted"; + item.style.borderWidth = "thin"; var name = item.tagName; if (name == 'A') { |