Update library: Override function without eval() to avoid errors from mismatched variable scopes.
See also https://bugzilla.mozilla.org/show_bug.cgi?id=1202902
This commit is contained in:
parent
38df1c2f37
commit
d295128e4a
@ -14,7 +14,7 @@
|
|||||||
in JS files:
|
in JS files:
|
||||||
window['piro.sakura.ne.jp'].bookmarkMultipleTabs.addBookmarkFor(tabsArray, folderName);
|
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:
|
original:
|
||||||
http://github.com/piroor/fxaddonlib-bookmark-multiple-tabs
|
http://github.com/piroor/fxaddonlib-bookmark-multiple-tabs
|
||||||
-->
|
-->
|
||||||
@ -24,7 +24,7 @@
|
|||||||
window.addEventListener('DOMContentLoaded', function() {
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
window.removeEventListener('DOMContentLoaded', arguments.callee, true);
|
window.removeEventListener('DOMContentLoaded', arguments.callee, true);
|
||||||
|
|
||||||
const currentRevision = 5;
|
const currentRevision = 8;
|
||||||
|
|
||||||
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
|
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']
|
hiddenRows : ['description', 'location', 'loadInSidebar', 'keyword']
|
||||||
}, window);
|
}, window);
|
||||||
}
|
}
|
||||||
else if ('showMinimalAddMultiBookmarkUI' in utils) { // Firefox 3 - 8
|
|
||||||
utils.showMinimalAddMultiBookmarkUI(tabs);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
throw new Error('there is no method to create bookmarks from tabs!');
|
throw new Error('there is no method to create bookmarks from tabs!');
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
in JS files:
|
in JS files:
|
||||||
window['piro.sakura.ne.jp'].bookmarkMultipleTabs.addBookmarkFor(tabsArray, folderName);
|
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
|
http://github.com/piroor/fxaddonlibs/blob/master/license.txt
|
||||||
original:
|
original:
|
||||||
http://github.com/piroor/fxaddonlibs/blob/master/bookmarkMultipleTabs.xul
|
http://github.com/piroor/fxaddonlibs/blob/master/bookmarkMultipleTabs.xul
|
||||||
@ -28,23 +28,32 @@
|
|||||||
BookmarkPropertiesPanel._determineItemInfo.toSource().indexOf('__folderNameOverride') > -1)
|
BookmarkPropertiesPanel._determineItemInfo.toSource().indexOf('__folderNameOverride') > -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
eval('BookmarkPropertiesPanel._determineItemInfo = '+BookmarkPropertiesPanel._determineItemInfo.toSource().replace(
|
// Defined at http://mxr.mozilla.org/mozilla-central/source/browser/components/places/content/bookmarkProperties.js#73
|
||||||
'{',
|
const ACTION_ADD = 1;
|
||||||
['{',
|
|
||||||
'var __folderNameOverride = null;',
|
BookmarkPropertiesPanel.__treestyletab__determineItemInfo = BookmarkPropertiesPanel._determineItemInfo;
|
||||||
'try {',
|
BookmarkPropertiesPanel._determineItemInfo = function(...aArgs) {
|
||||||
' __folderNameOverride = Components.classes["@mozilla.org/preferences;1"]',
|
var folderNameOverride = null;
|
||||||
' .getService(Components.interfaces.nsIPrefBranch)',
|
try {
|
||||||
' .getCharPref("temp.showMinimalAddMultiBookmarkUI.folderName");',
|
folderNameOverride = Components.classes['@mozilla.org/preferences;1']
|
||||||
' __folderNameOverride = decodeURIComponent(escape(__folderNameOverride));',
|
.getService(Components.interfaces.nsIPrefBranch)
|
||||||
'}',
|
.getCharPref('temp.showMinimalAddMultiBookmarkUI.folderName');
|
||||||
'catch(e) {',
|
folderNameOverride = decodeURIComponent(escape(folderNameOverride));
|
||||||
'}'
|
}
|
||||||
].join('')
|
catch(e) {
|
||||||
).replace(
|
}
|
||||||
'this._strings.getString("bookmarkAllTabsDefault")',
|
var retVal = this.__treestyletab__determineItemInfo.apply(this, aArgs);
|
||||||
'__folderNameOverride || $&'
|
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;
|
||||||
|
};
|
||||||
})();
|
})();
|
||||||
]]></script>
|
]]></script>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
Loading…
Reference in New Issue
Block a user