Skip to content

Instantly share code, notes, and snippets.

@xulapp
Created March 31, 2010 09:11
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 xulapp/350115 to your computer and use it in GitHub Desktop.
Save xulapp/350115 to your computer and use it in GitHub Desktop.
showTabsCountInTitlebar.uc.js
// ==UserScript==
// @name showTabsCountInTitlebar.uc.js
// @description the tabs count is displayed in the end of the title string.
// @include main
// @compatibility Firefox 3.5+
// @namespace http://twitter.com/xulapp
// @author xulapp
// @license MIT License
// @version 2011/04/03 15:40 +09:00
// ==/UserScript==
// @version 2010/03/31 18:00 +09:00
(function showTabsCountInTitlebar() {
eval('gBrowser.updateTitlebar = ' + gBrowser.updateTitlebar.toString().replace(
/\bthis\.ownerDocument\.title = [^;]+/g,
'$& + " [Tab: " + this.mTabs.length + "]"'
));
document.addEventListener('TabClose', STC_onTabClose, false);
function updateTitlebar() {
gBrowser.updateTitlebar();
}
function STC_onTabClose() {
clearTimeout(STC_onTabClose.timer);
STC_onTabClose.timer = setTimeout(updateTitlebar, 0);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment