- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
今天是我使用 Firefox 扩展的第一天。
基本上,我正在制作一个将在内部网络上使用的扩展程序,以检查 Web 服务器是否有新通知。
我使用 mozilla 页面上的向导制作了一个骨架扩展,然后主要用一些 ajax 代码编辑了 overlay.js。
我正在使用“加载”事件监听器向我的 ajax 调用调用 setTimeout,然后使用 setTimeouts 循环。
问题似乎是在每个新的浏览器窗口上执行“加载”事件监听器。我只想要一个全局计时器来解决这个问题。
有任何想法吗?
更新:
我发现了这个:https://developer.mozilla.org/en/JavaScript_code_modules/Using
这似乎是我想要的。问题是我不知道如何导入 jsm 文件。目录结构是什么?
更新:
尝试此操作时:
chrome.manifest
content spt chrome/content/
skin spt classic/1.0 chrome/skin/
locale spt en-US chrome/locale/en-US/
overlay chrome://browser/content/browser.xul chrome://spt/content/ff-overlay.xul
style chrome://global/content/customizeToolbar.xul chrome://spt/skin/overlay.css
resource mycontent chrome/content/
try{
Components.utils.import("resource://spt/mycontent/ajax.jsm");
}catch(err){
alert(err);
}
try{
Components.utils.import("chrome://spt/content/ajax.jsm");
}catch(err){
alert(err);
}
最佳答案
是的,如果您的代码应该在窗口之间共享(并且在加载新窗口时不应执行)并且不需要访问 chrome,请使用 JavaScript code modules .
您可以使用以下命令导入模块:
Components.utils.import("resource://youraddon/your_module.jsm");
resource
在您的
chrome.manifest
.例如。如果你添加
resource youraddon modules/
/path/to/your/addon/modules/your_module.jsm
.
.jsm
.你可以离开它.js
.有时与某些编辑器(和语法突出显示等)一起工作得更好。 setTimeout
在一个模块中,因为它无法访问 window
目的。我建议使用 nsITimer
. 关于firefox-addon - 如何使 Firefox 扩展中的代码在计时器上执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4629893/
我正在开发一个 Firefox 插件,我假装我的插件能够在桌面和移动设备上运行。我认为或多或少所有东西都与这两种环境兼容,但是我想根据当前设备是移动设备还是桌面设备来运行一些代码,所以问题是是否有类似
我正在开发一个 Firefox 插件,我不确定的一件事是如何在用户卸载插件时删除与我的插件相关的用户首选项。首选项被设置,如果用户卸载并重新安装首选项仍然存在。一些设置还与第一次安装有关,因此如果用户
使用 SDK 制作对话框的正确方法是什么(它没有锚定到附加栏等,而是显示在屏幕中央)?这个重要功能似乎没有任何 API。我确实看到 windows/utils 有 open 但我有两个问题: 打开对话
我遵循了几个教程但没有成功。我认为这是经典的例子,但我无法让它发挥作用。我可以保存我的项目,安装插件,当我选择一些文本时我可以看到上下文菜单项“日志选择”,但是当我点击它时没有任何反应。 export
我刚刚制作了一个 FF 插件并制作了一个简单的网站。我希望访问者点击“下载”按钮安装插件,而不是下载。它在本地有效,但在我上传网站时无效。我检查了 mozilla 存储库,它们也只是链接到 xpi 文
构建传统的 Firefox 扩展,您将在 install.rdf 中设置 minVersion 字段。由于这是由 package.json 和 cfx 抽象出来的,有没有办法设置 minVersion
请告诉我如何在 odoo9 中将文件夹(例如:custom_module)添加到“./odoo.py --addons=./addons” 我正在尝试将 custom_module 添加到“”./od
我用 simple-prefs配置插件设置的模块。我怎么能以编程方式 打开插件的设置页面? 最佳答案 我们在 test add-on here 中执行此操作 那里的代码比您需要的要多,因此较短的版本是
我有一个带有工作回调构造的插件: 库/main.js: function myLogin(loginname,loginfield) { var pageUrl = tabs.activeTa
为了在我的服务器上为我的插件提供自动更新,我需要创建一个 update.rdf文件。 我如何生成这样的文件? 文档非常多:https://developer.mozilla.org/en-US/doc
我在此链接中阅读了有关“请求”功能的信息: https://addons.mozilla.org/en-US/developers/docs/sdk/1.1/packages/addon-kit/do
我正在尝试使用 nsIHttpChannel 使用 firefox 插件 sdk 读取 header 喜欢.. var httpChannel = subject.QueryInterface(Ci.
有没有办法在内容脚本中访问 Fire Fox addon sdk 中的 Html5 文件 api? 这是为了存储用户添加的单词及其含义所必需的。数据可能会变大,因此本地存储不是一种选择。 windo
两者有什么区别: import React from 'react/addons'; let {PropTypes} = React; 对比 import React, { PropTypes } f
tl;dr:我们使用 Addon SDK 创建了一个 firefox 插件。由于编译插件是更大的构建系统中的一个步骤(我们也为 chrome 编译),我们的构建系统手动打包 xpi 并且不使用 jpm
我是 Windows 7 64 位用户,我在更新最新版本的 Android Studio 和 SDK 后遇到了 Android Studio 问题组件.. The following SDK comp
我正在研究一个Firefox扩展。问题是,如果我进行了任何更改,我需要关闭然后重新打开firefox浏览器以查看更改。我可以通过刷新页面来查看那些更改吗? 最佳答案 您可能想尝试Restart Fir
似乎是您从属性 title="test" 获得的工具提示不显示在面板内。 也用 stackoverflow loaded in the panel 测试过, 将鼠标悬停在热门、周、月上时没有工具提示。
截至 2019 年 6 月 27 日,所有语言词典的下载量约为 1,800 次。我已从该页面查看了一些示例仪表板... https://addons.mozilla.org/en-US/firefox
我正在尝试通过 msi 安装程序静默安装 firefox xpi。我是通过以下方法这样做的: 解压我的 xpi在某个临时目录中并将其中的所有内容复制到 %APPDATA%\Mozilla\Firefo
我是一名优秀的程序员,十分优秀!