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

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

View File

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