Help with aboutaddons-button.uc.js #364
Unanswered
nollinvoyd
asked this question in
General Support
Replies: 1 comment
-
|
That's a modified Aris script. Remove the // 'about:'-Button script for Firefox 89+ by Aris, edits by Speravir
//
// Need a different 'about' page button?
// - replace 'about:config' url with a different 'about:' url
// - replace button id
// - replace icon / icon url / icon color
(function() {
// if (!window.gBrowser) return;// add. Speravir
const
buttonID = "about-addons-button",
address = "about:addons",
labelText = "About:addons Button", // button title
tooltip = "Open addons page", // tooltip content
css = // code for button icon
`#${buttonID} .toolbarbutton-icon {
list-style-image: url("chrome://mozapps/skin/extensions/extension.svg"); /* icon / path to icon */
fill: dimgray; /* icon color name/code */
}`;
try {
ChromeUtils.importESModule("resource:///modules/CustomizableUI.sys.mjs");
let sss = Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService);
CustomizableUI.createWidget({
id: buttonID,
defaultArea: CustomizableUI.AREA_NAVBAR,
removable: true,
label: labelText,
tooltiptext: tooltip,
onClick: function(event) {
let win = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");
if (event.button === 0) {
try {
win.gBrowser.selectedTab = win.gBrowser.addTrustedTab(address);
setTimeout(function() {
document.querySelector("#toolbar-context-menu").hidePopup();
}, 0);
} catch (e) {}
}
if (event.button === 1) {
try {
openAboutDialog();
} catch (e) {}
}
},
onCreated: function(button) {
return button;
}
});
// style button icon
let uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(css), null, null);
sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
} catch (e) {
Components.utils.reportError(e);
}
})(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I knows this is not one of your products, but I was hoping to get any type of advice, or maybe a suggestion where to get help.
All my current custom buttons work except for this one.
`// 'about:'-Button script for Firefox 89+ by Aris, edits by Speravir
//
// Need a different 'about' page button?
// - replace 'about:config' url with a different 'about:' url
// - replace button id
// - replace icon / icon url / icon color
(function() {
if (!window.gBrowser) return;// add. Speravir
const
buttonID = "about-addons-button",
address = "about:addons",
labelText = "About:addons Button", // button title
tooltip = "Open addons page", // tooltip content
css = // code for button icon
#${buttonID} .toolbarbutton-icon { list-style-image: url("chrome://mozapps/skin/extensions/extension.svg"); /* icon / path to icon */ fill: dimgray; /* icon color name/code */ };try {
ChromeUtils.importESModule("resource:///modules/CustomizableUI.sys.mjs");
let sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
} catch (e) {
Components.utils.reportError(e);
};
})();`
Beta Was this translation helpful? Give feedback.
All reactions