tbkeys
http://github.com/wshanks/tbkeys#tbkeys
tbkeys-lite
http://addons.thunderbird.net/thunderbird/addon/987885
Troubleshooting:
You cannot run arbitrary javascript with tbkeys-lite. There is a tbkeys.xpi link on the GitHub releases page.
Remember to include the window object in custom commands. The first example fails with a reference error.
Code: Select all
alert('example 1');
Code: Select all
window.alert('example 2');
Code: Select all
(function () { var text = 'example 3'; window.alert(text); })();
Remember to remove the newline characters in custom commands so the input is a valid JSON string.
Remember to remove the trailing comma after the last key so the input is a valid JSON string.
Code: Select all
{
"ctrl+1": "window.alert('example 1');",
"ctrl+2": "window.alert('example 2');",
"ctrl+3": "(function () { var text = 'example 3'; window.alert(text); })();"
}
http://tools.knowledgewalls.com/online- ... -converter
JSON Validator
http://jsonlint.com/
You can use the cmd shorthand and func shorthand with tbkeys and tbkeys-lite.
Use the cmd shorthand for calling a command using the goDoCommand method.
For example, "cmd:cmd_nextMsg" is the same as "window.goDoCommand('cmd_nextMsg');".
Use the func shorthand for calling a function on the window object without an argument.
For example, "func:MsgNewMessage" is the same as "window.MsgNewMessage();".
Tips:
You can change some addon shortcuts in the Addons Manager tab.
i.e. Tools > Addons > Extensions > Cogwheel > Manage Extension Shortcuts
You can use a menu item label to run a command.
Code: Select all
window.document.getElementsByAttribute('label', 'Open Message in New Tab')[0].doCommand();
Code: Select all
window.document.getElementsByAttribute('label', 'Find in This Message\u2026')[0].doCommand();
http://www.fileformat.info/info/unicode ... /index.htm
You can use the following code to easily extract a command using the error console. The trick does not work for all user interface elements.
Code: Select all
function getCommand(event) {
window.removeEventListener("command", getCommand, true);
event.preventDefault();
event.stopPropagation();
alert(event.originalTarget.getAttribute("oncommand") ||
event.originalTarget.getAttribute("onclick"));
}
window.addEventListener("command", getCommand, true);
* run code in error console
* right click a message
* open "Mark" menu
* left click "As Unread" menu item
Code: Select all
window.goDoCommand('cmd_markAsUnread');
Code: Select all
(function () {
var tagNames = ["command", "key", "menuitem"];
var collection = new Object();
for (var i = 0; i < tagNames.length; i++) {
collection[tagNames[i]] = document.getElementsByTagName(tagNames[i]);
}
var out = new Array();
var xai = Components.classes["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULAppInfo);
out.push(xai.name + " " + xai.version);
out.push(document.documentElement.getAttribute("windowtype"));
var menuitems = document.getElementsByTagName("menuitem");
for (var i in collection) {
var count = 0;
out.push("_____ ^ " + i + " " + Array(72 - i.length).join("_"));
for (var j = 0; j < collection[i].length; j++) {
var id = collection[i][j].getAttribute("id");
var oncommand = collection[i][j].getAttribute("oncommand");
var label = collection[i][j].getAttribute("label");
var tooltiptext = collection[i][j].getAttribute("tooltiptext");
var text = label || tooltiptext;
if (id && oncommand) {
count++;
var tagNames = ["command", "key", "observes"];
for (var m = 0; m < tagNames.length; m++) {
if (!text) {
for (var n = 0; n < menuitems.length; n++) {
if (menuitems[n].getAttribute(tagNames[m]) == id) {
text = menuitems[n].getAttribute("label");
break;
}
}
}
}
id = text ? id + " \u25ba " + text : id;
oncommand = oncommand.search(/\x29$/) > -1 ? oncommand + ";" : oncommand;
oncommand = oncommand.replace(/\s\s+/g, " ");
out.push(id + "\n" + oncommand);
}
}
out.push(i + " count " + count);
}
for (var i = 0; i < out.length; i++) {
var suc = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
suc.charset = "UTF-8";
out[i] = suc.ConvertFromUnicode(out[i]);
out[i] = out[i].replace(/&/g, "&");
out[i] = out[i].replace(/>/g, ">");
out[i] = out[i].replace(/</g, "<");
out[i] = out[i].replace(/"/g, """);
out[i] = out[i].replace(/'/g, "'");
}
var data = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">';
data += "<html><head><title>" + out[1] + "</title>";
data += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
data += "</head><body><pre>" + out.join("\n\n") + "</pre></body></html>";
openContentTab("data:text/html;charset=utf-8;base64," + btoa(data));
})();
Thunderbird commands (last edited in 2013)
http://kb.mozillazine.org/Keyconfig_ext ... hunderbird
Thunderbird shortcuts
http://support.mozilla.org/kb/keyboard-shortcuts
Thunderbird source
http://searchfox.org/comm-esr102/source/
http://searchfox.org/comm-esr102/source ... .inc.xhtml (more commands)
http://searchfox.org/comm-esr102/search ... egexp=true
http://searchfox.org/comm-esr102/source ... ersion.txt
Thunderbird command names like cmd_scrollTop are not included in the Thunderbird source.
Code: Select all
window.goDoCommand('cmd_scrollTop');
http://searchfox.org/mozilla-esr102/source/
http://searchfox.org/mozilla-esr102/sou ... mmands.cpp (more commands)
http://searchfox.org/mozilla-esr102/sea ... itions.cpp
http://searchfox.org/mozilla-esr102/sou ... ersion.txt
How to add key bindings support for message window: viewtopic.php?p=14919152#p14919152
How to define global functions with userChromeJS: viewtopic.php?p=14900570#p14900570
How to execute MailExtension command: viewtopic.php?p=14922347#p14922347
How to simulate or synthesize a keypress or a mouse click: viewtopic.php?p=14949538#p14949538