[Greasemonkey] Greasemonkey 0.4, attempt III

Aaron Boodman zboogs at gmail.com
Mon Jul 18 00:12:59 EDT 2005

Updated XPI. I think this works. Tested pretty extensively with framed

I also created a simple test user script for this which adds menu
items with the URL of the document they were added from. This makes it
easy to see when/if it's screwing up.


But I do have a question. I noticed that Matt's script is trying to
add menu items for frames. GM_registerMenuCommand has never supported
this before, so he's probably hacking around it.

In this XPI, I tried flattening all GM_registerMenuCommand calls into
a big list in the tools menu. Would like feedback on whether this
feels good or bad.

My reasoning here is that not doing this makes it difficult to use
GM_registerMenuCommand in, for instance, gmail. You'd have to include
the user script on the top frame *and* the frame you actually want to
modify, then expose a function in the window's scope on the top frame,
and then call it from the bottom frame. Which is kinda dorky.

The downside of flattening the list, like I've done here, is that
using GM_registerMenuCommand with include * can have a strange effect
when you're using something like gmail, which has tons of frames. In
that case, you'd want to either make your include more specific, or
say something like:

if (window == top) {
  GM_registerMenuCommand( ... )

Of course, the other thing to consider is that at some point there
will probably be a context menu with GM_registerMenuCommand items, and
that would be the perfect place to put items from framed documents.
But that doesn't exist yet.

Anyway, interested in feedback on that policy point as well as general
feedback on whether this works, as usual.


On 7/17/05, Matt Labrum <darktempler at gmail.com> wrote:
> hmm it seems sometimes  when adding menu items with GM_registerMenuCommand 
> they persist into other tabs eg look at this screenshot
> http://random.thedt.net/error/gm_menuitem_bug.JPG 
> the script which adds those menu items adds a new menu items for urls and
> domains and frames.  as you can see in that screenshot you can see the
> frames for mail.google.com are showing up in a different tab (there should
> only be one skinner(url) and one skinner(domain) listed. 
> yet what i find even more odd is that when i open the menu items for the
> gmail tab theres nothing there.
> it seems to either missplace the menu items in wrong tabs or make menu items
> persist over a few tabs.
>  gmail tab seen here 
> http://random.thedt.net/error/gm_menuitem_bug_gmailscreen.JPG
> Im using the latest trunk nightly Mozilla/5.0 (Windows; U; Windows NT 5.1;
> en-US; rv:1.8b4) Gecko/20050715 Firefox/1.0+
> and the latest version of greasemonkey posted on this list
> :) 
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: greasemonkey.xpi
Type: application/x-xpinstall
Size: 45826 bytes
Desc: not available
Url : http://mozdev.org/pipermail/greasemonkey/attachments/20050717/af15b286/greasemonkey-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: menucommandertest.user.js
Type: application/x-javascript
Size: 44 bytes
Desc: not available
Url : http://mozdev.org/pipermail/greasemonkey/attachments/20050717/af15b286/menucommandertest.user-0001.js

More information about the Greasemonkey mailing list