/** * Installs the toolbar button with the given ID into the given * toolbar, if it is not already present in the document. * * @param {string} toolbarId The ID of the toolbar to install to. * @param {string} id The ID of the button to install. * @param {string} afterId The ID of the element to insert after. @optional */ functioninstallButton(toolbarId, id, afterId) { if (!document.getElementById(id)) { var toolbar = document.getElementById(toolbarId);
// If no afterId is given, then append the item to the toolbar var before = null; if (afterId) { let elem = document.getElementById(afterId); if (elem && elem.parentNode == toolbar) before = elem.nextElementSibling; }
if (toolbarId == "addon-bar") toolbar.collapsed = false; } }
if (Application.prefs.getValue("extensions.peercast-radio.first-kick", false)) { installButton("nav-bar", "peercast-radio-toolbarbutton"); // The "addon-bar" is available since Firefox 4 // installButton("addon-bar", "my-extension-addon-bar-button"); }