简体   繁体   English

如何在另一个附加组件的XUL脚本中覆盖一个方法?

[英]How to override a method in the script of a XUL in another add-on?

I would like to change the behavior/extend some of the functionality in another add-on. 我想更改行为/扩展另一个插件中的某些功能。 The answer in Is it possible to modify a firefox addon written using XUL with an addon written using the Addon SDK says 是否可以修改使用XUL编写的firefox插件和使用Addon SDK编写的插件 ”中的答案

There are certain ways to monkey-patch code in Javascript code modules, if you really have to... 如果您确实需要...,可以使用某些方法在Javascript代码模块中进行猴子修补代码。

but the code I want to modify is the js script for a xul overlay 但是我要修改的代码是xul覆盖的js脚本

Is it possible to override some functions in that script? 是否可以覆盖该脚本中的某些功能? And if so, how? 如果是这样,怎么办? It looks like overlaying the xul with my own to run code in its context would work, as suggested in Overriding/Overlaying a XUL method , but is there a way to do this with the add-on sdk? 就像在覆盖/覆盖XUL方法中所建议的那样,用我自己的xul覆盖代码以在上下文中运行代码似乎可以工作,但是有没有办法使用附加sdk做到这一点? (Jetpack) (Jetpack的)

Thanks. 谢谢。

This xul article shows how to override functions: https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Appendix_C:_Avoid_using_eval_in_Add-ons?redirectlocale=en-US&redirectslug=XUL_School%2FAppendix_C%3A_Avoid_using_eval_in_Add-ons 这篇xul文章展示了如何覆盖函数: https : //developer.mozilla.org/zh-CN/Add-ons/Overlay_Extensions/XUL_School/Appendix_C :_Avoid_using_eval_in_Add-ons?redirectlocale=en-US&redirectslug=XUL_School%2FAppendix_C%3A_Avoid_using

This topic here shows how to access code scope of addons: Controlling a Firefox Extension via Javascript 这里的主题显示如何访问插件的代码范围: 通过Javascript控制Firefox扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从XUL访问附加SDK“ main” - Access Add-On SDK 'main' from XUL 如何在运行时使用JavaScript从Mozilla插件中将XUL作为字符串获取? - How can I get the XUL as a string from a Mozilla add-on at run-time using JavaScript? 如何在附加组件中的任何位置使用脚本? - How to include a script for use anywhere in the Add-on? 页面加载后从XUL调用Init(Firefox附加组件) - Call Init from XUL after Page Loads (Firefox add-on) firefox插件开发| 重写browser.xul - firefox add-on develop | rewrite browser.xul 如何在 Firefox 控制台中访问附加内容脚本? - How to access add-on content script in Firefox console? 如何知道哪个内容脚本与 Firefox 附加组件中的后台通信? - How to know which content script communicates with the background in a Firefox add-on? 如何将Greasemonkey脚本发布为Firefox附加组件? - How do I publish a Greasemonkey script as a Firefox add-on? 如何使用XUL,SDK或WebExtensions技术从Firefox插件中的JavaScript动态修改CSS规则集(例如,使用类选择器)? - How to dynamically modify CSS rule set (e.g. with a class selector) from JavaScript within Firefox Add-on using XUL, SDK or WebExtensions techniques? 在xul文件中参考Firefox附加组件的install.rdf em:version - Reference Firefox add-on's install.rdf em:version in xul file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM