开发一个 Firefox 插件,在保存文件时将文件的 URI 转换为其文件名
我阅读了一些有关开发 Firefox Addons 的文档和教程。 但从未找到如何做到这一点。
我想制作一个插件,当您尝试保存文件(通过左键单击或右键单击/另存为)时,它会自动将要创建的文件的名称设置为与原始文件的 URI 相同。 (但进行了一些更改,例如将斜杠变成连字符等)
有关如何执行此操作的任何提示吗? 谢谢!
I've read some documentation and tutorials about developing Firefox Addons.
But never found how to do this.
I would like to make an addon that when you try to save a file (via left-click or right-click/save as) it automatically sets the to-be-created-file's name to be the same as the original file's URI. (but with some changes, like making slashes into hyphens, etc.)
Any hints on how to do this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不相信 Firefox 附加组件可以更改默认的“另存为”行为。 然而,他们可以在上下文菜单(右键单击)中添加另一个选项,可能名为“另存为以 uri 命名的文件”。 您想要学习一些 JavaScript 等内容,并查看上下文菜单的演示插件。
好的,所以我查看了 起点< /a>,这将我带到了这些:
I don't believe Firefox Add-ons can change the default "save as" behavior. They could however add another option in the context menu (right click) perhaps named "save as file named with uri". You'd want to learn some JavaScript and such and look at a demo Add-on for the context menu.
Okay, so I looked at a starting point, which took me to these:
我认为您可以覆盖 Firefox 中的任何行为 - 找出正确的 XPCOM 调用和 DOM 树中的位置是另一回事。 查看 扩展 Firefox 和 Thunderbird
I think you can override any behaviour in Firefox - finding out the correct XPCOM call and location in the DOM tree is another matter. Have a look at Extending Firefox and Thunderbird