フォルダの名前をタブのタイトルに表示するようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4528 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-06-17 16:49:18 +00:00
parent 3d2a6d450e
commit f4527db7bc
3 changed files with 24 additions and 6 deletions

View File

@ -1,7 +1,8 @@
content treestyletab jar:chrome/treestyletab.jar!/content/treestyletab/ content treestyletab jar:chrome/treestyletab.jar!/content/treestyletab/
overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab.xul overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab.xul
overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab-fx3.xul appversion>=3.0overlay chrome://browser/content/bookmarks/bookmarksPanel.xul chrome://treestyletab/content/bookmarksOverlay.xul overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab-fx3.xul appversion>=3.0
overlay chrome://browser/content/bookmarks/bookmarksPanel.xul chrome://treestyletab/content/bookmarksOverlay.xul
overlay chrome://multipletab/content/config.xul chrome://treestyletab/content/multipletabConfigOverlay.xul overlay chrome://multipletab/content/config.xul chrome://treestyletab/content/multipletabConfigOverlay.xul
style chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab-3.5.css appversion>=3.1b3pre style chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab-3.5.css appversion>=3.1b3pre

View File

@ -34,10 +34,12 @@ window.addEventListener('load', function() {
} }
// Firefox 3 // Firefox 3
if ('PlacesUIUtils' in window || 'PlacesUtils' in window) { if ('PlacesUIUtils' in window) {
var urils = 'PlacesUIUtils' in window ? PlacesUIUtils : PlacesUtils ; eval('PlacesUIUtils._openTabset = '+
eval('urils._openTabset = '+ PlacesUIUtils._openTabset.toSource().replace(
urils._openTabset.toSource().replace( /(function[^\(]*\([^\)]+)(\))/,
'$1, aFolderTitle$2'
).replace(
'browserWindow.getBrowser().loadTabs(', 'browserWindow.getBrowser().loadTabs(',
<><![CDATA[ <><![CDATA[
if ( if (
@ -51,7 +53,7 @@ window.addEventListener('load', function() {
) { ) {
TreeStyleTabService.readyToOpenNewTabGroup(); TreeStyleTabService.readyToOpenNewTabGroup();
if (TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree.underParent')) if (TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree.underParent'))
urls.unshift('data:text/html,'+encodeURIComponent('<title>group</title>')); urls.unshift('data:text/html,'+encodeURIComponent(TreeStyleTabService.createFolderTabHTML(aFolderTitle)));
replaceCurrentTab = false; replaceCurrentTab = false;
} }
else if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace')) { else if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace')) {
@ -60,5 +62,11 @@ window.addEventListener('load', function() {
$&]]></> $&]]></>
) )
); );
eval('PlacesUIUtils.openContainerNodeInTabs = '+
PlacesUIUtils.openContainerNodeInTabs.toSource().replace(
/(this\._openTabset\([^\)]+)(\))/,
'$1, aNode.title$2'
)
);
} }
}, false); }, false);

View File

@ -716,6 +716,15 @@ var TreeStyleTabService = {
return Number(style.getPropertyValue(aProp).replace(/px$/, '')); return Number(style.getPropertyValue(aProp).replace(/px$/, ''));
}, },
createFolderTabHTML : function(aTitle)
{
return '<title>'+
String(aTitle).replace(/&/g, '$amp;')
.replace(/</g, '$lt;')
.replace(/>/g, '$gt;')+
'</title>';
},
/* get tab(s) */ /* get tab(s) */
getTabById : function(aId, aTabBrowserChildren) getTabById : function(aId, aTabBrowserChildren)