Additionally to extensions also javascript-scripts (using the userchrome.js-addon) can create movable buttons that appear in the Firefox dialog to customize toolbars and in the PM dialog to customize PM menu toolbars.
Unfortunately PM does not only clone these buttons but steals them from a Firefox toolbar if they are placed there. So it is possible to show such a button in a PM menu toolbar but not on any other toolbar if PM is active.
What makes it worse: Deactivating PM doesn't bring the button back, only setting up a new profile. By now I didn't find a different way.
Can you, please, fix that problem?
Here is the code of such a script:
Code: Select all
// RestartFirefoxButtonM.uc.js
// v. 0.1.1
(function RestartButton() {
function createBtn() {
var navigator = document.getElementById("navigator-toolbox");
if (!navigator || navigator.palette.id !== "BrowserToolbarPalette") return;
var BrowserManipulateBtn = document.createElement("toolbarbutton");
BrowserManipulateBtn.id = "restart-button";
BrowserManipulateBtn.setAttribute("type", "button");
BrowserManipulateBtn.setAttribute("onclick", "BrowserRestart.onClick(event);");
BrowserManipulateBtn.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
BrowserManipulateBtn.setAttribute("removable", "true");
BrowserManipulateBtn.setAttribute("oncontextmenu","return false"); //remove original button context menu
BrowserManipulateBtn.style.listStyleImage = "url('data:image/png;base64,HERE I DELETED THE BASE64 CODE FOR THE ICON, IT TOOK TO MUCH SPACE')";
BrowserManipulateBtn.setAttribute("label", " Neustart");
var tooltipText = "Neustart (mit Rechts- und Mittelklick wird userChrome.js-Cache geleert)";
BrowserManipulateBtn.setAttribute("tooltiptext", tooltipText);
navigator.palette.appendChild(BrowserManipulateBtn);
}
BrowserRestart = {
onClick: function(event) {
if (event.button==1 || event.button==2) {
var xRE = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
xRE.invalidateCachesOnRestart();;
}
var boot=Components.classes['@mozilla.org/toolkit/app-startup;1'].getService(Components.interfaces.nsIAppStartup);
boot.quit(Components.interfaces.nsIAppStartup.eForceQuit|Components.interfaces.nsIAppStartup.eRestart);
}
}
function updateToolbar() {
var toolbars = document.querySelectorAll("toolbar");
Array.slice(toolbars).forEach(function (toolbar) {
var currentset = toolbar.getAttribute("currentset");
if (currentset.split(",").indexOf("restart-button") < 0) return;
toolbar.currentSet = currentset;
try {
BrowserToolboxCustomizeDone(true);
} catch (ex) {
}
});
}
createBtn();
updateToolbar();
})();