Another approach is to run a script on all pages that contain links to
the pages your script runs on, and it alters the links when say shift
is pressed and restores them when shift is released. Say your script
runs on urls like 'http://example.com/foo33.htm'. The script alters
this link to 'http://example.com/foo33.htm#runMyFunkyScript' when the
shift key is depressed.

Then put the following test at the top of your original script.
  if (document.location.hash != '#runMyFunkyScript') return;

Here is how to alter the links. In the below example you will want to
taylor the XPath inside the document.evaluate to select only links
your script runs on.



On Jan 7, 5:45 pm, ddistelhorst <[email protected]> wrote:
> I have a GM script that works great for a given web page. However,
> there are sometimes that I want the script to run and other times that
> I don't want it to run. I don't like to enable/disable GM all time
> since I use GM on other web pages all the time.
>
> What I would like to do is to only execute the script if I'm pressing
> a certain key (maybe the left shift key) when the web page loads. That
> way I could control whether the script executes or not based on the
> keypress and then I don't need to enable/disable GM all the time.
>
> How would I modify my script to only execute if a certain key is
> pressed during the web page load?
-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.


Reply via email to