如何为 firefox 书签创建 Greasemonkey 快捷方式,或者打开网站的快捷方式?
对不起,
我想要一个 greasemonkey 脚本,其中包含一些为 firefox 书签绑定(bind)一些键的脚本
例如,按下键 1 = 打开书签 1,依此类推
最佳答案
I want a greasemonkey script that contain some script that bind some key for firefox bookmark
这是一个例子:
// ==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 .
这会向所有页面添加一个“alt+g”热键,按下该热键会将用户带到 google.com。
你必须 read this documentation on Greasemonkey to learn how to customize the header information .
然后只需使用 .user.js
扩展名保存文件,然后将其拖放到 Firefox 窗口中进行安装。完成后将其上传到 userscripts.org以防其他人想要该脚本。
关于javascript - 如何在 Greasemonkey 中为 firefox 创建快捷方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3168574/