日本語のフォルダ名で文字化けしていた

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4530 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-06-17 23:12:47 +00:00
parent f4527db7bc
commit b473cbc291
2 changed files with 38 additions and 11 deletions

View File

@ -4,8 +4,34 @@ window.addEventListener('load', function() {
if ('BookmarksCommand' in window) { // Firefox 2
eval('BookmarksCommand.openGroupBookmark = '+
BookmarksCommand.openGroupBookmark.toSource().replace(
'var index = index0;',
<![CDATA[$&
if (TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree.underParent')) {
containerChildren = {
hasMoreElements : function()
{
return this.isFirst ? true : this._children.hasMoreElements();
},
getNext : function()
{
if (!this.isFirst)
return this._children.getNext();
this.isFirst = false;
return {
QueryInterface : function() {
return this;
}
};
},
_children : containerChildren,
isFirst : true
};
}
]]>
).replace(
/(tabPanels\[index\])(\.loadURI\(uri\);)/,
<><![CDATA[
<![CDATA[
$1$2
if (!doReplace &&
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') &&
@ -13,22 +39,22 @@ window.addEventListener('load', function() {
browser.treeStyleTab.partTab(browser.treeStyleTab.getTabs(browser).snapshotItem(index));
TreeStyleTabService.readyToOpenChildTab($1, true);
}
]]></>
]]>
).replace(
'browser.addTab(uri);',
<><![CDATA[
<![CDATA[
var openedTab = $&
if (!doReplace &&
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') &&
!browser.treeStyleTab.parentTab) {
TreeStyleTabService.readyToOpenChildTab(openedTab, true);
}
]]></>
]]>
).replace(
'if (index == index0)',
<><![CDATA[
<![CDATA[
TreeStyleTabService.stopToOpenChildTab(browser);
$&]]></>
$&]]>
)
);
}
@ -41,7 +67,7 @@ window.addEventListener('load', function() {
'$1, aFolderTitle$2'
).replace(
'browserWindow.getBrowser().loadTabs(',
<><![CDATA[
<![CDATA[
if (
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') &&
(
@ -53,13 +79,13 @@ window.addEventListener('load', function() {
) {
TreeStyleTabService.readyToOpenNewTabGroup();
if (TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree.underParent'))
urls.unshift('data:text/html,'+encodeURIComponent(TreeStyleTabService.createFolderTabHTML(aFolderTitle)));
urls.unshift(TreeStyleTabService.getFolderTabURI(aFolderTitle));
replaceCurrentTab = false;
}
else if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace')) {
replaceCurrentTab = false;
}
$&]]></>
$&]]>
)
);
eval('PlacesUIUtils.openContainerNodeInTabs = '+

View File

@ -716,13 +716,14 @@ var TreeStyleTabService = {
return Number(style.getPropertyValue(aProp).replace(/px$/, ''));
},
createFolderTabHTML : function(aTitle)
getFolderTabURI : function(aTitle)
{
return '<title>'+
var html = '<title>'+
String(aTitle).replace(/&/g, '$amp;')
.replace(/</g, '$lt;')
.replace(/>/g, '$gt;')+
'</title>';
return 'data:text/html;charset=UTF-8,'+encodeURIComponent(html);
},
/* get tab(s) */