Something else I'd like add to the gadget feature requests is allowing users to configure a gadget to some extent. A rough comparison might be using $wgExampleExtensionVariable to set something in LocalSettings.php.
As an example of how this might work in a js environment, take http://dev.wikia.com/wiki/AjaxRC which uses ajax to refresh the content of a page. By default this loads on RecentChanges and WikiActivity (something similar to RecentChanges made by Wikia to be more friendly to new users). However, the pages it loads can be altered to any page imaginable. A typical extra place for it to load might be a forum hub to track the latest changes to threads.
Currently, the user sets the variables and imports the script. If this script were moved to a gadget in it's current state there would be no way to configure it unless you did something like add a site dependency and configure it in MediaWiki:Common.js.
I think a better way would to be to add a way to set variables in a gadget preferences page, with a form that can accept pre-determined types, e.g. string (foo), array (foo, bar, baz, ...), number (12345), boolean (checkbox), etc. These variables could then be set using something like mw.user.gadgetPrefs.set( 'ajaxrc-someVar' ) (possibly namespaced to the gadget?) and then accessed by the gadget using mw.user.gadgetPrefs.get( 'ajaxrc-someVar' ) Ideally, this form would show the default values used as well.
A couple of things to mull over if this gets implemented:
- Should we allow configuration on a wiki and/or user basis for default gadgets? Perhaps set sub-defaults, e.g. default < wiki < user
- If global gadgets are introduced gadgets could be identified by hash values rather than names. How could we avoid clashes where the same variable is being inadvertently set twice or more by different scripts?