Add CAA to Tools menu

Este commit está contenido en:
JustOff
2017-12-13 16:25:28 +02:00
padre cdde2e1970
commit bdd2fb9a53
Se han modificado 2 ficheros con 26 adiciones y 1 borrados

25
bootstrap.js vendido
Ver fichero

@@ -114,14 +114,36 @@ let button = {
}
};
let menuitem = {
meta : {
id : "ca-archive-menu",
label : "Classic Add-ons Archive",
class : "menuitem-iconic"
},
install : function (w) {
let doc = w.document;
let m = doc.createElement("menuitem");
for (let a in this.meta) {
m.setAttribute(a, this.meta[a]);
}
m.style.listStyleImage = 'url("chrome://ca-archive/skin/button.png")';
let menu = $(doc, "menu_ToolsPopup");
menu.insertBefore(m, null);
return m;
}
};
let caaIn = function (w) {
let b = button.install(w);
let m = menuitem.install(w);
return {
init : function () {
w.addEventListener("customizationchange", button.onCustomize, false);
w.addEventListener("aftercustomization", button.afterCustomize, false);
b.addEventListener("command", this.run, false);
m.addEventListener("command", this.run, false);
},
done : function () {
w.removeEventListener("customizationchange", button.onCustomize, false);
@@ -129,6 +151,9 @@ let caaIn = function (w) {
b.removeEventListener("command", this.run, false);
b.parentNode.removeChild(b);
b = null;
m.removeEventListener("command", this.run, false);
m.parentNode.removeChild(m);
m = null;
},
run : function () {
if (Services.ppmm.childCount > 1) {