diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-03-22 07:54:55 -0600 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-03-22 07:54:55 -0600 |
commit | 9f4c2ebb2676accedd765af7a587262d7bd39564 (patch) | |
tree | 419ab2004be402bd384ea7c1b9f590989f898308 /examples | |
parent | b7b7565b13e6b5e5192cb730b64f311fe5a51d71 (diff) | |
parent | acf2405edadd82746608e325a16044e831e1f6f9 (diff) |
Merge remote-tracking branch 'keis/follow-tweaks' into experimental
Diffstat (limited to 'examples')
-rw-r--r-- | examples/config/config | 1 | ||||
-rw-r--r-- | examples/data/scripts/follow.js | 15 |
2 files changed, 11 insertions, 5 deletions
diff --git a/examples/config/config b/examples/config/config index 6de0b59..089fc8d 100644 --- a/examples/config/config +++ b/examples/config/config @@ -185,6 +185,7 @@ set ebind = @mode_bind global,-insert # Resets keycmd and returns to default mode. @on_event ESCAPE @set_mode @on_event ESCAPE event KEYCMD_CLEAR +@on_event ESCAPE js uzbl.follow.clearHints() @bind <Escape> = event ESCAPE @bind <Ctrl>[ = event ESCAPE diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index 536256b..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; @@ -211,7 +216,7 @@ uzbl.follow.followLinks = function(follow) { var s = follow.split(''); var linknr = this.labelToInt(follow); - var followable = 'a, area, textarea, select, input:not([type=hidden]), button'; + var followable = 'a, area, textarea, select, input:not([type=hidden]), button, *[onclick]'; var uri = 'a, area, frame, iframe'; //var focusable = 'a, area, textarea, select, input:not([type=hidden]), button, frame, iframe, applet, object'; //var desc = '*[title], img[alt], applet[alt], area[alt], input[alt]'; @@ -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 |