aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/follow.js
diff options
context:
space:
mode:
authorGravatar keis <keijser@gmail.com>2011-03-18 14:15:46 +0100
committerGravatar keis <keijser@gmail.com>2011-03-18 14:15:46 +0100
commitacf2405edadd82746608e325a16044e831e1f6f9 (patch)
tree80d18d0d6b908cba5c0ffddd09ae89f9465318db /examples/data/scripts/follow.js
parentfc9946d16ee7f2e1632e228c2b4734d8e636a76d (diff)
clear hints on Escape
* add shortcut to clear all hints
Diffstat (limited to 'examples/data/scripts/follow.js')
-rw-r--r--examples/data/scripts/follow.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js
index 632bae6..b7b0d82 100644
--- a/examples/data/scripts/follow.js
+++ b/examples/data/scripts/follow.js
@@ -98,12 +98,17 @@ uzbl.follow.elementInViewport = function(el) {
}
// Removes all hints/leftovers that might be generated
-// by this script.
-uzbl.follow.removeAllHints = function(doc) {
+// by this script in the given document.
+uzbl.follow.removeHints = function(doc) {
var elements = doc.getElementById(uzbldivid);
if (elements) elements.parentNode.removeChild(elements);
}
+// Clears all hints in every document
+uzbl.follow.clearHints = function() {
+ this.documents().forEach(uzbl.follow.removeHints);
+}
+
// Generate a hint for an element with the given label
// Here you can play around with the style of the hints!
uzbl.follow.generateHint = function(doc, el, label, top, left) {
@@ -153,7 +158,7 @@ uzbl.follow.reDrawHints = function(elems, chars) {
var positions = elements.map(uzbl.follow.elementPosition);
this.documents().forEach(function(doc) {
- uzbl.follow.removeAllHints(doc);
+ uzbl.follow.removeHints(doc);
if (!doc.body) return;
doc.hintdiv = doc.createElement('div');
doc.hintdiv.id = uzbldivid;
@@ -230,7 +235,7 @@ uzbl.follow.followLinks = function(follow) {
var el = elems[linknr];
// clear all of our hints
- this.documents().forEach(uzbl.follow.removeAllHints);
+ this.clearHints();
if (newwindow) {
// we're opening a new window using the URL attached to this element