Created
January 7, 2009 00:29
-
-
Save satyr/44093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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