Tag Archives: browser

uzbl follow.js: link following with settable keys

EDIT: this script is no longer up-to-date and won’t work with the current version of uzbl.

This is a diff to current follow_Numbers.js. The new script, which I called follow.js, is more versatile, since the characters used for labels and key navigation can be set using the hintKeys variable.

2d1
<  * Its pretty stable, only using numbers to navigate.
12a12,14
> //This string should be 10 characters long. Play around!
> var hintKeys = 'asdfghjkl;';
> 
24c26
< //Make onlick-links "clickable"
---
> //Make onclick-links "clickable"
195a198,216
> //Map 0123456789 to hintKeys
> function mapNumToHintKeys(label) {
>     label = label + '';
>     for (var j = 0; j < label.length; j++) {
>     var pos = parseInt(label[j]);
>     label = label.replace(label[j], hintKeys[pos]);
>     }
>     return label;
> }
> //Map hintKeys to 0123456789
> function mapHintKeysToNum(label) {
>     label = label + '';
>     for (var j = 0; j < label.length; j++) {
>     var pos = hintKeys.search(label[j]);
>     if (pos < 0 || pos > 9) return;  // bad input, key not in hintKeys
>     label = label.replace(label[j], pos+'');
>     }
>     return parseInt(label);
> }
199c220
<     var linknr = parseInt(follow, 10);
---
>     var linknr = mapHintKeysToNum(follow);
216a238
>         label = mapNumToHintKeys(label);