I'd love this, in addition to several other suggestions that have been made in the past that would let the user script commands menu work like a real menu:
sub-menus enable/disable remove command separators My biggest wish would be sub-menus, though. On Mar 31, 5:41 am, Piglet <[email protected]> wrote: > Hi, > > I'm absolutely loving Greasemonkey. As a long-time javascript tinkerer it's > a real joy to be able to rework the user interface & functionality of sites. > > I use GM_registerMenuCommand to toggle on and off various areas of > functionality in scripts. What would be really useful is the ability to > change the menu text, or even better, to be able to tick/untick the menu > item in the same way the Tools->Greasemonkey->Enabled menu option is shown. > > It would be really useful for the properties of the menu created by > GM_registerMenuCommand to be able to be changed - either text or "tick". > > eg. > [code] > var resource=GM_registerMenuCommand(foo, bar); > resource.tick = true; > resource.caption= "new menu text"; > [/code] > > It might also be useful to be able to "unregister" the menu, or to change > the command function > > At the moment I have to make do with static menu text and no tick - and rely > on another menu option to alert what the current value are. See below - this > is not really a very elegant solution: > > [code] > > function show_options(e){ > var thisfeature = GM_getValue("this_feature", false); > var thatfeature = GM_getValue("that_feature", false); > var anotherfeature = GM_getValue("another_feature", false); > alert("On next page load:\nThis feature will "+((!thisfeature)?'not > ':'')+"be active.\nThat feature will "+((!thatfeature)?'not ':'')+"be > active.\nAnother feature will "+((!anotherfeature)?'not ':'')+"be > active.\n"); > } > GM_registerMenuCommand("Show currently selected options", show_options); > > function toggle_thisfeature(e){ > var thisfeature = GM_getValue("this_feature", false); > alert('On next page load this feature will '+((thisfeature)?'not > ':'')+'be active.'); > GM_setValue("this_feature", !thisfeature); > } > GM_registerMenuCommand("Toggle this feature on or off", > toggle_thisfeature); > > function toggle_thatfeature(e){ > var thatfeature = GM_getValue("that_feature", false); > alert('On next page load that feature will '+((thatfeature)?'not > ':'')+'be active.'); > GM_setValue("that_feature", !thatfeature); > } > GM_registerMenuCommand("Toggle that feature on or off", > toggle_thatfeature); > > function toggle_anotherfeature(e){ > var anotherfeature = GM_getValue("another_feature", false); > alert('On next page load another feature will > '+((anotherfeature)?'not ':'')+'be active.'); > GM_setValue("another_feature", !anotherfeature); > } > GM_registerMenuCommand("Toggle another feature on or off", > toggle_anotherfeature); > [/code] > > Do you think that this is something that would be possible? -- 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.
