Skip to content

Instantly share code, notes, and snippets.

// ==================== set global keys ==================== //
key.setGlobalKey("C-M-r",
function () { userscript.reload(); },
"設定ファイルを再読み込み");
// -------------------- help command -------------------- //
key.setGlobalKey([key.helpKey, "b"], function () {
key.listKeyBindings();
key.setGlobalKey(["C-c", "C-w", "C-a"],
function () {
window.alert("Hello!");
},
"Hello Dialog");
key.setGlobalKey(["C-c", "C-w", "C-a"],
function (event, arg) {
window.alert("Hello! Prefix argument is " + arg);
},
"Hello Dialog");
key.setGlobalKey(["C-c", "C-w", "C-a"],
function (event, arg) {
window.alert("Hello! Prefix argument is " + arg);
},
"Hello Dialog",
true);
key.setViewKey("g",
function () { goDoCommand('cmd_scrollTop'); },
"ページ先頭へ移動");
key.setViewKey("M-<",
function () { goDoCommand('cmd_scrollTop'); },
"ページ先頭へ移動");
key.setViewKey(["ESC", "<"],
function () { goDoCommand('cmd_scrollTop'); },
key.setViewKey([["g"],
["M-<"],
["ESC", "<"]],
function () { goDoCommand('cmd_scrollTop'); },
"ページ先頭へ移動");
key.helpKey = "<tab>";
key.isControlKey = function (aEvent) {
return aEvent.ctrlKey;
};
key.isMetaKey = function (aEvent) {
return aEvent.altKey || aEvent.commandKey;
};
key.isControlKey = function (aEvent) {
return aEvent.ctrlKey
|| aEvent.keyCode == KeyEvent.DOM_VK_CAPS_LOCK;
};
// ==================== global mode ==================== //
key.setGlobalKey(["C-x", "k"],
function () { BrowserCloseTabOrWindow(); },
"Close tab / window");
key.setGlobalKey(["C-x", "K"],
function () { closeWindow(true); },
"Close the window");