Enable/Disable GreaseMonkey programatically

47 views
Skip to first unread message

saruke

unread,
Oct 28, 2009, 4:24:03 PM10/28/09
to greasemonkey-users
Is there a way to programatically enable/disable greasemonkey (all its
scripts) for few sites?
I am looking for a function whose affect should be same as turning the
greasemonkey button on and off on the browser.

Thanks in advance,
Saruke.

Anthony Lieuallen

unread,
Oct 28, 2009, 5:44:56 PM10/28/09
to greasemon...@googlegroups.com
On 10/28/09 16:24, saruke wrote:
> Is there a way to .. enable/disable greasemonkey (all its
> scripts) for few sites?

No.
http://github.com/greasemonkey/greasemonkey/issues/#issue/1002

saruke

unread,
Oct 29, 2009, 5:25:25 AM10/29/09
to greasemonkey-users
Thank you

BD

unread,
Oct 29, 2009, 7:01:16 AM10/29/09
to greasemon...@googlegroups.com
You could do it by having a value that can be set globally that all GmScripts can access and turn it on and off, and then check it in each script to see if that script should execute or not.

The problem is, I think they STILL have not allowed some common global variable space, which some people have been asking for, literally, for years. Unless they have added it and I missed it.

There might be some other way now to do it. I haven't kept up with many of the new changes, like the library includes and some other stuff like that. You will probably have to get creative, if it can even be done at all. (you can always modify the add on itself, which I have done from time to time over the years so that I could do stuff that others either thought shouldn't be done, or no one wanted to add to the code)

Some will scream "security risk!", but that is only the case if you don't know about it, and care. There are personal things I do in my scripts that I don't publish for the world to see, that I wouldn't, necessarily, do in a script published for the world. Which allows it a certain amount of inherent security. Plus, even if someone did somehow try to mess with me, I would notice it, and do something to fix it, if I could. But the chances of that happening are pretty much zero.

In your case, who cares if you want to have some "global value" that some of your scripts check to see if they should execute, or not. As long as your scripts aren't accessing nuclear energy websites that can turn valves off and on, etc. And you are aware of the other scripts you are using, which wouldn't mess with your global value, anyway.

The "problem" with @include and @exclude, is that they are static and you cannot modify them programmatically, so I don't think they would work for what it sounds like you want to do.

Reply all
Reply to author
Forward
0 new messages