You are not logged in.

#1 2010-05-23 09:38:34

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

VimNav - another vimperator-like navigation script for webkit browsers

I wanted to use vimperator-like navigation for my Midori browser, so I did combine the functions of several scripts around, webkit user scripts and uzbl ones, and tweaked all to my liking. This turned out to a major rewrite and can be loaded from here.

Note: This is currently tested for Midori only. Basically it is a greasemonkey script and should be useable with other (e.g. gecko-based) browsers as well. This will require some rewrite, however.

To use the script with Midori, put it into ~/.local/share/midori/scripts/VimNav.user.js.

I implemented several additional features and configuration possibilities for (my) convenience, mainly:
- simple vim-like page scroll (defaults to "hjkl" row)
- key bindings fully configurable
- vimperator-like navigation by labeled hints
- define special collateral sequences for labels display, e.g. "abc" instead of "123" or even let the script select an optimally short collateral sequence for the given page
- use shortened labels for partially matched links (like uzbl "follow.js") or color-code remaing selection possibilities (like "KeyNav.user.js" from Userscripts.org)
- scroll the page during label navigation
- temporarily hide labels during label navigation
- switch to a new page automatically as soon as a match was found or let the user confirm the selection (allows for label correction with backspace)
- open new link in the current window or use another window (resp. tab) for it.

For details read the configuration section at the beginning of the script.

Have fun! smile

Edit: Download location altered to point to the most recent version.

Last edited by bernarcher (2010-05-29 14:18:15)


To know or not to know ...
... the questions remain forever.

Offline

#2 2010-05-23 10:36:19

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: VimNav - another vimperator-like navigation script for webkit browsers

Thank you very much for this script. big_smile

It really combines all functionality I've had using many scripts and there are nice improvements like hinting also works while numlock is active.

There is just one question for me:
Is the leading 0 necessary for numeric hinting?

Offline

#3 2010-05-23 12:41:40

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: VimNav - another vimperator-like navigation script for webkit browsers

Andrwe wrote:

There is just one question for me:
Is the leading 0 necessary for numeric hinting?

Not necessarily so, but I wanted to implement autoselection in a more consistent way. For instance, if there is a series of hints numbered 1 through 35, and you want to select, say, label number 2. So you press the "2" and have labels "2" and, possibly somewhere elsewhere far out of sight, "20" through "29" to select from. As you do want the "2" you need to explicitely confirm, e.g. by pressing return.

On the other hand, if there are leading zeros, you select each label in a consistent way starting at the most significant digit: "0", then only "0" trough "9", usually placed close together, remain. You press "2" and, voilá, (if autoselect is on) the browser navigates to where you want.

So you don't really save a keystroke but can remain consistent. In fact, if you additionally use the "optimal" collateral sequence, hints seldomly need more than two (alphanumeric) digits, which makes navigation fast and efficient. The only cost there is that pages with a changing number of links (as this forum) occasionally switch between pure numerical and alphanumerical hint labels on subsequent calls. But this is something I easily can live with.


To know or not to know ...
... the questions remain forever.

Offline

#4 2010-05-23 23:46:52

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: VimNav - another vimperator-like navigation script for webkit browsers

Ok, I see your point and agree with it.

Offline

#5 2010-05-27 07:27:15

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: VimNav - another vimperator-like navigation script for webkit browsers

Hi,

I've found a bug.
If you want to write a letter which is configured for a function  in a password input the functions are called.

Last edited by Andrwe (2010-05-27 07:29:13)

Offline

#6 2010-05-27 09:42:35

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: VimNav - another vimperator-like navigation script for webkit browsers

Interesting. But hard to confirm. Can you provide an example?

BTW, navigation does not work on the new home page any more. It looks like VimNav/Midori does not even recognise the page. Any idea about this?

I'll work on all this not before tomorrow night, however.


To know or not to know ...
... the questions remain forever.

Offline

#7 2010-05-27 14:23:28

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: VimNav - another vimperator-like navigation script for webkit browsers

Example pages are:
http://maemo.org
http://wiki.archlinux.org/index.php?tit … =Main_Page

Just click into the password field and type e.g. F or D.

And for me after an reload VimNav worked on new home page too.

Last edited by Andrwe (2010-05-27 14:25:25)

Offline

#8 2010-05-27 22:15:16

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: VimNav - another vimperator-like navigation script for webkit browsers

I think I found a solution. Could you please try this and report back.

in function isEditable( element )
in line 1197 replace:
    if ( element.nodeName.toLowerCase() == "input" && element.type == "text" )
by:
    if ( element.nodeName.toLowerCase() == "input" && 
         ( element.type == "text" || element.type == "password" ) )

If possible, try some other similar pages, too.

And, yes, the new home is accessible by VimNav here again. It was caused by a shortcut key conflict between my setup and the Midori defaults. Thanks for the report. smile


To know or not to know ...
... the questions remain forever.

Offline

#9 2010-05-28 08:59:09

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: VimNav - another vimperator-like navigation script for webkit browsers

This code works. big_smile

Offline

#10 2010-05-29 14:15:48

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: VimNav - another vimperator-like navigation script for webkit browsers

I uploaded a new version of VimNav here.

Bugfix
- proper handling of password fields
  (no more VarNav functions called from inside)
- input fields now properly selected
- labels display unaltered
  (could have been changed to uppercase if node parent did so)

New Features
- scroll height adjustable by factors 1, 2, 3, and 4
  (by default bound to "^1", "^2", "^3", and "^4")

The scroll height adjust is meant to get around a browser (Midori only?) bug by which on complex documents the script will be instantiated multiple times in a row. This multiple instantiation cannot be detected from inside Javascript, so that
- vertical movements will occur over multiples of the programmed distance
- hint labels will take significant more time to show up
Hint-based navigation will be unaffected in most cases, however, as only one instance will effectively control the behaviour.


To know or not to know ...
... the questions remain forever.

Offline

#11 2010-07-27 16:52:38

cbrunos
Member
Registered: 2010-07-22
Posts: 55

Re: VimNav - another vimperator-like navigation script for webkit browsers

Thanks a lot, this was exactly what I was looking for. A simple Webkit browser with vimperator-like navigation.


Xmonad gets sh*t done. Fast.

Offline

Board footer

Powered by FluxBB