Smiley Themes 编辑

A smiley theme for Chat Core (used by Instantbird and Thunderbird) is very easy to create, it contains a bunch of image files, a theme.js file and the necessary packaging around it to make it an extension.

theme.js

This file describes the theme: it lists the sequences of characters that should be associated with the various images in the theme.

This file uses the JSON format, you can check this format using JSLint or JSONLint. This is recommended as it's very easy to miss small mistakes.

You'll also need to escape certain special characters with a backslash. If you use unicode characters, make sure themes.js is properly UTF-8 encoded.

Here is an example:

{
 "smileys": [
   {"filename": "smile.png", "textCodes": [":-)", ":)"]},
   {"filename": "smile-big.png", "textCodes": [":-D", ":D"]},
   {"filename": "wink.png", "textCodes": [";-)", ";)"]},
   {"filename": "tongue.png", "textCodes": [":-P", ":P", ":-p", ":p"]},
   {"filename": "neutral.png", "textCodes": [":-|", ":|"]},
...
   {"filename": "bored.png", "textCodes": ["-_-"]},
   {"filename": "annoyed.png", "textCodes": ["-_-'"]},
   {"filename": "big-eyes.png", "textCodes": ["O_O", "o_o"]}
 ]
}

Packaging

A theme needs to be an xpi file to be installable in Instantbird. The typical content of an XPI of a smiley theme will be:

  • chrome/
  • chrome/skin.jar
  • chrome.manifest
  • install.rdf

Typical content of install.rdf:

<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">
    <em:id>emoticons-shortthemename@hostname.domain.tld</em:id>
    <em:name>theme name (human readable)</em:name>
    <em:version>theme version</em:version>
    <em:description>theme description</em:description>
    <em:creator>author name</em:creator>

    <!-- Instantbird -->
    <em:targetApplication>
      <Description>
        <em:id>{33cb9019-c295-46dd-be21-8c4936574bee}</em:id>
        <em:minVersion>0.2a1pre</em:minVersion>
        <em:maxVersion>0.2.*</em:maxVersion>
      </Description>
    </em:targetApplication>
  </Description>
</RDF>

Typical content of chrome.manifest:

skin shortthemename	classic/1.0	jar:chrome/skin.jar!/

All the values in italic in the 2 previous listings should be replaced with appropriate values for your theme.

Important: Please note that for your theme to work, shortthemename in the chrome.manifest and install.rdf files should be identical. The ID of your theme has to start with emoticons-.

Typical content of skin.jar:

theme.js
smile.png
smile-big.png
wink.png
tongue.png
neutral.png
...
bored.png
annoyed.png
big-eyes.png

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:76 次

字数:4479

最后编辑:7年前

编辑次数:0 次

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