Skip to content

Instantly share code, notes, and snippets.

@satyr
Created January 7, 2009 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyr/44093 to your computer and use it in GitHub Desktop.
Save satyr/44093 to your computer and use it in GitHub Desktop.
function startup_fix4ime(){
function fix4ime(U){ with(U){
const DealtWith = [__KEYCODE_UP, __KEYCODE_DOWN, __KEYCODE_TAB]
.reduce(function(d, c) d[c] = d, {});
U.__onInputOrig = __onInput;
__onInput = function __onInput4IME(e){
if(__showCount) DealtWith[e.keyCode] || __updatePreview();
}
U.__onKeyPress4IME = function __onKeyPress4IME(e){
if(e.keyCode !== __KEYCODE_ENTER) return;
__needsToExecute = __cmdManager.hasSuggestions();
__msgPanel.hidePopup();
}
__textBox.addEventListener('keypress', __onKeyPress4IME, true);
}}
function wait4U(){
var U = Cc['@mozilla.org/appshell/window-mediator;1']
.getService(Ci.nsIWindowMediator)
.getMostRecentWindow('navigator:browser').gUbiquity;
U ? fix4ime(U) : Utils.setTimeout(wait4U, 42);
}
wait4U();
Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
.addObserver({
observe: function(subject, topic, data){
subject.addEventListener('load', this, false);
},
handleEvent: function(event){
var doc = event.originalTarget, loc = doc.location;
doc.removeEventListener('load', this, false);
if(loc && loc.href === 'chrome://browser/content/browser.xul') wait4U();
}}, 'toplevel-window-ready', false);
}
//function cmd_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment