如何以编程方式检测 Firefox 的“视图”>“工具栏”菜单中是否启用了特定工具栏

发布于 2024-08-18 10:29:33 字数 178 浏览 2 评论 0原文

我试图确定 Firefox 的“视图”>“工具栏”菜单中是否已启用特定工具栏(即:可见)。我可以确定是否安装了工具栏(附加组件)。我可以在“工具”>“附加组件”中确定是否启用它。但是,我似乎无法通过“视图”>“工具栏”菜单项检测已安装的工具栏是否实际上已启用/可见。是否有一个配置文件或 sqlite 表来存储我缺少的信息?

I am trying to determine if a particular toolbar is already enabled (meaning: made visible) in Firefox's View>Toolbar menu. I can determine if a toolbar (add-on) is installed. I can determine if it is enabled in Tools>Add-ons. I cannot, however, seem to detect if an installed toolbar is actually enabled/visible vie the View>Toolbars menu item. Is there a config file or sqlite table that stores this info that I am missing?

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

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

发布评论

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

评论(1

风筝在阴天搁浅。 2024-08-25 10:29:33

在 browser.xul 覆盖层的上下文中,使用

if (document.getElementById("toolbar-id").collapsed) // hidden

...其中toolbar-id 是您感兴趣的 元素的 id

(这就是Firefox 在填充 View > Toolbars 菜单时会执行什么操作,您可以通过在 DOM Inspector 中检查它来找到它,看到它在 popupshowing 处理程序中调用 onViewToolbarsPopupShowing 并查找该函数的源代码: href="http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#4566" rel="nofollow noreferrer">http://mxr.mozilla.org/mozilla- Central/source/browser/base/content/browser.js#4566 )

In the context of a browser.xul overlay, use

if (document.getElementById("toolbar-id").collapsed) // hidden

...where toolbar-id is the id of the <toolbar> element you're interested in.

(That's what Firefox does when populating the View > Toolbars menu, which you could find by inspecting it in the DOM Inspector, seeing it calls onViewToolbarsPopupShowing in the popupshowing handler and looking up the source for that function: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#4566 )

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