Tampermonkey和Greasemonkey之间的语法差异?

问题描述 投票:1回答:1

我一直在尝试将很多Tampermonkey(在Google Chrome中)用户脚本转移到FireFox中的Greasemonkey。不幸的是,当我将它们转移到Greasemonkey时,它们似乎无法正常工作-我假设存在语法上的差异,但是我不确定它们是什么,也没有找到有关这些差异的详细信息。

例如此代码:

// ==UserScript==
// @name     DailySearch
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @include  *
// @grant    GM_addStyle
// @grant    GM_openInTab
// ==/UserScript==

//--- Note that the contains() text is case-sensitive.
var TargetLink = $("a:contains('Daily Search')")

if (TargetLink.length)
    GM_openInTab (TargetLink[0].href);

[这在Chrome的Tampermonkey中有效,但在Greasemonkey中无效。两者之间有什么区别,如何在FireFox中使用它?

google-chrome firefox tampermonkey greasemonkey-4
1个回答
0
投票

您正在使用哪个版本的GM?GM4使用GM.openInTab(GM3使用GM_openInTabGM_addStyle已放入GM4(https://wiki.greasespot.net/GM_addStyle

© www.soinside.com 2019 - 2024. All rights reserved.