Created
December 30, 2012 14:59
-
-
Save azu/4413137 to your computer and use it in GitHub Desktop.
Addon-SDK : anchor a panel to a widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var socialWidget = require("widget").Widget({ | |
id : "open-clock-btn", | |
label : "Clock", | |
contentURL : "http://www.mozilla.org/favicon.ico", | |
panel : socialPanel, | |
onClick : seeingHatenaBookmark | |
}); | |
function getItemNodeForWidget(widget){ | |
var item; | |
for (var win in require("window-utils").windowIterator()){ | |
var doc = win.document; | |
var bar = doc.getElementById("addon-bar"); | |
var selector = 'toolbaritem[id$="' + widget.id + '"]'; | |
item = bar.querySelector(selector); | |
} | |
return item; | |
} | |
var item = getItemNodeForWidget(socialWidget); | |
socialPanel.show(item); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment