Ich würde gerne die Funktionen des ersten Skripts in das zweite Skript Integrieren, um ein frei Platzierbares Buttonmenü zu bekommen.
XML
<?xml version="1.0" encoding="UTF-8"?>
<overlay id="AboutButtonMenu"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar id="nav-bar">
<menu id="aboutButtonMenu" tooltiptext="About Menü">
<toolbarbutton style="list-style-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC/0lEQVR4XnXPXWwUVRjG8f85M7N22e52+WitFZspha2IYjVbatVEK02xQiDaGExJxQjohdrAhd+FK0yM12gMkTTGKtoQlMQYNCGtGFBCRW5QkVYpxBbb7Rfbj9kzZ85oZC/WJv6SJ+/V8+Z9xe79Pye07x2dnxn/wp+dPyADC7IaAxGtgpXCMldzvsp6yiOX81BaUUjG4okH44lojZkzX3rX5jBTGt83dzuO3VW9uvxkCIeMMUv4H9KJOPFFsUg8EsitQogOE5rOmrtuObntuYa21vb6pY9srH1SStmjfV2OYCHEC6/2l6DnPy8vizdOj05SV1dJw8NVaAOeB2EIZ89c5dhnfWenpq63G4KLFJAD/f3TV34bPJX5a4Itj9/Bhs1VEILRQAg6gNr0bbTteKyuvGJZt/aDCgrI4liCIqso2dLkcl9DKb4HUoDIBwFaQ/WqpbTt3JR2q5cfM8a45EkhxPqm5pXPNz/q4uUACdICW4Al81OAp2G5G6Nl071ppYKtQSj5J8hksujlLU/UOOQ58kZRWCAlCAmhBcXXfyD1xys43uUwxM4WOzPE7FlkICglGsMYsCUI8d8XhAUlYoLUpWeJjnfhXtg1s3vthwNfNb3B0cZOpJdT3uUhGMnky9aNkm2BZcPiOLhVJfwylyYbJKlrScSfqjn/FoYVUTtAjo2Ov9nzUe/wtbGA6VmQ5C+REA9HKYmFfNA9yPaPW7uHf8y8RGZ8lnX3p4naJwhYI8Mw7Dv93bmNXQe/GRweUeQ0SBtiF99h8elmzh18kd7D77+74ebDu5KL1AF+/bOdod8zJBMuIWWiaf17KJ3DV8HqO9eu+KRjT0vt7ambsI7Uw5IZspmAyfNX9laWevtRQAgE1CMoQ/L1vwt8rQBQSlesSt3a/cyOhxq/P358Zltkz1Dl5nvWMDEGZy68DexFoCkgKRCJ2MMDl0Za973+6aEjvXaHmuMBTvT1ULwMUu5rGLazgM0CjiMngZ3SVwgbUDzNt6c8ovY6LH5igb8BucA1WORtKKUAAAAASUVORK5CYII=');"/>
</menu>
</toolbar>
<menupopup id="nav-bar">
<menu id="aboutButtonMenu" label="About Menü">
<menupopup id="aboutMenuPopup">
<menuitem label="about:config" onclick="openUILinkIn('about:config', 'tab');"/>
<menuitem label="about:addons" onclick="openUILinkIn('about:addons', 'tab');"/>
<menuitem label="about:plugins" onclick="openUILinkIn('about:plugins', 'tab');"/>
<menuitem label="about:permissions" onclick="openUILinkIn('about:permissions', 'tab');"/>
<menuitem label="about:healthreport" onclick="openUILinkIn('about:healthreport', 'tab');"/>
<menuitem label="about:downloads" onclick="openUILinkIn('about:downloads', 'tab');"/>
<menuitem label="about:about" onclick="openUILinkIn('about:about', 'tab');"/>
<menuitem label="about:home" onclick="openUILinkIn('about:home', 'tab');"/>
</menupopup>
</menu>
</menupopup>
</overlay>
Alles anzeigen
Code
(function () {
if (location != 'chrome://browser/content/browser.xul') return;
const buttonId = 'about-button';
const buttonLabel = 'About Button';
const buttonTooltiptext = 'Aboutmenü';
const buttonIcon = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC/0lEQVR4XnXPXWwUVRjG8f85M7N22e52+WitFZspha2IYjVbatVEK02xQiDaGExJxQjohdrAhd+FK0yM12gMkTTGKtoQlMQYNCGtGFBCRW5QkVYpxBbb7Rfbj9kzZ85oZC/WJv6SJ+/V8+Z9xe79Pye07x2dnxn/wp+dPyADC7IaAxGtgpXCMldzvsp6yiOX81BaUUjG4okH44lojZkzX3rX5jBTGt83dzuO3VW9uvxkCIeMMUv4H9KJOPFFsUg8EsitQogOE5rOmrtuObntuYa21vb6pY9srH1SStmjfV2OYCHEC6/2l6DnPy8vizdOj05SV1dJw8NVaAOeB2EIZ89c5dhnfWenpq63G4KLFJAD/f3TV34bPJX5a4Itj9/Bhs1VEILRQAg6gNr0bbTteKyuvGJZt/aDCgrI4liCIqso2dLkcl9DKb4HUoDIBwFaQ/WqpbTt3JR2q5cfM8a45EkhxPqm5pXPNz/q4uUACdICW4Al81OAp2G5G6Nl071ppYKtQSj5J8hksujlLU/UOOQ58kZRWCAlCAmhBcXXfyD1xys43uUwxM4WOzPE7FlkICglGsMYsCUI8d8XhAUlYoLUpWeJjnfhXtg1s3vthwNfNb3B0cZOpJdT3uUhGMnky9aNkm2BZcPiOLhVJfwylyYbJKlrScSfqjn/FoYVUTtAjo2Ov9nzUe/wtbGA6VmQ5C+REA9HKYmFfNA9yPaPW7uHf8y8RGZ8lnX3p4naJwhYI8Mw7Dv93bmNXQe/GRweUeQ0SBtiF99h8elmzh18kd7D77+74ebDu5KL1AF+/bOdod8zJBMuIWWiaf17KJ3DV8HqO9eu+KRjT0vt7ambsI7Uw5IZspmAyfNX9laWevtRQAgE1CMoQ/L1vwt8rQBQSlesSt3a/cyOhxq/P358Zltkz1Dl5nvWMDEGZy68DexFoCkgKRCJ2MMDl0Za973+6aEjvXaHmuMBTvT1ULwMUu5rGLazgM0CjiMngZ3SVwgbUDzNt6c8ovY6LH5igb8BucA1WORtKKUAAAAASUVORK5CYII=)';
function buttonFunction() {
openUILinkIn('about:config','tab');
};
var button = document.createElement('toolbarbutton');
button.id = buttonId;
button.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional');
button.removable = 'true';
button.setAttribute('label', buttonLabel);
button.setAttribute('tooltiptext', buttonTooltiptext);
button.style.listStyleImage = buttonIcon;
button.addEventListener('click', function (event) {
if (event.button == 0)
buttonFunction();
});
document.getElementById('navigator-toolbox').palette.appendChild(button);
var toolbars = document.querySelectorAll('toolbar');
Array.slice(toolbars).forEach( function (toolbar) {
var currentset = toolbar.getAttribute('currentset');
if (currentset.split(',').indexOf(button.id) < 0) return;
toolbar.currentSet = currentset;
try {
BrowserToolboxCustomizeDone(true);
} catch (ex) {
}
});
}) ();
Alles anzeigen