With the increasing amount of Javascript code included in the default configuration of Commons I feel the need for a convenient configuration mechanism to enable and disable specific extensions and to set customizable parameters.
I created such a framework here: http://commons.wikimedia.org/wiki/MediaWiki:JSconfig.js
It allows the creation of parameters (with descriptions and default values). These parameters are used to dynamically generate a new Tab in on the MediaWiki Preferences page. The preferences on this page are saved as cookies (and automatically restored from the cookies).
Extensions can conveniently define a parameter set and query it without having to worry about a user interface to change them and a logic to store them.
It needs some further polishing to make the preferences page more structured, but I allready have some ideas. If this gets adopted I'll certainly put some more work into it.
values). These parameters are used to dynamically generate a new Tab in on the MediaWiki Preferences page. The preferences on this page are saved as
Correction, creating a new tab is not yet implemented, but the programmer can choose which existing tab the config option is appended to. The JSConfig options are saved when pushing the normal ''save'' button. It is not apparent to the user that the JSConfig option are not native MW options.
On 7/5/07, Dschwen lists@schwen.de wrote:
With the increasing amount of Javascript code included in the default configuration of Commons I feel the need for a convenient configuration mechanism to enable and disable specific extensions and to set customizable parameters.
I created such a framework here: http://commons.wikimedia.org/wiki/MediaWiki:JSconfig.js
It allows the creation of parameters (with descriptions and default values). These parameters are used to dynamically generate a new Tab in on the MediaWiki Preferences page. The preferences on this page are saved as cookies (and automatically restored from the cookies).
Extensions can conveniently define a parameter set and query it without having to worry about a user interface to change them and a logic to store them.
It needs some further polishing to make the preferences page more structured, but I allready have some ideas. If this gets adopted I'll certainly put some more work into it.
Nice idea!
Does it work for someone (like me) using several machines? Or do I always ges settings "per machine"? This might actually be desireable (different screen resolution etc.) in some cases.
While you're working on easier configuration: How about a function "load_user_script(stuff)" that one can add to monobook.js to wrap up the document.write orgy?
Magnus
Or maybe a template {{InstallJS}}, which one can use as a wrapper for the document.write? One could then just add {{subst:InstallJS|MediaWiki:Some-script.js}}.
Some time ago I investigated saving user preferences to wikipages. I believe that I found out that this was not possible using the XMLHTTPRequest object, but I'll look into it again.
On 7/5/07, Magnus Manske magnusmanske@googlemail.com wrote:
While you're working on easier configuration: How about a function "load_user_script(stuff)" that one can add to monobook.js to wrap up the document.write orgy?
Some time ago I investigated saving user preferences to wikipages. I believe that I found out that this was not possible using the XMLHTTPRequest object, but I'll look into it again.
It will work using an iframe loading a page in edit mode. The javascript inside the iframe edit-mode page can then automatically change the editbox and save the form.
How about a function "load_user_script(stuff)" that one can add to monobook.js to wrap up the document.write orgy?
I just added the function includePage( name ) to Common.js i.e.:
includePage( 'MediaWiki:ResizeGalleries.js' );
On 7/5/07, Dschwen lists@schwen.de wrote:
How about a function "load_user_script(stuff)" that one can add to monobook.js to wrap up the document.write orgy?
I just added the function includePage( name ) to Common.js i.e.:
includePage( 'MediaWiki:ResizeGalleries.js' );
Thanks, this makes my monobook.js look so much cleaner! Now I'll go around my scripts changing the howto :-)
Magnus
Dschwen wrote:
How about a function "load_user_script(stuff)" that one can add to monobook.js to wrap up the document.write orgy?
I just added the function includePage( name ) to Common.js i.e.:
includePage( 'MediaWiki:ResizeGalleries.js' );
I've just added a withJS parameter to the URLs so you can load one of the javascripts without altering your monobook.
E.g. Try the new MediaWiki:ResizeGalleries.js at http://commons.wikimedia.org/w/index.php?title=Category:People&withJS=Me...
As it's a potential XSS vector, those able please help reviewing it, to verify the code is safe.
Impressive stuff guys!
Thanks a lot, and please keep working on it!! I am sure that if we get something polished-up that is reasonably secure and works cross-browser, it will soon be adopted across many other projects.
cheers Brianna