从附加工具包修改Firefox下载对话框的内容 [英] Modify contents of Firefox download dialog from add-on kit

查看:96
本文介绍了从附加工具包修改Firefox下载对话框的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在启动文件下载时在Firefox中弹出的下载对话框中添加一个选项。是否有可能使用新的附加SDK,或者我必须以旧的方式做到这一点?



编辑:显然,如果选择新的选项,我需要一种方法来知道它并根据它执行代码。

解决方案

没有现成的模块可以帮助你知道,所以你必须创造一个,或等待一个由别人。但扩展浏览器用户界面的主要想法很简单,如下所示:


  1. 当插件被加载时,扫描打开的窗口键入你想要的扩展名。
  2. 通过在页面中添加xul元素和javascript来扩展打开的窗口。
  3. 监听新打开的窗口,测试他们是你打开的类型,一旦他们打开

  4. 当你的插件处于活动状态时,扩展新打开的窗口

  5. 窗口关闭或当您的插件被禁用/卸载。

最后一步是最重要的,而不是重新启动。

一些内置模块,你可以看到这样做的部件模块,上下文菜单模块和热键模块你可以在这里找到所有这些



我自己做了一对夫妇它们是工具栏按钮模块,xulkeys模块,menuitems模块和一些其他的全部你可以在这里找到


I'd like to be able to add an option to the download dialog that pops-up in Firefox when starting a file download. Is it possible to do so using the new add-on SDK or do I have to do it the old way?

edit: Obviously, if the new option is selected, I need a way to know it and execute code based on it.

解决方案

There is no existing module that will help you that I know of, so you would have to create one, or wait for one to be made by someone else. But the main idea to extending browser UI is simple, and goes like this:

  1. When the addon is loaded, scan for open windows of the type that you wish to extend.
  2. extend the open windows by adding xul elements and javascript to the page.
  3. listen for newly opened windows, and test that they are the type that you are looking for once they open
  4. extend newly opened windows while your addon is active
  5. Clean up after yourself when windows close or when your addon is disabled/uninstalled.

The last step is the most important and never matter with old school extensions which were not restartless.

Some for the built-in modules that you can look at that do this are the widget module, the context menu module, and the hotkeys module, all of which you can find here.

I've made a couple myself which are the toolbar button module, the xulkeys module, the menuitems module, and a few others, all of which you can find here.

这篇关于从附加工具包修改Firefox下载对话框的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆