From: Mark Holmquist Date: Wed, 26 Mar 2014 22:46:10 +0000 (-0700) Subject: Add jquery.badge to the jsduck config X-Git-Tag: 1.31.0-rc.0~16458 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=2c5c0118c37c31b100e795addc91190b59f22278;p=lhc%2Fweb%2Fwiklou.git Add jquery.badge to the jsduck config Imported examples from https://www.mediawiki.org/wiki/ResourceLoader/Default_modules#jquery.badge Change-Id: I6ddd4b836fd8fd459bf803baab8fc26bac9fbe55 --- diff --git a/maintenance/jsduck/config.json b/maintenance/jsduck/config.json index dd820fe4a9..2059148d4b 100644 --- a/maintenance/jsduck/config.json +++ b/maintenance/jsduck/config.json @@ -18,6 +18,7 @@ "../../resources/mediawiki.api", "../../resources/mediawiki.language", "../../resources/jquery/jquery.arrowSteps.js", + "../../resources/jquery/jquery.badge.js", "../../resources/jquery/jquery.byteLimit.js", "../../resources/jquery/jquery.localize.js", "../../resources/jquery/jquery.spinner.js", diff --git a/resources/jquery/jquery.badge.js b/resources/jquery/jquery.badge.js index 9404e81833..023b6e28fc 100644 --- a/resources/jquery/jquery.badge.js +++ b/resources/jquery/jquery.badge.js @@ -1,10 +1,8 @@ -/** +/*! * jQuery Badge plugin * * @license MIT - */ - -/** + * * @author Ryan Kaldari , 2012 * @author Andrew Garrett , 2012 * @author Marius Hoch , 2012 @@ -21,19 +19,28 @@ * * This program is distributed WITHOUT ANY WARRANTY. */ + +/** + * @class jQuery.plugin.badge + */ ( function ( $, mw ) { /** - * Allows you to put a "badge" on an item on the page. The badge container - * will be appended to the selected element(s). - * See mediawiki.org/wiki/ResourceLoader/Default_modules#jQuery.badge + * Put a badge on an item on the page. The badge container will be appended to the selected element(s). + * + * $element.badge( text ); + * $element.badge( 5 ); + * $element.badge( '100+' ); + * $element.badge( text, inline ); + * $element.badge( 'New', true ); * * @param {number|string} text The value to display in the badge. If the value is falsey (0, * 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, + * @param {boolean} [inline=true] True if the badge should be displayed inline, false + * if the badge should overlay the parent element. + * @param {boolean} [displayZero=false] 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) + * @return {jQuery} + * @chainable */ $.fn.badge = function ( text, inline, displayZero ) { var $badge = this.find( '.mw-badge' ), @@ -73,4 +80,9 @@ } return this; }; + + /** + * @class jQuery + * @mixins jQuery.plugin.badge + */ }( jQuery, mediaWiki ) );