MozillaZine

keyconfig shortcuts

Discussion of features in Mozilla Firefox
Miccovin
 
Posts: 51
Joined: February 9th, 2007, 12:44 am

Post Posted July 13th, 2008, 7:45 am

Hi folks,

i'm searching for two shortcuts for keyconfig:

1. open all selected links in new tabs

2. scroll down more than one row (perhaps five).

Perhaps you can help me.

Greets,
Mic

dorando
 
Posts: 1203
Joined: January 9th, 2004, 9:57 am

Post Posted July 15th, 2008, 10:11 am

Miccovin wrote:1. open all selected links in new tabs
Borrowing from Linky, try
Code: Select all
var selection = document.commandDispatcher.focusedWindow.getSelection();
var links = document.commandDispatcher.focusedWindow.document.links;
if(!
links) return;

var urls = new Array();
for (var i = 0, l = links.length ; i < l; i++) {
 if (selection.containsNode(links[i], true) &&
     links[i].href.match(/^(http|https|ftp|gopher|about|file|data):/)) {
  urls.push(links[i].href);
 }
}

if(
urls.length) gBrowser.loadTabs(urls); 
Miccovin wrote:2. scroll down more than one row (perhaps five).
Try
Code: Select all
document.commandDispatcher.focusedWindow.scrollByLines(5); 

Miccovin
 
Posts: 51
Joined: February 9th, 2007, 12:44 am

Post Posted July 15th, 2008, 10:36 am

yeeeaaaaaah. That works both great! I was searching so long for this. Thank you very much! :)

PS: At you other guys out there: if you want to scroll up, just take -5

Miccovin
 
Posts: 51
Joined: February 9th, 2007, 12:44 am

Post Posted August 8th, 2008, 1:49 pm

I have short question at the code for 1. open all selected links in new tabs:

When i use this, i am jumping to the first opened tab. But i don't want to jump - i just want to open all new tabs in the background without jumping to one of them. Do you know the code for this?

dorando
 
Posts: 1203
Joined: January 9th, 2004, 9:57 am

Post Posted August 10th, 2008, 6:59 am

Changing the last line to
Code: Select all
if(urls.length) gBrowser.loadTabs(urls, true); 
should be what you want.

Miccovin
 
Posts: 51
Joined: February 9th, 2007, 12:44 am

Post Posted August 10th, 2008, 8:12 am

works! Thank you :)

goldmember
 
Posts: 10
Joined: July 4th, 2007, 2:50 am

Post Posted February 18th, 2009, 2:28 pm

@dorando: thanks, you're effin' brilliant.

anyone know of a place these handy keyconfig scripts are compiled?

Return to Firefox Features


Who is online

Users browsing this forum: No registered users and 2 guests