Skip to content

Instantly share code, notes, and snippets.

function addButton(toolbarId, buttonId, label, iconPath, firstRun) {
var toolbar = document.getElementById(toolbarId);
var toolbarButton = document.createElement("toolbarbutton");
toolbarButton.setAttribute("id", buttonId);
toolbarButton.setAttribute("type", "button");
toolbarButton.setAttribute("removable", "true");
toolbarButton.setAttribute("class",
"toolbarbutton-1 chromeclass-toolbar-additional");
toolbarButton.setAttribute("label", label);
toolbarButton.style.listStyleImage = "url(" + iconPath + ")";