aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/assets')
-rw-r--r--phpBB/assets/javascript/core.js41
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() {