更改Firefox附加安装图标 [英] Changing Firefox addon install icon

查看:129
本文介绍了更改Firefox附加安装图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用附加SDK 。我改变了我的package.json文件来包含一个32x32图标和一个64x64图标的条目。

  {
.. 。
icon:icons / icon-32.png,
icon64:icons / icon-64.png,
...
}

另外,我把icon-32.png和icon-64.png放在<$ c $在软件包目录下运行 cfx xpi 之前,在我的软件包目录中找到



图标正确显示在插件管理器中,从 Tools>加载项,但安装对话框仍然使用拼图图标。



我自己托管Firefox附加组件。首先,我认为这可能是因为我还没有签署xpi文件,但是我注意到还有很多其他的附加组件这是没有签名,但仍然在安装对话框中有正确的图标。



我也认为,这可能是因为图标不是位于xpi文件,或者可能是由附加SDK生成的install.rdf文件不正确,但是我解压缩了xpi文件,发现cfx已经把图标放在根目录下,并将它们重命名为默认名称(icon.png和并且在install.rdf中省略了文件名(将它们指向默认图标)。

如何更改安装图标?

/ strong>


安装图标只能在Firefox中进行更改

使用 InstallTrigger 开始安装,这些行:
$ b

function install(link)
{
params = {};
params [link.getAttribute(addonName)] = {
URL:link.href,
IconURL:link.getAttribute(iconURL)
};
InstallTrigger.install(params);

$ / code>

您的链接如下所示:

< a href =foo.xpiaddonName =FooiconURL =foo.png
onclick =install(this); return false;>
安装
< / a>

请注意,它仍然是一个链接 - 如果用户禁用JavaScript,您的 install()函数将不会被调用。用户只需按照链接进行操作,无论如何安装都将开始。


I'm working on developing a Firefox add-on using the Add-on SDK. I changed my package.json file to include entries for a 32x32 icon and a 64x64 icon.

{
    ...
    "icon": "icons/icon-32.png",
    "icon64": "icons/icon-64.png",
    ...
}

Furthermore, I placed icon-32.png and icon-64.png in the directory icons inside my package directory before running cfx xpi inside the package directory.

The icons correctly display in the addon manager from Tools > Add-ons, but the installation dialog still uses a puzzle piece icon.

I am self-hosting the Firefox add-on.

At first, I thought it might be because I wasn't yet signing the xpi file, but I noticed that there are many other add-ons that are not signed but still have the correct icon in the installation dialog.

I also thought that it might be because the icon wasn't located in the right place within the xpi file or perhaps that the install.rdf wasn't correctly generated by the add-on SDK, but I unzipped the xpi and found that cfx had put the icons in the root directory and renamed them to the default names (icon.png and icon64.png) and had omitted the filenames in the install.rdf (pointing them to the default icons).

How can I change the installation icon?

Can installation icons only be changed when hosting with Firefox?

解决方案

The installation dialog doesn't take the icon from the package, it uses the information supplied by the web page. Your web page needs to use InstallTrigger to start the installation, along these lines:

function install(link)
{
  params = {};
  params[link.getAttribute("addonName")] = {
    URL: link.href,
    IconURL: link.getAttribute("iconURL")
  };
  InstallTrigger.install(params);
}

And your link would look like this:

<a href="foo.xpi" addonName="Foo" iconURL="foo.png"
   onclick="install(this); return false;">
  Install
</a>

Note that it still has to be a link - if the user has JavaScript disabled your install() function will not be called. The user will simply follow the link instead and installation will start regardless.

这篇关于更改Firefox附加安装图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆