mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 22:08:00 +01:00
Added (outcommented because too slow) 'numbertabs' option (by hrist).
This commit is contained in:
@@ -329,6 +329,29 @@ var g_settings = [/*{{{*/
|
||||
"",
|
||||
null
|
||||
]
|
||||
|
||||
// TODO: make more performant and then enable
|
||||
/*,[
|
||||
["numbertabs", "nt"],
|
||||
["numbertabs", "nt"],
|
||||
"Turns tab numbering on or off",
|
||||
"If you want to see a number on each tab turn this on",
|
||||
"boolean",
|
||||
null,
|
||||
function(value) { set_pref("numbertabs", value); set_tabnumbers(value); },
|
||||
function() { return get_pref("numbertabs"); },
|
||||
false,
|
||||
null
|
||||
],
|
||||
|
||||
function set_tabnumbers(value)
|
||||
{
|
||||
if(value==false)
|
||||
vimperator.tabs.updateTitles(true);
|
||||
vimperator.tabs.updateTitles(false);
|
||||
}
|
||||
*/
|
||||
|
||||
]/*}}}*/
|
||||
|
||||
// return null, if the cmd cannot be found in our g_settings array, or
|
||||
|
||||
@@ -1228,5 +1228,42 @@ function Tabs()
|
||||
}
|
||||
getBrowser().mTabContainer.selectedIndex = index;
|
||||
}
|
||||
|
||||
|
||||
/* XXX: disabled until we find a better way where to update the titles, right now
|
||||
* it has O(n^2) complexity on firefox start when we load 50 tabs
|
||||
* (c) by hrist
|
||||
|
||||
window.addEventListener("TabMove", function() { vimperator.statusline.updateTabCount(); vimperator.tabs.updateTitles(); }, false);
|
||||
window.addEventListener("TabOpen", function() { vimperator.statusline.updateTabCount(); vimperator.tabs.updateTitles(); }, false);
|
||||
window.addEventListener("TabClose", function() { vimperator.statusline.updateTabCount(); vimperator.tabs.updateTitles(); }, false);
|
||||
|
||||
this.updateTitles = function(forceclear)
|
||||
{
|
||||
for(var i=0;i < vimperator.tabs.count();i++)
|
||||
{
|
||||
var old_title = getBrowser().mTabContainer.childNodes[i].getAttribute("label");
|
||||
var split_title = old_title.match(/^(\d+:\s+)(.*)/);
|
||||
if(forceclear)
|
||||
{
|
||||
for(var i=0;i<vimperator.tabs.count();i++)
|
||||
getBrowser().mTabContainer.childNodes[i].setAttribute("label", split_title[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
var numbertabs = get_pref('numbertabs');
|
||||
if(numbertabs)
|
||||
{
|
||||
if(split_title)
|
||||
{
|
||||
var new_title = (i+1) + ": "+ split_title[2];
|
||||
}
|
||||
else var new_title = (i+1) + ": " + old_title;
|
||||
getBrowser().mTabContainer.childNodes[i].setAttribute("label", new_title);
|
||||
}
|
||||
else getBrowser().mTabContainer.childNodes[i].setAttribute("label", split_title[2]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
Reference in New Issue
Block a user