r81662 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81661‎ | r81662 | r81663 >
Date:00:22, 8 February 2011
Author:krinkle
Status:ok
Tags:
Comment:
Follow-up r81660.
(Renaming new jQuery.jsMessage plugin to jQuery.mesageBox() )
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.messageBox.css (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.messageBox.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.messageBox.js
@@ -1,5 +1,5 @@
22 /**
3 - * jQuery jsMessage
 3+ * jQuery messageBox
44 *
55 * Function to inform the user of something. Use sparingly (since there's mw.log for
66 * messages aimed at developers / debuggers). Based on the function in MediaWiki's
@@ -13,24 +13,24 @@
1414 */
1515 ( function( $, mw ) {
1616 // @return jQuery object of the message box
17 -$.jsMessageNew = function( options ) {
 17+$.messageBoxNew = function( options ) {
1818 options = $.extend( {
19 - 'id': 'js-message', // unique identifier for this message box
 19+ 'id': 'js-messagebox', // unique identifier for this message box
2020 'parent': 'body', // jQuery/CSS selector
2121 'insert': 'prepend' // 'prepend' or 'append'
2222 }, options );
2323 var $curBox = $( '#'+ options.id );
2424 // Only create a new box if it doesn't exist already
2525 if ( $curBox.size() > 0 ) {
26 - if ( $curBox.hasClass( 'js-message-box' ) ) {
 26+ if ( $curBox.hasClass( 'js-messagebox' ) ) {
2727 return $curBox;
2828 } else {
29 - return $curBox.addClass( 'js-message-box' );
 29+ return $curBox.addClass( 'js-messagebox' );
3030 }
3131 } else {
3232 var $newBox = $( '<div/>', {
3333 'id': options.id,
34 - 'class': 'js-message-box',
 34+ 'class': 'js-messagebox',
3535 'css': {
3636 'display': 'none'
3737 }
@@ -49,21 +49,21 @@
5050 // If there are no visible groups the main message box is hidden automatically,
5151 // and shown again once there are messages
5252 // @return jQuery object of message group
53 -$.jsMessage = function( options ) {
 53+$.messageBox = function( options ) {
5454 options = $.extend( {
5555 'message': '',
5656 'group': 'default',
5757 'replace': false, // if true replaces any previous message in this group
58 - 'target': 'js-message'
 58+ 'target': 'js-messagebox'
5959 }, options );
60 - var $target = $.jsMessageNew( { id: options.target } );
 60+ var $target = $.messageBoxNew( { id: options.target } );
6161 var groupID = options.target + '-' + options.group;
6262 var $group = $( '#' + groupID );
6363 // Create group container if not existant
6464 if ( $group.size() < 1 ) {
6565 $group = $( '<div/>', {
6666 'id': groupID,
67 - 'class': 'js-message-group'
 67+ 'class': 'js-messagebox-group'
6868 });
6969 $target.prepend( $group );
7070 }
@@ -77,7 +77,7 @@
7878 } else {
7979 // Actual message addition
8080 $group.prepend( $( '<p/>' ).append( options.message ) ).show();
81 - $target.slideDown()
 81+ $target.slideDown();
8282 }
8383 // If the last visible group was just hidden, slide the entire box up
8484 // Othere wise slideDown (if already visible nothing will happen)
Index: trunk/phase3/resources/jquery/jquery.messageBox.css
@@ -1,15 +1,15 @@
2 -.js-message-box {
 2+.js-messagebox {
33 margin: 1em 5%;
44 padding: 0.5em 2.5%;
55 border: 1px solid #ccc;
66 background-color: #fcfcfc;
77 font-size: 0.8em;
88 }
9 -.js-message-box .js-message-group {
 9+.js-messagebox .js-messagebox-group {
1010 margin: 1px;
1111 padding: 0.5em 2.5%;
1212 border-bottom: 1px solid #ddd;
1313 }
14 -.js-message-box .js-message-group:last-child {
 14+.js-messagebox .js-messagebox-group:last-child {
1515 border-bottom: thin none transparent;
1616 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81660Renaming new jQuery.jsMessage plugin to jQuery.mesageBox(). Name was too gene...krinkle00:20, 8 February 2011

Status & tagging log