Skip to content

Instantly share code, notes, and snippets.

@vicro
Created June 14, 2012 08:23
Show Gist options
  • Save vicro/2928986 to your computer and use it in GitHub Desktop.
Save vicro/2928986 to your computer and use it in GitHub Desktop.
Toggle rikaichan with FireGestures
/*
* Send the keystroke for toggling
* Rikaichan
*/
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent(
"keypress", //Key code
true, // in boolean canBubbleArg,
true, // in boolean cancelableArg,
null, // in nsIDOMAbstractView viewArg, Specifies UIEvent.view. This value may be null.
false, // in boolean ctrlKeyArg,
true, // in boolean altKeyArg,
false, // in boolean shiftKeyArg,
false, // in boolean metaKeyArg,
event.DOM_VK_INSERT, // in unsigned long keyCodeArg, (Insert key)
event.DOM_VK_INSERT // in unsigned long charCodeArg);
);
document.documentElement.dispatchEvent(event);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment