Skip to content

Instantly share code, notes, and snippets.

@onozaty
Created August 11, 2013 14:38
Show Gist options
  • Save onozaty/6205174 to your computer and use it in GitHub Desktop.
Save onozaty/6205174 to your computer and use it in GitHub Desktop.
work shortcutkey
var keyElement = aWindow.document.createElement("key");
keyElement.setAttribute("key", key);
keyElement.setAttribute("modifiers", modifiers);
keyElement.setAttribute("oncommand", "void(0);");
keyElement.addEventListener("command", function() {
alert('do command');
}, false);
var keysetElement = aWindow.document.createElement("keyset");
keysetElement.appendChild(keyElement);
aWindow.document.getElementById("mainKeyset").parentNode.appendChild(keysetElement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment