From edd7c5ad76b62ec6ab99b0bf7e6e2a76c5edc455 Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Wed, 26 Mar 2014 16:05:54 -0700 Subject: [PATCH] Add jquery.byteLimit to jsduck Change-Id: I1dd21fccd93fed03748d3a71e53e8d27e6a9a5dd --- maintenance/jsduck/config.json | 1 + resources/jquery/jquery.byteLimit.js | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/maintenance/jsduck/config.json b/maintenance/jsduck/config.json index cdaa45c645..dd820fe4a9 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.byteLimit.js", "../../resources/jquery/jquery.localize.js", "../../resources/jquery/jquery.spinner.js", "../../resources/oojs", diff --git a/resources/jquery/jquery.byteLimit.js b/resources/jquery/jquery.byteLimit.js index b398fdd192..17c182104d 100644 --- a/resources/jquery/jquery.byteLimit.js +++ b/resources/jquery/jquery.byteLimit.js @@ -1,8 +1,5 @@ /** - * jQuery byteLimit plugin. - * - * @author Jan Paul Posma, 2011 - * @author Timo Tijhof, 2011-2012 + * @class jQuery.plugin.byteLimit */ ( function ( $ ) { @@ -13,14 +10,15 @@ * "fobo", not "foba". Basically emulating the native maxlength by * reconstructing where the insertion occured. * + * @private * @param {string} safeVal Known value that was previously returned by this * function, if none, pass empty string. * @param {string} newVal New value that may have to be trimmed down. * @param {number} byteLimit Number of bytes the value may be in size. - * @param {Function} fn [optional] See $.fn.byteLimit. - * @return {Object} Object with: - * - {string} newVal - * - {boolean} trimmed + * @param {Function} [fn] See jQuery.byteLimit. + * @return {Object} + * @return {string} return.newVal + * @return {boolean} return.trimmed */ function trimValForByteLength( safeVal, newVal, byteLimit, fn ) { var startMatches, endMatches, matchesLen, inpParts, @@ -117,11 +115,11 @@ * value), a filter function (in case the limit should apply to something other than the * exact input value), or both. Order of parameters is important! * - * @context {jQuery} Instance of jQuery for one or more input elements - * @param {Number} limit [optional] Limit to enforce, fallsback to maxLength-attribute, + * @param {number} [limit] Limit to enforce, fallsback to maxLength-attribute, * called with fetched value as argument. - * @param {Function} fn [optional] Function to call on the string before assessing the length. - * @return {jQuery} The context + * @param {Function} [fn] Function to call on the string before assessing the length. + * @return {jQuery} + * @chainable */ $.fn.byteLimit = function ( limit, fn ) { // If the first argument is the function, @@ -229,4 +227,9 @@ } ); } ); }; + + /** + * @class jQuery + * @mixins jQuery.plugin.byteLimit + */ }( jQuery ) ); -- 2.20.1