javascript - 在 Firefox Addons 中创建这种弹出窗口?

标签 javascript firefox firefox-addon add-on

enter image description here

我正在尝试创建一个像这样的弹出窗口用于我的插件 - 这可能吗?如果是这样,它是如何完成的?

提前致谢!

最佳答案

这在 Firefox/XUL 中是可能的,它也被称为 door-hanger popuphttps://developer.mozilla.org/en/JavaScript_code_modules/PopupNotifications.jsm#Notification_events http://scenari-platform.org/svn/dev-core/trunk/Lib_XulRunner/Darwin/modules/PopupNotifications.jsm

比如这里的代码是弹窗通知带超时功能,不想要可以去掉超时功能。

超时功能的正常功能,如果用户点击浏览器上的任何地方,它会自动消失。

Components.utils.import('resource://app/modules/PopupNotifications.jsm');
var notify  = new PopupNotifications(gBrowser,
                                       document.getElementById("notification-popup"),
                                       document.getElementById("notification-popup-box"));

var notification =  notify.show(
gBrowser.selectedBrowser,  /*browser*/
"Extension-popup", /*id*/
"Hi, there!, I got a message for you!!",/*message*/
null, /* anchor ID */
/* mainAction */
{
          label: "Build PDE",
          accessKey: "D",

          callback: function() {
                      if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC);

              window.openDialog("chrome://myextension/content/mypage.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC);

          }
        },
null, /* secondaryActions*/

{ blablal:'options'}

);

setTimeout(function(){
notification.remove();
}, 900);

关于javascript - 在 Firefox Addons 中创建这种弹出窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7816749/

相关文章:

javascript - 如何通过给定的URL获取YouTube音频数据

javascript - 如何在删除字段时计算输入字段值并将其分配给另一个字段

firefox - 在FF开发工具中查找localStorage

javascript - FF 中的 shift-reload 给出了意想不到的结果

firefox - 如何使用带有 node.js 的 Selenium WebDriver 最大化 firefox 浏览器窗口

python - Selenium Firefox Webdriver 驱动程序 : extension (IETab v2) configurations - Python

javascript - 有没有办法确定 iframe 是否可见/事件

javascript - 使用 Chrome 扩展时从弹出窗口获取网页的 document.body

将 POST 请求转换为 GET 的 Firefox 插件?

Javascript,隐藏复选框未选中的 div 时的函数,请记住页面刷新