aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/follow.js
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-03-06 03:06:26 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2011-03-06 03:06:26 -0700
commitbece24e3824d11c08fad9c6338f446ee29d4913f (patch)
tree3320ba9d63b7c7a43160539eebd1ab0ac1cd8224 /examples/data/scripts/follow.js
parent941b92e60d4f636e16ab0d3bd0814073b27a0642 (diff)
do link hint styling in user stylesheet.
Diffstat (limited to 'examples/data/scripts/follow.js')
-rw-r--r--examples/data/scripts/follow.js30
1 files changed, 6 insertions, 24 deletions
diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js
index 1551f1c..2b9da59 100644
--- a/examples/data/scripts/follow.js
+++ b/examples/data/scripts/follow.js
@@ -1,5 +1,4 @@
/* This is the basic linkfollowing script.
- * Its pretty stable, and you configure which keys to use for hinting
*
* TODO:
* Some pages mess around a lot with the zIndex which
@@ -11,15 +10,14 @@
* happen. Blame some freaky webdesigners ;)
*/
+// Globals
+uzbldivid = 'uzbl_link_hints';
+
uzbl.follow = function() {
// Export
charset = arguments[0];
newwindow = arguments[2];
- // Some shortcuts and globals
- uzblid = 'uzbl_link_hint';
- uzbldivid = uzblid + '_div_container';
-
var keypress = arguments[1];
return arguments.callee.followLinks(keypress);
}
@@ -107,26 +105,9 @@ uzbl.follow.removeAllHints = function(doc) {
// 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) {
- var hint = doc.createElement('div');
- hint.setAttribute('name', uzblid);
+ var hint = doc.createElement('span');
hint.innerText = label;
- hint.style.display = 'inline';
- if (newwindow) hint.style.backgroundColor = '#ffff00';
- else hint.style.backgroundColor = '#aaff00';
- hint.style.border = '2px solid #556600';
- hint.style.color = 'black';
- hint.style.fontFamily = 'Verdana';
- hint.style.fontSize = '9px';
- hint.style.fontWeight = 'bold';
- hint.style.fontVariant = 'normal';
- hint.style.lineHeight = '9px';
- hint.style.margin = '0px';
- hint.style.width = 'auto'; // fix broken rendering on w3schools.com
- hint.style.padding = '1px';
hint.style.position = 'absolute';
- hint.style.zIndex = '1000';
- hint.style.textDecoration = 'none';
- hint.style.webkitTransform = 'translate(-5px,-5px)';
hint.style.top = top + 'px';
hint.style.left = left + 'px';
return hint;
@@ -173,7 +154,8 @@ uzbl.follow.reDrawHints = function(elems, chars) {
uzbl.follow.removeAllHints(doc);
if (!doc.body) return;
doc.hintdiv = doc.createElement('div');
- doc.hintdiv.setAttribute('id', uzbldivid);
+ doc.hintdiv.id = uzbldivid;
+ if(newwindow) doc.hintdiv.className = "new-window";
doc.body.appendChild(doc.hintdiv);
});