diff --git a/content/treestyletab/bookmarksOverlay.js b/content/treestyletab/bookmarksOverlay.js index a04e1bad..022df921 100644 --- a/content/treestyletab/bookmarksOverlay.js +++ b/content/treestyletab/bookmarksOverlay.js @@ -211,90 +211,109 @@ var TreeStyleTabBookmarksService = { catch(e) { // Firefox 3.6 or older ns = window; } + var sv = this; with (ns) { - eval('PlacesUIUtils._openTabset = '+ - PlacesUIUtils._openTabset.toSource().replace( - /(function[^\(]*\([^\)]+)(\))/, - '$1, aFolderTitle$2' - ).replace( - '{', - '{ var TSTTreeStructure = null, TSTPreviousTabs, TSTOpenGroupBookmarkBehavior;' - ).replace( - 'var urls = [];', - '$& var ids = [];' - ).replace( - 'urls.push(item.uri);', - '$& ids.push(item.id);' - ).replace( - /(browserWindow\.(?:getBrowser\(\)|gBrowser)\.loadTabs\([^;]+\);)/, - - ).replace( - /(\}\)?)$/, - - ) - ); - - eval('PlacesUIUtils.openContainerNodeInTabs = '+ - PlacesUIUtils.openContainerNodeInTabs.toSource().replace( - /(this\._openTabset\([^\)]+)(\))/, - + ).replace( + /(\}\)?)$/, + - ) - ); + $1]]> + ) + ); + if (sv.getTreePref('compatibility.TabUtilities') && method.indexOf('TU_') > -1) + window[method] = PlacesUIUtils[method]; + } - eval('PlacesUIUtils.openURINodesInTabs = '+ - PlacesUIUtils.openURINodesInTabs.toSource().replace( - '{', - .toString() - ).replace( - 'uri: aNodes[i].uri,', - 'id: aNodes[i].itemId, $&' - ).replace( - /(this\._openTabset\([^\)]+)(\))/, - - ) - ); + let (method = (sv.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU_openContainerNodeInTabs) ? + 'TU_openContainerNodeInTabs' : + 'openContainerNodeInTabs') { + eval('PlacesUIUtils.'+method+' = '+ + PlacesUIUtils[method].toSource().replace( + /(this\._openTabset\([^\)]+)(\))/, + + ) + ); + if (sv.getTreePref('compatibility.TabUtilities') && method.indexOf('TU_') > -1) + window[method] = PlacesUIUtils[method]; + } + + let (method = (sv.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU_openURINodesInTabs) ? + 'TU_openURINodesInTabs' : + 'openURINodesInTabs') { + eval('PlacesUIUtils.'+method+' = '+ + PlacesUIUtils[method].toSource().replace( + '{', + .toString() + ).replace( + 'uri: aNodes[i].uri,', + 'id: aNodes[i].itemId, $&' + ).replace( + /(this\._openTabset\([^\)]+)(\))/, + + ) + ); + if (sv.getTreePref('compatibility.TabUtilities') && method.indexOf('TU_') > -1) + window[method] = PlacesUIUtils[method]; + } PlacesUIUtils.__treestyletab__done = true;