diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-04-30 11:27:43 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-04-30 11:27:43 +0300 |
commit | 947550df8f5e2ba624adc26ddd22c7fe74e4f602 (patch) | |
tree | 7a3580638d2ba7f15916efb2a52f357881d9d76b | |
parent | cbb9f084fce0fd42ed1481233f417c79e8a0abfa (diff) | |
download | forums-947550df8f5e2ba624adc26ddd22c7fe74e4f602.tar forums-947550df8f5e2ba624adc26ddd22c7fe74e4f602.tar.gz forums-947550df8f5e2ba624adc26ddd22c7fe74e4f602.tar.bz2 forums-947550df8f5e2ba624adc26ddd22c7fe74e4f602.tar.xz forums-947550df8f5e2ba624adc26ddd22c7fe74e4f602.zip |
[ticket/10741] Docblock for phpbb.resizeTextArea
Better description of phpBB.resizeTextArea with detailed
explanation of all optional parameters.
Removed unnecessary semicolons
PHPBB3-10741
-rw-r--r-- | phpBB/assets/javascript/core.js | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 827ed2e34a..bb1fef253e 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -571,28 +571,39 @@ phpbb.addAjaxCallback('toggle_link', function() { /** * Automatically resize textarea * -* This function automatically resizes textarea elements when user +* This function automatically resizes textarea elements when user * types text. * -* @param jQuery item jQuery object to resize -* @param object options Optional parameter that adjusts default +* @param {jQuery} items jQuery object(s) to resize +* @param {object} options Optional parameter that adjusts default * configuration. See configuration variable +* +* Optional parameters: +* minWindowHeight {number} Minimum browser window height when textareas are resized. Default = 500 +* minHeight {number} Minimum height of textarea. Default = 200 +* maxHeight {number} Maximum height of textarea. Default = 500 +* heightDiff {number} Minimum difference between window and textarea height. Default = 200 +* resizeCallback {function} Function to call after resizing textarea +* resetCallback {function} Function to call when resize has been canceled + +* Callback function format: function(item) {} +* this points to DOM object +* item is a jQuery object, same as this */ -phpbb.resizeTextArea = function(items) { +phpbb.resizeTextArea = function(items, options) { // Configuration var configuration = { - minWindowHeight: 500, // Minimum browser window height when textareas are resized - minHeight: 200, // Minimum height of textarea - maxHeight: 500, // Maximum height of textarea - heightDiff: 200, // Minimum difference between window and textarea height - // In following callbacks parameter "item" is jQuery object. "this" points to DOM object - resizeCallback: function(item) { }, // Function to call after resizing textarea. - resetCallback: function(item) { } // Function to call when resize has been canceled - } + minWindowHeight: 500, + minHeight: 200, + maxHeight: 500, + heightDiff: 200, + resizeCallback: function(item) { }, + resetCallback: function(item) { } + }; if (arguments.length > 1) { - configuration = $.extend(configuration, arguments[1]); + configuration = $.extend(configuration, options); } function resetAutoResize(item) @@ -603,7 +614,7 @@ phpbb.resizeTextArea = function(items) { $(item).css({height: '', resize: ''}).removeClass('auto-resized'); configuration.resetCallback.call(item, $item); } - }; + } function autoResize(item) { @@ -634,7 +645,7 @@ phpbb.resizeTextArea = function(items) { { setHeight(Math.min(maxHeight, scrollHeight)); } - }; + } items.bind('focus change keyup', function() { $(this).each(function() { |