2

I've been trying to transfer a lot of my Tampermonkey (in Google Chrome) userscripts to Greasemonkey in FireFox. Unfortunately, it seems that they don't work properly when I transfer them into Greasemonkey - I'm assuming there are syntactical differences, but I'm not sure what they are, nor have I found great information regarding the differences.

This code for instance:

// ==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);

This works in Tampermonkey on Chrome but not in Greasemonkey. What differences lie between the two, and how can I get this to work in FireFox?

4

1 回答 1

1

你用的是哪个版本的GM?
GM4 用途GM.openInTab(GM3 used GM_openInTab
GM_addStyle在 GM4 中被删除(https://wiki.greasespot.net/GM_addStyle

于 2019-12-15T06:17:15.653 回答