mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-31 03:29:23 +02:00
[ticket/10741] Docblock for phpbb.resizeTextArea
Better description of phpBB.resizeTextArea with detailed explanation of all optional parameters. Removed unnecessary semicolons PHPBB3-10741
This commit is contained in:
parent
cbb9f084fc
commit
947550df8f
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user