MozillaZine

Link by number

Talk about add-ons and extension development.
khebbie
 
Posts: 9
Joined: November 11th, 2002, 2:13 am
Location: Denmark

Post Posted January 29th, 2003, 8:09 am

A feature I would like to see in Phoenix is a bit similar to the Type Ahead feature (which I by the way love!!)

The thing is type ahead doesn't work with pictures.
And if you are on a page with many links saying something like "Read article" then you have to use CTRL+G many times.

My new feature goes like this:
You simply press a keyboard shortcut.
This will make a number appear next to every link and like in type ahead you see what you are typing in the status bar.
The focus is then set to the link with the number like in type ahead.
To make the numbers disappear you might hit escape or something.

Please see: http://www.mozillazine.org/forums/viewtopic.php?t=5161

alanjstr
Moderator

User avatar
 
Posts: 9100
Joined: November 5th, 2002, 4:43 pm
Location: Anywhere but here

Post Posted January 29th, 2003, 8:13 am

Why doesn't the javascript bookrmarklet work in Phoenix like it does in IE?
Former UMO Admin, Former MozillaZine General Mod
I am rarely on mozillaZine, so please do not send me a private message.
My Old Firefox config files

khebbie
 
Posts: 9
Joined: November 11th, 2002, 2:13 am
Location: Denmark

Post Posted January 29th, 2003, 8:29 am

First of all it was made quickly and dirty, and used some special IE code.
Hence it is not uasble across browsers.

Secondly the dialog is buggy as someone stated in the other thread.

I would like this feature to be very close to the Type Ahead faeture

edcatmur

User avatar
 
Posts: 88
Joined: November 12th, 2002, 1:42 pm

Post Posted January 30th, 2003, 5:36 pm

Use this bookmark to append {n} to each link: <a href="javascript: var links = document.links; for ( var i = 0; Math.min(i, links.length - 1) == i; i++ ) { links[i].appendChild(document.createTextNode(' {' + i + '}')); } void null;">javascript: var links = document.links; for ( var i = 0; i < links.length; i++ ) { links[i].appendChild(document.createTextNode(' {' + i + '}')); } void null;</a>

Then use this bookmark as a QuickSearch to visit link n: <a href="javascript: document.location = document.links[%s].href; void null;">javascript: document.location = document.links[%s].href; void null;</a> - give it keyword '#' and then to visit link 27, hit Alt-D to get to the location bar, type "# 27" and hit Enter.

alanjstr
Moderator

User avatar
 
Posts: 9100
Joined: November 5th, 2002, 4:43 pm
Location: Anywhere but here

Post Posted January 30th, 2003, 5:49 pm

edcatmur wrote:Use this bookmark to append {n} to each link: <a href="javascript: var links = document.links; for ( var i = 0; Math.min(i, links.length - 1) == i; i++ ) { links[i].appendChild(document.createTextNode(' {' + i + '}')); } void null;">javascript: var links = document.links; for ( var i = 0; i < links.length; i++ ) { links[i].appendChild(document.createTextNode(' {' + i + '}')); } void null;</a>

Then use this bookmark as a QuickSearch to visit link n: <a href="javascript: document.location = document.links[%s].href; void null;">javascript: document.location = document.links[%s].href; void null;</a> - give it keyword '#' and then to visit link 27, hit Alt-D to get to the location bar, type "# 27" and hit Enter.


what the heck is that void null at the end?
Former UMO Admin, Former MozillaZine General Mod
I am rarely on mozillaZine, so please do not send me a private message.
My Old Firefox config files

khebbie
 
Posts: 9
Joined: November 11th, 2002, 2:13 am
Location: Denmark

Post Posted January 31st, 2003, 12:54 am

Hey that was a good idea.

I used the first script to add I.E.#27 to the end of a link, and the type ahead does the rest.
Maybe something smarter could be added to a link.......?

khebbie
 
Posts: 9
Joined: November 11th, 2002, 2:13 am
Location: Denmark

Post Posted January 31st, 2003, 12:56 am

by the way, if anyone is interested:
I added the bookmarklet to the top level of the bookmarks, and named it 2.ID, that way all I have to do is type ALT+B and then 2. Now I can use Type Ahead......Fantastic ;-)

Thanks again

edcatmur

User avatar
 
Posts: 88
Joined: November 12th, 2002, 1:42 pm

Post Posted January 31st, 2003, 12:48 pm

alanjstr wrote:
edcatmur wrote:Use this bookmark to append {n} to each link: <a href="javascript: var links = document.links; for ( var i = 0; Math.min(i, links.length - 1) == i; i++ ) { links[i].appendChild(document.createTextNode(' {' + i + '}')); } void null;">javascript: var links = document.links; for ( var i = 0; i < links.length; i++ ) { links[i].appendChild(document.createTextNode(' {' + i + '}')); } void null;</a>

Then use this bookmark as a QuickSearch to visit link n: <a href="javascript: document.location = document.links[%s].href; void null;">javascript: document.location = document.links[%s].href; void null;</a> - give it keyword '#' and then to visit link 27, hit Alt-D to get to the location bar, type "# 27" and hit Enter.


what the heck is that void null at the end?


Its an ... incantation, I guess. When you visit a javascript: URI, in a bookmarklet say, the browser will replace the current page by the return value of the last expression, unless the last expression has no return value. Some people sort this by wrapping the code in an implicit function declaration; I think the void null method is neater and cleaner!

alanjstr
Moderator

User avatar
 
Posts: 9100
Joined: November 5th, 2002, 4:43 pm
Location: Anywhere but here

Post Posted January 31st, 2003, 1:31 pm

edcatmur wrote:
alanjstr wrote:what the heck is that void null at the end?


Its an ... incantation, I guess. When you visit a javascript: URI, in a bookmarklet say, the browser will replace the current page by the return value of the last expression, unless the last expression has no return value. Some people sort this by wrapping the code in an implicit function declaration; I think the void null method is neater and cleaner!

void(null) is probably the correct way to call it, though. Or maybe just a return null or return false.
Former UMO Admin, Former MozillaZine General Mod
I am rarely on mozillaZine, so please do not send me a private message.
My Old Firefox config files

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 3 guests