mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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
1 changed files with 26 additions and 15 deletions
|
@ -574,25 +574,36 @@ phpbb.addAjaxCallback('toggle_link', function() {
|
||||||
* This function automatically resizes textarea elements when user
|
* This function automatically resizes textarea elements when user
|
||||||
* types text.
|
* types text.
|
||||||
*
|
*
|
||||||
* @param jQuery item jQuery object to resize
|
* @param {jQuery} items jQuery object(s) to resize
|
||||||
* @param object options Optional parameter that adjusts default
|
* @param {object} options Optional parameter that adjusts default
|
||||||
* configuration. See configuration variable
|
* 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
|
// Configuration
|
||||||
var configuration = {
|
var configuration = {
|
||||||
minWindowHeight: 500, // Minimum browser window height when textareas are resized
|
minWindowHeight: 500,
|
||||||
minHeight: 200, // Minimum height of textarea
|
minHeight: 200,
|
||||||
maxHeight: 500, // Maximum height of textarea
|
maxHeight: 500,
|
||||||
heightDiff: 200, // Minimum difference between window and textarea height
|
heightDiff: 200,
|
||||||
// In following callbacks parameter "item" is jQuery object. "this" points to DOM object
|
resizeCallback: function(item) { },
|
||||||
resizeCallback: function(item) { }, // Function to call after resizing textarea.
|
resetCallback: function(item) { }
|
||||||
resetCallback: function(item) { } // Function to call when resize has been canceled
|
};
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.length > 1)
|
if (arguments.length > 1)
|
||||||
{
|
{
|
||||||
configuration = $.extend(configuration, arguments[1]);
|
configuration = $.extend(configuration, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetAutoResize(item)
|
function resetAutoResize(item)
|
||||||
|
@ -603,7 +614,7 @@ phpbb.resizeTextArea = function(items) {
|
||||||
$(item).css({height: '', resize: ''}).removeClass('auto-resized');
|
$(item).css({height: '', resize: ''}).removeClass('auto-resized');
|
||||||
configuration.resetCallback.call(item, $item);
|
configuration.resetCallback.call(item, $item);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function autoResize(item)
|
function autoResize(item)
|
||||||
{
|
{
|
||||||
|
@ -634,7 +645,7 @@ phpbb.resizeTextArea = function(items) {
|
||||||
{
|
{
|
||||||
setHeight(Math.min(maxHeight, scrollHeight));
|
setHeight(Math.min(maxHeight, scrollHeight));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
items.bind('focus change keyup', function() {
|
items.bind('focus change keyup', function() {
|
||||||
$(this).each(function() {
|
$(this).each(function() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue