热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

从附加工具包修改Firefox下载对话框的内容-ModifycontentsofFirefoxdownloaddialogfromadd-onkit

Idliketobeabletoaddanoptiontothedownloaddialogthatpops-upinFirefoxwhenstartinga

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?

我希望能够在启动文件下载时在Firefox中弹出的下载对话框中添加一个选项。是否可以使用新的附加SDK执行此操作,还是必须以旧方式执行此操作?

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

编辑:显然,如果选择了新选项,我需要一种方法来了解它并基于它执行代码。

3 个解决方案

#1


1  

That's something you would use XUL overlays for. I guess that the dialog you are talking about is chrome://mozapps/content/downloads/downloads.xul - the download manager. AFAIK doing this isn't possible with the Add-on SDK, it only provides the most common UI integration points. You could create a traditional extension however, it can overlay any dialog.

这是你将使用XUL叠加的东西。我想您正在谈论的对话框是chrome://mozapps/content/downloads/downloads.xul - 下载管理器。使用Add-on SDK无法实现AFAIK,它只提供最常见的UI集成点。您可以创建传统扩展,但它可以覆盖任何对话框。

#2


1  

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:

没有现有的模块可以帮助我,所以你必须创建一个,或等待其他人制作。但扩展浏览器UI的主要思想很简单,如下所示:

  1. When the addon is loaded, scan for open windows of the type that you wish to extend.
  2. 加载插件后,扫描要扩展的类型的打开窗口。
  3. extend the open windows by adding xul elements and Javascript to the page.
  4. 通过向页面添加xul元素和Javascript来扩展打开的窗口。
  5. listen for newly opened windows, and test that they are the type that you are looking for once they open
  6. 听取新打开的窗口,并测试它们是打开后要查找的类型
  7. extend newly opened windows while your addon is active
  8. 在您的插件处于活动状态时扩展新打开的窗口
  9. Clean up after yourself when windows close or when your addon is disabled/uninstalled.
  10. 当Windows关闭或禁用/卸载插件时,请自行清理。

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.

我自己做了几个工具栏按钮模块,xulkeys模块,menuitems模块和其他一些,你可以在这里找到所有这些。

#3


0  

Recently I wrote an extension do the same things. A bootstrap extension, not using addon-sdk.

最近我写了一个扩展做同样的事情。一个bootstrap扩展,不使用addon-sdk。

I already submit it on AMO, but wait for review

我已经在AMO上提交了它,但是等待审核

https://addons.mozilla.org/en-US/firefox/addon/download-dialog-tweak/

https://addons.mozilla.org/en-US/firefox/addon/download-dialog-tweak/

And the source code

和源代码

https://github.com/muzuiget/download_dialog_tweak

https://github.com/muzuiget/download_dialog_tweak


推荐阅读
  • Apple iPad:过渡设备还是平板电脑?
    I’vebeenagonizingoverwhethertopostaniPadarticle.Applecertainlydon’tneedmorepublicityandthe ... [详细]
  • GetWindowLong函数
    今天在看一个代码里头写了GetWindowLong(hwnd,0),我当时就有点费解,靠,上网搜索函数原型说明,死活找不到第 ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • javascript  – 概述在Firefox上无法正常工作
    我试图提出一些自定义大纲,以达到一些Web可访问性建议.但我不能用Firefox制作.这就是它在Chrome上的外观:而那个图标实际上是一个锚点.在Firefox上,它只概述了整个 ... [详细]
  • 本文介绍了Windows操作系统的版本及其特点,包括Windows 7系统的6个版本:Starter、Home Basic、Home Premium、Professional、Enterprise、Ultimate。Windows操作系统是微软公司研发的一套操作系统,具有人机操作性优异、支持的应用软件较多、对硬件支持良好等优点。Windows 7 Starter是功能最少的版本,缺乏Aero特效功能,没有64位支持,最初设计不能同时运行三个以上应用程序。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文介绍了响应式页面的概念和实现方式,包括针对不同终端制作特定页面和制作一个页面适应不同终端的显示。分析了两种实现方式的优缺点,提出了选择方案的建议。同时,对于响应式页面的需求和背景进行了讨论,解释了为什么需要响应式页面。 ... [详细]
  • 本文介绍了贝叶斯垃圾邮件分类的机器学习代码,代码来源于https://www.cnblogs.com/huangyc/p/10327209.html,并对代码进行了简介。朴素贝叶斯分类器训练函数包括求p(Ci)和基于词汇表的p(w|Ci)。 ... [详细]
  • 带添加按钮的GridView,item的删除事件
    先上图片效果;gridView无数据时显示添加按钮,有数据时,第一格显示添加按钮,后面显示数据:布局文件:addr_manage.xml<?xmlve ... [详细]
  • 本文整理了常用的CSS属性及用法,包括背景属性、边框属性、尺寸属性、可伸缩框属性、字体属性和文本属性等,方便开发者查阅和使用。 ... [详细]
  • 抽空写了一个ICON图标的转换程序
    抽空写了一个ICON图标的转换程序,支持png\jpe\bmp格式到ico的转换。具体的程序就在下面,如果看的人多,过两天再把思路写一下。 ... [详细]
  • Python中的PyInputPlus模块原文:https ... [详细]
  • C++ STL复习(13)容器适配器
    STL提供了3种容器适配器,分别为stack栈适配器、queue队列适配器以及priority_queue优先权队列适配器。不同场景下,由于不同的序列式 ... [详细]
  • FIN7后门工具伪装成白帽工具进行传播
    fin7,后门,工具,伪装,成,白, ... [详细]
  • 本篇文章笔者在上海吃饭的时候突然想到的这段时间就有想写几篇关于返回系统的笔记,所以回家到之后就奋笔疾书的写出来发布了事先在网上找了很多方法,发现有 ... [详细]
author-avatar
狸花殿并
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有