gpt4 book ai didi

greasemonkey - 如何编写用户脚本以便它们在 Opera 和 Greasemonkey 中工作

转载 作者:行者123 更新时间:2023-12-04 07:07:28 27 4
gpt4 key购买 nike

我现在正在研究用户脚本。我知道 Opera 与 Greasemonkey 脚本的许多方面兼容,但与其他方面不兼容。

GM functions emulation script在 Opera 上将需要,一开始我有

if(window.opera) {
var unsafeWindow = window;
}

但除此之外,如果我想让我的脚本在两者中运行,我还应该记住哪些其他事情?

最佳答案

我的 Endless Tweets用户脚本在 Firefox、WebKit 和 Opera 中同样有效。

我正在使用 a compatibility script I wrote myself提供 GM_getValue , GM_setValue , GM_xmlhttpRequest , GM_addStyleGM_log .

但是,我不喜欢使用“GM_”前缀,因为用户脚本是跨平台的,所以脚本有这个 API:

getValue()
setValue()
xhr()
addCSS()
log()

检查 the toolkit 的其余部分在编写用户脚本时获得更多有用的功能。

关于greasemonkey - 如何编写用户脚本以便它们在 Opera 和 Greasemonkey 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/907486/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com