How do I upgrade from Greasemonkey 0.9.2.2 to 1.9?

41 views
Skip to first unread message

Gary

unread,
May 13, 2013, 12:09:22 PM5/13/13
to greasemon...@googlegroups.com
I'm currently using Greasemonkey 0.9.2.2 and have been using it for quite some time now, ever since Greasemonkey 1.0 was released because all my scripts were broken with that version. I recently tried upgrading to the latest Greasemonkey again (which was 1.8 at the time, but the latest is 1.9 now as of today), and most of my scripts were broken once again.

So, I was wondering, is there some sort of "quick upgrade" guide to make scripts that worked in Greasemonkey 0.9 due to the sandbox feature, to also work in 1.0 and above? I recall there were some keywords I could use, but those were just workarounds/hacks. Is there a legitimate way to enable the sandbox feature on all scripts again, and then one-by-one remove the sandbox feature on each script once I've ensured that each one works?

I'm sure this would be helpful to script authors in the future, who have too many scripts to maintain as well!
Thanks in advance!

Anthony Lieuallen

unread,
May 13, 2013, 12:42:48 PM5/13/13
to greasemon...@googlegroups.com
On Mon, May 13, 2013 at 12:09 PM, Gary <gary...@gmail.com> wrote:
So, I was wondering, is there some sort of "quick upgrade" guide to make scripts that worked in Greasemonkey 0.9 due to the sandbox feature, to also work in 1.0 and above?

How are you suggesting Greasemonkey know which script works which way?

Or: no.  Put appropriate @grant metadata in scripts you author if the simple guess that it does make is not appropriate.  Or show us the scripts and explain clearly what doesn't work and maybe we can help you more specifically.

Gary

unread,
May 13, 2013, 1:52:55 PM5/13/13
to greasemon...@googlegroups.com
I've got 38 scripts that I would have to go through each one-by-one to make them compatible with Greasemonkey 1.*, which at the moment I don't have the time to do (and didn't when GS 1.0 was first released). Almost all have simple function names that might conflict with functions on webpages. Also, I @require jQuery in almost all these scripts, too, and since most websites also use jQuery, I assume that this is a huge conflict so I'd have to rewrite many of my scripts that use jQuery.

So, that's why I'm asking if there's anything simple that I can do without testing 38 scripts to make all of them, or at least most, work with GS 1.* as they are working now with GS 0.9.

If not, then what exactly would I have to do to make the scripts compatible with GS 1.*? From what I can see, I have to include @grant none in all the scripts? Would that then fix the jQuery conflict, or would I have to separately ensure that the websites do or don't have jQuery, and if they do, then remove jQuery from my script so they don't conflict?

Thanks in advance.

Anthony Lieuallen

unread,
May 13, 2013, 2:02:29 PM5/13/13
to greasemon...@googlegroups.com
On Mon, May 13, 2013 at 1:52 PM, Gary <gary...@gmail.com> wrote:
I've got 38 scripts that I would have to go through each one-by-one to make them compatible with Greasemonkey 1.*, which at the moment I don't have the time to do (and didn't when GS 1.0 was first released).

Have you had time to even try once, in the past nine months?
 
Almost all have simple function names that might conflict with functions on webpages. Also, I @require jQuery in almost all these scripts, too, and since most websites also use jQuery, I assume that this is a huge conflict so I'd have to rewrite many of my scripts that use jQuery.

You misunderstand.  Unless you explicitly assign to "window.something" the interaction with the content page is unchanged.  If you use jQuery, yes, you might need a one-liner to keep it in the script's scope: http://www.greasespot.net/2012/08/greasemonkey-10-jquery-broken-with.html

Gary

unread,
May 13, 2013, 2:15:34 PM5/13/13
to greasemon...@googlegroups.com
No I haven't tried even once, because let's say I go through the 38 scripts, and on script 20 I bump into a problem with a specific script that I can't fix. I can either leave that script broken, or roll back all my fixes, making them pointless.

The one thing specifically that I'd like from GS 1 that I don't have now in GS 0.9 is the ability to see exactly what line an error is occurring on, in the Error Console. Right now it just says "runScript" is the problem, due to the sandbox I assume.

For the jQuery conflict problem, would I be better off just using the website's jQuery, or rather just use my own and the noConflict fix? I guess it depends on whether I don't mind using the version of jQuery that the website provides, which might be older than I want?

Anthony Lieuallen

unread,
May 13, 2013, 2:30:30 PM5/13/13
to greasemon...@googlegroups.com
On Mon, May 13, 2013 at 2:15 PM, Gary <gary...@gmail.com> wrote:
No I haven't tried even once, because let's say I go through the 38 scripts, and on script 20 I bump into a problem with a specific script that I can't fix. I can either leave that script broken, or roll back all my fixes, making them pointless.

I have not yet heard of a script that could not be made to work.  Worst possible case, you need to add a handful of @grant lines for the APIs you call.
 
For the jQuery conflict problem, would I be better off just using the website's jQuery, or rather just use my own and the noConflict fix? I guess it depends on whether I don't mind using the version of jQuery that the website provides, which might be older than I want?

You'd have to ask someone else.  I don't personally use jQuery in user scripts.  But I suspect knowing what version you're using, and keeping it in your script's scope only with that one line, is probably easiest.
Reply all
Reply to author
Forward
0 new messages