尽管点击浏览器中打开的页面,但仍使面板保持不变

发布于 2025-01-07 03:25:25 字数 276 浏览 4 评论 0原文

我想实现这个

  1. 将面板锚定到小部件
  2. 使其持久化
  3. 它只会在单击小部件时出现或消失
  4. ,或者可以通过单击其上的某个按钮使其消失 我想实现这一目标,因为我的插件完全驻留在面板中 这里是插件。

I want to achieve this

  1. Anchor a panel to a widget
  2. make it persist
  3. It will only appear or disappear when widget is clicked
  4. or It may be made to disappear by clicking some button on it
    I want to achieve this because my addon is entirely residing in a panel
    Here is the addon.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凤舞天涯 2025-01-14 03:25:25

好吧,我对此进行了更多研究,我想对以下几件事表示歉意:

  1. 由于跨域安全问题,iframe 将无法工作。那是一个死胡同。
  2. 我花了太长时间才回复你,我一直在度假,而我们住的地方每个房间每天只允许 30 分钟的无线网络。

解决此问题的一种方法是直接从数据文件夹加载 html,将其传递到内容脚本中并将其注入到页面中。像这样的东西:

https://builder.addons.mozilla.org/addon/1043886/最新/

一些可用性指南:

  1. 用户应该能够轻松且明显地从页面中删除注入的内容。如果需要保留注入内容的状态,则需要在删除 DOM 节点之前存储它。
  2. 注入可能只应在用户执行操作时发生,例如通过单击小部件。这至少应该是默认的。
  3. 像往常一样,应该非常小心地处理从注入内容发送回 main.js 附加代码的任何数据。不要相信网络上的数据!

Ok, I looked at this a bit more, and I'd like to apologize for a couple of things:

  1. iframe won't work due to cross-domain security issues. That was a dead end.
  2. I took waaay too long to get back to you, I've been on holiday and the place we were staying at only allowed 30 minutes of wifi per day, per room.

One way to approach this is to load your html directly from the data folder, pass it into the content script and inject it into the page. Something like this:

https://builder.addons.mozilla.org/addon/1043886/latest/

Some usability guidelines for this:

  1. the user should be able to easily and obviously remove the injected content from the page. If you need to preserve the state of the injected content, you'll need to store that before removing the DOM nodes.
  2. the injection should probably only happen when the user makes an action, eg by clicking on a widget. This should at least be the default.
  3. there should be very careful handling of any data that gets sent back to the main.js add-on code from the injected content, as per usual. DO NOT TRUST DATA FROM THE WEB!
秋叶绚丽 2025-01-14 03:25:25

你的意思是“noautohide”面板属性?

看来您无法使用addon SDK访问Panel对象,因此您可以创建自己的XUL面板来设置noautohide=true。

You mean "noautohide" panel property?

It seems you cannot access to Panel object using the addon SDK, so you can create your own XUL Panel to set noautohide=true.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文