Using Add-on SDK to add toolbar buttons? Integrating XUL and Add-on SDK for Firefox Add-ons?

我怕爱的太早我们不能终老 提交于 2019-11-27 02:54:24

问题


I have already coded most of a Firefox add-on using the Add-on SDK API. I am now discovering that Add-on SDK might not be powerful enough for my purposes. I need two things:

  1. A drop down button in the toolbar next to the location bar.
  2. To modify the add-ons manager in firefox

It is truly disappointing, but I don't believe either of these is possible with the Add-on SDK.

First of all, I understand there is a widget module in the Add-on SDK API. But this only allows me to add a simple icon or label to the awkward add-on bar. What if I need to add a nicer button like the one next to the location bar for Firebug or Greasemonkey? As for modifying the add-ons manager in firefox, I have tried Nickolay Ponomarev's XUL with the Add-on SDK without any success whatsoever. If anyone knows how to get this working and can point me in the right direction that would be extremely helpful (cfx init --template xul doesn't do anything the regular SDK does when I try it)


回答1:


Have you looked at Erik Vold's toolbarbutton module?

https://github.com/erikvold/toolbarbutton-jplib/

It is possible to access all of Firefox's internal apis in SDK modules by requiring chrome privileges; it just won't be as easy as the addon-kit high level apis.




回答2:


The toolbarbuttonlib-jplib referenced above no longer exists, but try toolbarwidget-jplib. It works like a charm! Total life saver.




回答3:


tried Nickolay Ponomarev's XUL with Jetpack without any success whatsover. If anyone knows how to get this working and can point me in the right direction that would be extremely helpful (cfx init --template xul doesn't do anything the regular sdk does when I try it)

I would very much like to hear the detailed description of what you tried and how exactly it failed. I can't answer the question in its current form.

I don't believe either of these is possible with JetPack.

You mean using only the built-in high-level SDK modules. It's possible to write a low-level SDK module that uses XPCOM and interacts with chrome code directly to implement the features you need -- after all that's how the rest of SDK modules are implemented. If you go this route you lose the future compatibility promise of the SDK though -- you'll have to either get it included in the upstream SDK or to update it for the newer Firefox versions yourself.



来源:https://stackoverflow.com/questions/7670282/using-add-on-sdk-to-add-toolbar-buttons-integrating-xul-and-add-on-sdk-for-fire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!