Revert "Adding ability of jQuery badge to display the number zero if requested."
authorKrinkle <ttijhof@wikimedia.org>
Fri, 14 Dec 2012 21:02:06 +0000 (21:02 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 14 Dec 2012 21:02:06 +0000 (21:02 +0000)
This reverts commit b170b56f09d1ec5ab5e34e997447546239e008fd

resources/jquery/jquery.badge.css
resources/jquery/jquery.badge.js

index 9f44628..7dd2198 100644 (file)
@@ -6,6 +6,7 @@
        -moz-box-shadow: 0px 1px 4px #ccc;
        -webkit-box-shadow: 0px 1px 4px #ccc;
        box-shadow: 0px 1px 4px #ccc;
+       background-color: #cc0000;
        padding: 0 3px;
        text-align: center;
        font-size: 12px;
        display: inline-block;
        margin-left: 3px;
 }
+
 .mw-badge-overlay {
        position: absolute;
        bottom: -1px;
        right: -3px;
        z-index: 50;
 }
-
-.mw-badge-red {
-       background-color: #cc0000;
-}
-.mw-badge-grey {
-       background-color: #d2d2d2;
-}
index 8a1f298..c8073d1 100644 (file)
         *   null, false, '', etc.), any existing badge will be removed.
         * @param boolean inline True if the badge should be displayed inline, false
         *   if the badge should overlay the parent element (default is inline)
-        * @param boolean displayZero True if the number zero should be displayed,
-        *   false if the number zero should result in the badge being hidden
-        *   (default is zero will result in the badge being hidden)
         */
-       $.fn.badge = function ( text, inline, displayZero ) {
-               var $badge = this.find( '.mw-badge' ),
-                       badgeStyleClass = 'mw-badge-' + ( inline ? 'inline' : 'overlay' ),
-                       badgeColorClass = 'mw-badge-red'; // default color is red
+       $.fn.badge = function ( text, inline ) {
+               var $badge = this.find( '.mw-badge' );
 
-               // If we're displaying zero, change the color to grey
-               if ( displayZero && text === 0 ) {
-                       badgeColorClass = 'mw-badge-grey';
-                       // Change zero to string so that it will be displayed
-                       text = '0';
-               }
                if ( text ) {
                        // If a badge already exists, reuse it
                        if ( $badge.length ) {
                                $badge.find( '.mw-badge-content' ).text( text );
                        } else {
                                // Otherwise, create a new badge with the specified text and style
-                               $badge = $( '<div class="mw-badge"></div>' )
-                                       .addClass( badgeStyleClass )
-                                       .addClass( badgeColorClass )
+                               $badge = $( '<div class="mw-badge mw-badge-' + ( inline ? 'inline' : 'overlay' ) + '"></div>' )
                                        .append( $( '<span class="mw-badge-content"></span>' ).text ( text ) )
                                        .appendTo( this );
                        }