xul - 没有或错误的工具栏按钮图像
就这个小事我花了一整天还是不行 使这项工作发挥作用。出现一个巨大的奇怪图像而不是我的图标。如果我取出工具栏按钮 1 类,则根本不会出现图像。以下是所有重要的内容:(这将是一篇非常长的文章...)
我的 XUL 仅包含工具栏上的一个工具栏按钮:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://ytweaks/skin/style.css" type="text/
css"?>
<overlay id="yTweaks" xmlns="http://www.mozilla.org/keymaster/
gatekeeper/there.is.only.xul">
<script src="main.js" />
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="ytweaks-main-button" class="toolbarbutton-1
chromeclass-toolbar-additional"
type="menu"
label="yTweaks"
tooltiptext="yTweaks"
state="enabled">
</toolbarbutton>
</toolbarpalette>
</overlay>
CSS 与 MDN 教程中的 CSS 相同:
#ytweaks-main-button {
list-style-image: url("chrome://ytweaks/skin/icon.large.png");
}
toolbar[iconsize="small"] #ytweaks-main-button {
list-style-image: url("chrome://ytweaks/skin/icon.small.png");
}
清单文件看起来像这样:
content ytweaks chrome/content/
overlay chrome://browser/content/browser.xul chrome://ytweaks/content/ui.xul
skin ytweaks classic/1.0 skin/classic/ytweaks/
style chrome://global/content/customizeToolbar.xul chrome://ytweaks/skin/style.css
文件夹结构:
chrome
|-- content
| |-- ui.xul
| |-- main.js
|-- skin
|-- classic
|-- ytweaks
|-- icon.large.png
|-- icon.small.png
|-- style.css
最后,结果如下所示:
完全不是我制作的图标。这是我应该出现的图标( 大的):
另外,我如何调试这些东西?例如,我如何浏览 铬注册表。如果我在 Firefox 中输入 chrome URI,则什么也不会发生。 除了浏览器的主 XUL 文件加载另一个完整的 浏览器。
I spent a whole day on something so trivial as this one, still can't
make this work. A huge weird image appears instead of my icon. If I take out the toolbarbutton-1 class no image will appear at all. Here are all the stuff that matters: (This is going to be an awfully long post...)
My XUL contains only a toolbarbutton on the toolbarpalette:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://ytweaks/skin/style.css" type="text/
css"?>
<overlay id="yTweaks" xmlns="http://www.mozilla.org/keymaster/
gatekeeper/there.is.only.xul">
<script src="main.js" />
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="ytweaks-main-button" class="toolbarbutton-1
chromeclass-toolbar-additional"
type="menu"
label="yTweaks"
tooltiptext="yTweaks"
state="enabled">
</toolbarbutton>
</toolbarpalette>
</overlay>
And the CSS is the same as the one in the MDN tutorial:
#ytweaks-main-button {
list-style-image: url("chrome://ytweaks/skin/icon.large.png");
}
toolbar[iconsize="small"] #ytweaks-main-button {
list-style-image: url("chrome://ytweaks/skin/icon.small.png");
}
The manifest file looks like this:
content ytweaks chrome/content/
overlay chrome://browser/content/browser.xul chrome://ytweaks/content/ui.xul
skin ytweaks classic/1.0 skin/classic/ytweaks/
style chrome://global/content/customizeToolbar.xul chrome://ytweaks/skin/style.css
And the folder structure:
chrome
|-- content
| |-- ui.xul
| |-- main.js
|-- skin
|-- classic
|-- ytweaks
|-- icon.large.png
|-- icon.small.png
|-- style.css
And finally, the result looks like this:
Totally not the same icon I made. This is my icon that should appear (the
large one):
Also, how can I debug these stuff? For example, how can I browse the
chrome registry. If I type a chrome URI in firefox nothing happens.
Except for the browser's main XUL file which loads another full
browser.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,这是由于此处的路径无效:
..应该是:
Re:调试。我会测试 3 件事:
style
行)。我不知道你如何在这里调试拼写错误。No chrome package Registered for chrome://aaa/skin/aaa.css
消息,则您在 chrome.manifest 中的skin
声明并未生效未得到处理或“provider”名称(在上面的示例中为aaa
)与“skin”后指定的“provider”名称不匹配找不到文件。 Firefox 在 chrome://aaa/skin/bbb.css
处找不到该文件(如您的情况),这意味着skin
声明的路径部分不正确。它应该相对于 chrome.manifest(以及以 / 结尾的 iirc)This turned out to be due to invalid path here:
..which should be:
Re: debugging. I'd test 3 things:
style
line in your chrome.manifest). I don't know how you can debug typos here.No chrome package registered for chrome://aaa/skin/aaa.css
message in the Error Console, yourskin
declaration in chrome.manifest didn't get processed or the 'provider' name (aaa
in my example above) doesn't match the 'provider' name specified after "skin"File not found. Firefox can't find the file at chrome://aaa/skin/bbb.css
(as in your case), it means the path part of theskin
declaration is incorrect. It should be relative to the chrome.manifest (and iirc ending with a /)根据您上面提供的信息,如果这是您的路径
ytweaks/skin/icon.small.png
但您的文件夹结构是那么在我看来您要么缺少
skin< /code> 子文件夹位于
ytweaks
中,否则您不应将其包含在图像路径中。Based off the information you gave above, if this is your path
ytweaks/skin/icon.small.png
but your folder structure isThen it looks to me like you are either missing a
skin
subfolder inytweaks
or you should not have that in your image path.