Firefox 插件,创建自己的选项页面(不是 simple-prefs/preferences)
Firefox addon, create own options page (not simple-prefs/preferences)
我正在尝试为我的第一个插件创建一个选项页面。我不想使用 simple-prefs,它没有我需要的类型。那么如何创建自己的选项页面呢?
我发现 this post. But widget 已在 firefox 38 中删除,那么还有什么其他方法可以创建自己的选项页面?
顺便说一句,firefox 的附加组件 API 似乎非常杂乱无章。过时的信息而不是一致性。有没有更好的place/forum/group查询最新信息?
这很容易做到。
这是一个简单的 html 选项演示页面的 repo:https://github.com/Noitidart/l10n/tree/html-options
重要的部分是:
- optionsType 应为 3 - https://github.com/Noitidart/l10n/blob/html-options/install.rdf#L12
- 设置路径:https://github.com/Noitidart/l10n/blob/html-options/install.rdf#L13
- 在第 1 行用 chroem.manifest 定义路径:https://github.com/Noitidart/l10n/blob/html-options/chrome.manifest#L1
- 在 html 中创建一个选项页面 - https://github.com/Noitidart/l10n/blob/html-options/my_options.xhtml
现在这个存储库制作了一个 xhtml
页面,因为这个存储库同时显示了一个完全本地化的插件。使用 xhtml 你可以使用替换,我强烈建议你也这样做。当您确实使用 xhtml 时,请确保关闭所有通常未关闭的标签,例如 br、img、input 等标签,例如:<br>
现在应该是 <br/>
否则您会得到 xml 错误
这个存储库还展示了如何本地化你的 install.rdf,我建议你 fork 这个存储库以开始你的插件。
我正在尝试为我的第一个插件创建一个选项页面。我不想使用 simple-prefs,它没有我需要的类型。那么如何创建自己的选项页面呢?
我发现 this post. But widget 已在 firefox 38 中删除,那么还有什么其他方法可以创建自己的选项页面?
顺便说一句,firefox 的附加组件 API 似乎非常杂乱无章。过时的信息而不是一致性。有没有更好的place/forum/group查询最新信息?
这很容易做到。
这是一个简单的 html 选项演示页面的 repo:https://github.com/Noitidart/l10n/tree/html-options
重要的部分是:
- optionsType 应为 3 - https://github.com/Noitidart/l10n/blob/html-options/install.rdf#L12
- 设置路径:https://github.com/Noitidart/l10n/blob/html-options/install.rdf#L13
- 在第 1 行用 chroem.manifest 定义路径:https://github.com/Noitidart/l10n/blob/html-options/chrome.manifest#L1
- 在 html 中创建一个选项页面 - https://github.com/Noitidart/l10n/blob/html-options/my_options.xhtml
现在这个存储库制作了一个 xhtml
页面,因为这个存储库同时显示了一个完全本地化的插件。使用 xhtml 你可以使用替换,我强烈建议你也这样做。当您确实使用 xhtml 时,请确保关闭所有通常未关闭的标签,例如 br、img、input 等标签,例如:<br>
现在应该是 <br/>
否则您会得到 xml 错误
这个存储库还展示了如何本地化你的 install.rdf,我建议你 fork 这个存储库以开始你的插件。