--- /dev/null
+.mw-badge {
+ min-width: 8px;
+ height: 14px;
+ border: 1px solid white;
+ border-radius: 8px;
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
+ box-shadow: 0px 1px 4px #ccc;
+ -moz-box-shadow: 0px 1px 4px #ccc;
+ -webkit-box-shadow: 0px 1px 4px #ccc;
+ background-color: #b60a00;
+ background-image: linear-gradient(bottom, #a70802 0%, #cf0e00 100%);
+ background-image: -o-linear-gradient(bottom, #a70802 0%, #cf0e00 100%);
+ background-image: -moz-linear-gradient(bottom, #a70802 0%, #cf0e00 100%);
+ background-image: -webkit-linear-gradient(bottom, #a70802 0%, #cf0e00 100%);
+ background-image: -ms-linear-gradient(bottom, #a70802 0%, #cf0e00 100%);
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #a70802), color-stop(1, #cf0e00));
+ padding: 0 3px;
+ text-align: center;
+}
+
+.mw-badge-content {
+ font-size: 12px;
+ line-height: 14px;
+ color: white;
+ vertical-align: top;
+}
+
+.mw-badge-inline {
+ display: inline;
+}
+
+.mw-badge-overlay {
+ position: absolute;
+ bottom: -1px;
+ right: -3px;
+ z-index: 50;
+}
\ No newline at end of file
--- /dev/null
+// Badger v1.0 by Daniel Raftery
+// http://thrivingkings.com/badger
+// http://twitter.com/ThrivingKings
+// Modified by Ryan Kaldari <rkaldari@wikimedia.org>
+
+/**
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * This program is distributed WITHOUT ANY WARRANTY.
+ */
+
+(function( $ ) {
+ $.fn.badge = function( badge, options ) {
+ var existingBadge = this.find( '.mw-badge' );
+ options = $.extend( {}, options );
+
+ badge = String(badge);
+ if ( badge.charAt(0) === '+' ) {
+ if ( existingBadge.length > 0 ) {
+ oldBadge = existingBadge.text();
+ badge = Math.round( Number( oldBadge ) + Number( badge.substr(1) ) );
+ } else {
+ badge = badge.substr(1);
+ }
+ } else if ( badge.charAt(0) === '-' ) {
+ if ( existingBadge.length > 0 ) {
+ oldBadge = existingBadge.text();
+ badge = Math.round( Number( oldBadge ) - Number( badge.substr(1) ) );
+ } else {
+ badge = 0;
+ }
+ }
+
+ if ( Number(badge) <= 0 ) {
+ // Clear any existing badge
+ existingBadge.remove();
+ } else {
+ // Don't add duplicates
+ var $badge = existingBadge;
+ if ( existingBadge.length > 0 ) {
+ this.find( '.mw-badge-content' ).text( badge );
+ } else {
+ $badge = $('<div/>')
+ .addClass('mw-badge')
+ .addClass('mw-badge-overlay')
+ .append(
+ $('<span/>')
+ .addClass('mw-badge-content')
+ .text(badge)
+ );
+ this.append($badge);
+ }
+
+ if ( options.type ) {
+ if ( options.type == 'inline' ) {
+ $badge.removeClass('mw-badge-overlay')
+ .addClass('mw-badge-inline');
+ } else if ( options.type == 'overlay' ) {
+ $badge.removeClass('mw-badge-inline')
+ .addClass('mw-badge-overlay');
+ }
+ }
+
+ // If a callback was specified, call it with the badge number
+ if ( options.callback ) {
+ options.callback( badge );
+ }
+ }
+ };
+} ) ( jQuery );