diff --git a/content/treestyletab/res/bookmarkMultipleTabs.xul b/content/treestyletab/res/bookmarkMultipleTabs.xul index d282cf08..775791a7 100644 --- a/content/treestyletab/res/bookmarkMultipleTabs.xul +++ b/content/treestyletab/res/bookmarkMultipleTabs.xul @@ -14,7 +14,7 @@ in JS files: window['piro.sakura.ne.jp'].bookmarkMultipleTabs.addBookmarkFor(tabsArray, folderName); - license: The MIT License, Copyright (c) 2009-2012 YUKI "Piro" Hiroshi + license: The MIT License, Copyright (c) 2009-2015 YUKI "Piro" Hiroshi original: http://github.com/piroor/fxaddonlib-bookmark-multiple-tabs --> @@ -24,7 +24,7 @@ window.addEventListener('DOMContentLoaded', function() { window.removeEventListener('DOMContentLoaded', arguments.callee, true); - const currentRevision = 5; + const currentRevision = 8; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; @@ -72,9 +72,6 @@ window.addEventListener('DOMContentLoaded', function() { hiddenRows : ['description', 'location', 'loadInSidebar', 'keyword'] }, window); } - else if ('showMinimalAddMultiBookmarkUI' in utils) { // Firefox 3 - 8 - utils.showMinimalAddMultiBookmarkUI(tabs); - } else { throw new Error('there is no method to create bookmarks from tabs!'); } diff --git a/content/treestyletab/res/bookmarkMultipleTabs_bookmarkPropertiesOverlay.xul b/content/treestyletab/res/bookmarkMultipleTabs_bookmarkPropertiesOverlay.xul index beb26b60..23e0488d 100644 --- a/content/treestyletab/res/bookmarkMultipleTabs_bookmarkPropertiesOverlay.xul +++ b/content/treestyletab/res/bookmarkMultipleTabs_bookmarkPropertiesOverlay.xul @@ -14,7 +14,7 @@ in JS files: window['piro.sakura.ne.jp'].bookmarkMultipleTabs.addBookmarkFor(tabsArray, folderName); - license: The MIT License, Copyright (c) 2009-2012 YUKI "Piro" Hiroshi + license: The MIT License, Copyright (c) 2009-2015 YUKI "Piro" Hiroshi http://github.com/piroor/fxaddonlibs/blob/master/license.txt original: http://github.com/piroor/fxaddonlibs/blob/master/bookmarkMultipleTabs.xul @@ -28,23 +28,32 @@ BookmarkPropertiesPanel._determineItemInfo.toSource().indexOf('__folderNameOverride') > -1) return; - eval('BookmarkPropertiesPanel._determineItemInfo = '+BookmarkPropertiesPanel._determineItemInfo.toSource().replace( - '{', - ['{', - 'var __folderNameOverride = null;', - 'try {', - ' __folderNameOverride = Components.classes["@mozilla.org/preferences;1"]', - ' .getService(Components.interfaces.nsIPrefBranch)', - ' .getCharPref("temp.showMinimalAddMultiBookmarkUI.folderName");', - ' __folderNameOverride = decodeURIComponent(escape(__folderNameOverride));', - '}', - 'catch(e) {', - '}' - ].join('') - ).replace( - 'this._strings.getString("bookmarkAllTabsDefault")', - '__folderNameOverride || $&' - )); + // Defined at http://mxr.mozilla.org/mozilla-central/source/browser/components/places/content/bookmarkProperties.js#73 + const ACTION_ADD = 1; + + BookmarkPropertiesPanel.__treestyletab__determineItemInfo = BookmarkPropertiesPanel._determineItemInfo; + BookmarkPropertiesPanel._determineItemInfo = function(...aArgs) { + var folderNameOverride = null; + try { + folderNameOverride = Components.classes['@mozilla.org/preferences;1'] + .getService(Components.interfaces.nsIPrefBranch) + .getCharPref('temp.showMinimalAddMultiBookmarkUI.folderName'); + folderNameOverride = decodeURIComponent(escape(folderNameOverride)); + } + catch(e) { + } + var retVal = this.__treestyletab__determineItemInfo.apply(this, aArgs); + if (folderNameOverride && + this._action == ACTION_ADD) { + let dialogInfo = window.arguments[0]; + if (dialogInfo.type === 'folder' && + !('title' in dialogInfo) && + 'URIList' in dialogInfo) { + this._title = folderNameOverride; + } + } + return retVal; + }; })(); ]]>