将 Greasemonkey 脚本移植到 Chrome
我发现了一个 Greasemonkey 脚本,它在 Firefox 中运行良好,但在我首选的浏览器 Chrome 中却不行。 http://userscripts.org/scripts/show/105578
我尝试自己修复它,但是没有运气。 我已经发布了我在调试过程中的发现。
我该如何修复它?
更新:(来自OP评论)
通过联系 TamperMonkey 的开发人员使其正常工作。随着 TamperMonkey 的最新测试版及其工作脚本的修改。 请参阅userscripts.org 上的此主题。
注意到的另一个问题:Chrome 似乎禁止直接 访问锚点的
href
属性(在某些情况下)。但是,如果通过
getAttribute()
检索href
属性 一切正常。
I have found a Greasemonkey script which works fine in Firefox but not in Chrome, which is my preferred browser.
http://userscripts.org/scripts/show/105578
I have tried to fix it myself but without luck.
I have posted my findings during debugging, here.
How do I fix it?
Update: (from OP comment)
Got it working by contacting the developer of TamperMonkey. With the
newest beta of TamperMonkey and a modification of the script it works.
See this thread at userscripts.org.An additional issue noted: It seems that Chrome forbids the direct
access to the anchor'shref
attribute (in some cases).However if the
href
attribute is retrieved viagetAttribute()
everything works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Chrome 本身不支持
GM_
函数,并且该脚本大量使用跨域GM_xmlhttpRequest()
。最明智的做法是安装Tampermonkey,它可能 按原样运行现有脚本。
Chrome does not support the
GM_
functions natively, and that script makes heavy use of cross-domainGM_xmlhttpRequest()
.The smartest thing to do is to install Tampermonkey, which can probably run the existing script as is.