Skip to content

Instantly share code, notes, and snippets.

@jblanche
Created March 25, 2011 16:13
Show Gist options
  • Save jblanche/887106 to your computer and use it in GitHub Desktop.
Save jblanche/887106 to your computer and use it in GitHub Desktop.
adding the button to the toolbar
Application.getExtensions(function (extensions) {
let extension = extensions.get('[email protected]');
if (extension.firstRun) {
var myId = "enjoyreading-toolbar-button"; // ID of button to add
var afterId = "urlbar-container"; // ID of element to insert after
var navBar = document.getElementById("nav-bar");
var curSet = navBar.currentSet.split(",");
if (curSet.indexOf(myId) == -1) {
var pos = curSet.indexOf(afterId) + 1 || curSet.length;
var set = curSet.slice(0, pos).concat(myId).concat(curSet.slice(pos));
navBar.setAttribute("currentset", set.join(","));
navBar.currentSet = set.join(",");
document.persist(navBar.id, "currentset");
try {
BrowserToolboxCustomizeDone(true);
}
catch (e) {}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment