Skip to content

Instantly share code, notes, and snippets.

@satyr
Created January 27, 2009 10:19
Show Gist options
  • Select an option

  • Save satyr/53269 to your computer and use it in GitHub Desktop.

Select an option

Save satyr/53269 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name autoContentFocus
// @namespace http://d.hatena.ne.jp/murky-satyr
// @description Focuses the content whenever a tab is selected.
// @include main
// @compatibility Fx 3.0.*
// @version 2010-04-02
// ==/UserScript==
setTimeout(function(){
gBrowser.tabContainer.addEventListener('TabSelect', function(e){
var b = gBrowser.selectedTab.linkedBrowser;
setTimeout(function acf(){
var w = b.contentWindow;
if(!w) return;
w.focus();
var e = document.commandDispatcher.focusedElement;
if(e && /^(?:embed|object)$/i.test(e.nodeName)) e.blur();
});
// might as well...
gPrefService.setBoolPref('accessibility.browsewithcaret', false);
}, false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment