"Helder.wiki" posted a comment on MediaWiki.r81500.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/81500#c31993

Commit summary for MediaWiki.r81500:

Making a start with $.jsMessage. A more flexible way for messages. Supports 
grouping them and making the replacing of previous messages into option (the 
current jsMsg() function always replaces older messages. Time has shown that 
there is need for the ability to show older messages as well and grouping to 
avoid different scripts from erasing or clearing eachother's output (current 
Commons and a few other wikis have created similar functions to enable keeping 
previous messages)
* See also bug 26888. Not resolving the bug yet, this plugins needs a little 
more testing and should then be called from within mw.util.jsMessage with some 
wiki specific things.

Examples:

// Show a simple message in the default group
$.jsMessage( {
message: 'Hello',
target: 'mw-js-message'
} );

// Add a new message this time stating the defaults
$.jsMessage( {
message: 'World',
group: 'default',
replace: false,
target: 'mw-js-message'
} );

// Post a new message, replacing the previous ones
$.jsMessage( {
message: 'New',
group: 'default',
replace: true,
target: 'mw-js-message'
} );

// Add a messages in a new group (groups separated by a line)
$.jsMessage( {
message: 'A new group',
group: 'something',
target: 'mw-js-message'
} );

// Clear the default group
// See code comments for more info
$.jsMessage( {
message: '',
replace: true,
target: 'mw-js-message'
} );

// Clear the 'something'-group
// Since this leaves no visible groups, the main box will hide (slideUp) right 
after
$.jsMessage( {
message: '',
group: 'something',
replace: true,
target: 'mw-js-message'
} );

If testing goes well, mw.util.jsMsg(message, className, replace) will call
$.jsMessage( { message: message, group: className, replace: replace, target: 
$.jsMessage(ge' );
So it's more a backend plugin, not used directly by core modules.
But this way extensions or third party sites can easily re-use this plugin 
and/or create multiple message boxes
on one page, by calling $.jsMessageNew and giving an id and location for it on 
the page.

Helder.wiki's comment:

I think the default parent shoudn't be the "body", because it breaks the 
appearence of the skin. Compare
 jsMsg('Lorem ipsum...'); // ok =)
with
 $.messageBox({
     message:'Lorem ipsum...', // Blergh! =(
 });

Maybe the default target should be the 'mw-js-message' (which is/was used by 
the jsMsg from wikibits.js). E.g.: the result of
 $.messageBox({
     message:'Lorem ipsum...',
     target: 'mw-js-message'
 });
looks a lot better than without specifying the target.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to