aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets
diff options
context:
space:
mode:
authorVjacheslav Trushkin <cyberalien@gmail.com>2013-10-18 23:43:32 +0300
committerVjacheslav Trushkin <cyberalien@gmail.com>2013-10-18 23:43:32 +0300
commit12c34e4176a084ecf66da5015f3989ed7a1e2e25 (patch)
tree57c6f93b0d6dcf76c8945f1ca01855c5993ffb9e /phpBB/assets
parentf93d2cbdc1fee592b15daf13afcb4d21a97573b0 (diff)
downloadforums-12c34e4176a084ecf66da5015f3989ed7a1e2e25.tar
forums-12c34e4176a084ecf66da5015f3989ed7a1e2e25.tar.gz
forums-12c34e4176a084ecf66da5015f3989ed7a1e2e25.tar.bz2
forums-12c34e4176a084ecf66da5015f3989ed7a1e2e25.tar.xz
forums-12c34e4176a084ecf66da5015f3989ed7a1e2e25.zip
[ticket/11552] Fixes for auto-resize textarea
Changing auto-resize code to work with all possible box-sizing and checking for negative height. PHPBB3-11552
Diffstat (limited to 'phpBB/assets')
-rw-r--r--phpBB/assets/javascript/core.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index cdba6f9d26..54c807a87c 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -624,8 +624,7 @@ phpbb.resizeTextArea = function(items, options) {
function resetAutoResize(item)
{
var $item = $(item);
- if ($item.hasClass('auto-resized'))
- {
+ if ($item.hasClass('auto-resized')) {
$(item).css({height: '', resize: ''}).removeClass('auto-resized');
configuration.resetCallback.call(item, $item);
}
@@ -635,14 +634,14 @@ phpbb.resizeTextArea = function(items, options) {
{
function setHeight(height)
{
+ height += parseInt($item.css('height')) - $item.height();
$item.css({height: height + 'px', resize: 'none'}).addClass('auto-resized');
configuration.resizeCallback.call(item, $item);
}
var windowHeight = $(window).height();
- if (windowHeight < configuration.minWindowHeight)
- {
+ if (windowHeight < configuration.minWindowHeight) {
resetAutoResize(item);
return;
}
@@ -652,12 +651,14 @@ phpbb.resizeTextArea = function(items, options) {
height = parseInt($item.height()),
scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0;
- if (height > maxHeight)
- {
+ if (height < 0) {
+ return;
+ }
+
+ if (height > maxHeight) {
setHeight(maxHeight);
}
- else if (scrollHeight > (height + 5))
- {
+ else if (scrollHeight > (height + 5)) {
setHeight(Math.min(maxHeight, scrollHeight));
}
}
@@ -670,8 +671,7 @@ phpbb.resizeTextArea = function(items, options) {
$(window).resize(function() {
items.each(function() {
- if ($(this).hasClass('auto-resized'))
- {
+ if ($(this).hasClass('auto-resized')) {
autoResize(this);
}
});