firefox userChrome.js greasemonkeyスクリプトスレ

このエントリーをはてなブックマークに追加
65680
>>645
直しました.これで起動時の空白タブも消せるはずです.

// Auto Close Blank Tab
(function(){
var tab = gBrowser.mTabs,max = tab.length;
for(var i = 0;i < max;++i){
var win = tab[i].linkedBrowser.contentWindow;
win.blank = (win.document.URL == 'about:blank');
}
gBrowser.addEventListener('DOMContentLoaded',function(event){
var win = event.originalTarget.defaultView;
if(win == win.top) win.blank = (win.document.URL == 'about:blank');
},false);
gBrowser.tabContainer.addEventListener('TabOpen',function(event){
var win,tab = gBrowser.mTabs,max = tab.length;
for(var i = 0;i < max;++i){
if(tab[i] == event.target) continue;
win = tab[i].linkedBrowser.contentWindow;
if(win.blank){ gBrowser.removeTab(tab[i]); --max; }
}
},false);
})();