Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I try to add a new button to Firefox, but it’s the old button that gets added!

1 view
Skip to first unread message

Delirium tremens

unread,
Nov 23, 2009, 2:17:41 PM11/23/09
to
Once, I tried adding a button with "bookmark-item pagerank" as class
to PersonalToolbar. Now, the code...

function createBookmarkItem() {
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul";
var anitem = document.createElementNS(XUL_NS, "toolbarbutton");
anitem.setAttribute("id", "Testing-Doit-Button2");
anitem.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-
additional pagerank");
anitem.setAttribute("label", "PageRank");
anitem.setAttribute("tooltiptext", "Do it!");
anitem.setAttribute("oncommand", "testing_doit();");
return anitem;
}
function placeBookmarkItem() {
var bar = document.getElementById("nav-bar");
var newitem = createBookmarkItem();
bar.appendChild(newitem);
}
placeBookmarkItem();

...adds a button with "bookmark-item pagerank" instead of
"toolbarbutton-1 chromeclass-toolbar-additional pagerank" as class to
PersonalToolbar instead of nav-bar!

How to solve this problem?

Delirium tremens

unread,
Nov 25, 2009, 5:09:35 PM11/25/09
to
The function names are still the old ones. They were supposed to be
createToolbarButton and placeToolbarButton. I'm sorry!

Delirium tremens

unread,
Nov 26, 2009, 8:16:09 AM11/26/09
to
On 23 nov, 17:17, Delirium tremens <pedbe...@gmail.com> wrote:

Now, it works! In the Javascript Shell, typing a function with the
same name as an other function in button.js and hiting enter, even if
they have different behaviors, will call the function in button.js

By the way, to use the Javascript Shell the way I used, you have to
install Extension Developer's Extension, then go Firefox -> Tools ->
ExtensionDeveloper -> Javascript Shell -> enumerateWindows() ->
chrome://browser/content/browser.xul

0 new messages