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
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
Share Improve this question edited Jul 3, 2010 at 3:45 Bruno 'Shady' asked Jul 2, 2010 at 19:28 Bruno 'Shady'Bruno 'Shady' 4,51615 gold badges56 silver badges75 bronze badges 1- 1 Sorry I don't understand this fully... do you want dynamically generate a button an a greasemonkey-manipulated page for bookmarking something? – JanD Commented Jul 2, 2010 at 22:27
1 Answer
Reset to default 19I 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.