Firefox扩展批量安装脚本
生成数据
(function(){
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAllAddons(function(addons){
var rslt = {};
for each(var addon in addons){
if(addon.isActive && addon.type=='extension' && addon.sourceURI)
rslt[addon.id]=addon.sourceURI.spec
}
alert(JSON.stringify(rslt));}
)
})()
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAllAddons(function(addons){
var rslt = {};
for each(var addon in addons){
if(addon.isActive && addon.type=='extension' && addon.sourceURI)
rslt[addon.id]=addon.sourceURI.spec
}
alert(JSON.stringify(rslt));}
)
})()
安装扩展
(function(){
var data = prompt("输入扩展分享数据");
data = data?JSON.parse(data):{};
Components.utils.import("resource://gre/modules/AddonManager.jsm");
for each (var url in data){
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.install();
}, "application/x-xpinstall");
}
Application.prefs.setValue('extensions.checkCompatibility.4.0b',false);
window.open('about:addons');
})()
var data = prompt("输入扩展分享数据");
data = data?JSON.parse(data):{};
Components.utils.import("resource://gre/modules/AddonManager.jsm");
for each (var url in data){
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.install();
}, "application/x-xpinstall");
}
Application.prefs.setValue('extensions.checkCompatibility.4.0b',false);
window.open('about:addons');
})()
数据备份