var noun_type_gmCommand = { _name: "GM command name", // Returns all GM commands available for the current page. getCommands: function(){ var commands= {}; var menuitems = jQuery(window.document) .find('#userscript-commands-sb > menupopup > menuitem') .get(); for (var i=0; i {text}

Commands available in this page:


[%if commands != null %] [%/if%] .toXMLString() .replace(/\[%(.*?)%\]/g,"{$1}"); pblock.innerHTML = CmdUtils.renderTemplate(list, {commands: commands} ) ; // add click listener to links var ul = jQuery(pblock).find('li>a') .bind('click', function(ev){ // clicking closes the preview and executes the action context.chromeWindow.gUbiquity.closeWindow(); commands[jQuery(this).attr('name')]._commandFunc(); }); } });