views:

31

answers:

1

How can I create a shortcut for Greasemonkey for the firefox bookmarks, or, a shortcut that opens a website?

Sorry,

I want a greasemonkey script that contain some script that bind some key for firefox bookmark

for example, press key 1 = open bookmark 1, and so on

A: 

I want a greasemonkey script that contain some script that bind some key for firefox bookmark

Here is an example:

// ==UserScript==
// @name           Google Shortcut
// @namespace      googleShortcut
// ==/UserScript==

(function(){
document.addEventListener('keydown', function(e) {
  // pressed alt+g
  if (e.keyCode == 71 && !e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) {
   window.location = "http://google.com"; // go to google.
  }
}, false);
})();

This user script can be found at userscripts.org here.

This adds a "alt+g" hotkey to all pages which when pressed will take the user to google.com.

This is a very good document explaining how to hook on to different hotkeys, providing all of the keycodes, and information about cross platforms quirks, etc.

You'll have to read this documentation on Greasemonkey to learn how to customize the header information.

Then just save the file with a .user.js extension, and drag and drop it to a Firefox window to install it. When your done upload it to userscripts.org in case someone else would like the script.

Erik Vold