/*! Non-Sucking Autogrow 1.1.6 license: MIT author: Roman Pushkin https://github.com/ro31337/jquery.ns-autogrow */ (function() { var getVerticalScrollbarWidth; (function($, window) { return $.fn.autogrow = function(options) { if (options == null) { options = {}; } if (options.horizontal == null) { options.horizontal = true; } if (options.vertical == null) { options.vertical = true; } if (options.debugx == null) { options.debugx = -10000; } if (options.debugy == null) { options.debugy = -10000; } if (options.debugcolor == null) { options.debugcolor = 'yellow'; } if (options.flickering == null) { options.flickering = true; } if (options.postGrowCallback == null) { options.postGrowCallback = function() {}; } if (options.verticalScrollbarWidth == null) { options.verticalScrollbarWidth = getVerticalScrollbarWidth(); } if (options.horizontal === false && options.vertical === false) { return; } return this.filter('textarea').each(function() { var $e, $shadow, fontSize, heightPadding, minHeight, minWidth, update; $e = $(this); if ($e.data('autogrow-enabled')) { return; } $e.data('autogrow-enabled'); minHeight = $e.height(); minWidth = $e.width(); heightPadding = $e.css('lineHeight') * 1 || 0; $e.hasVerticalScrollBar = function() { return $e[0].clientHeight < $e[0].scrollHeight; }; $shadow = $('
').css({ position: 'absolute', display: 'inline-block', 'background-color': options.debugcolor, top: options.debugy, left: options.debugx, 'max-width': $e.css('max-width'), 'padding': $e.css('padding'), fontSize: $e.css('fontSize'), fontFamily: $e.css('fontFamily'), fontWeight: $e.css('fontWeight'), lineHeight: $e.css('lineHeight'), resize: 'none', 'word-wrap': 'break-word' }).appendTo(document.body); if (options.horizontal === false) { $shadow.css({ 'width': $e.width() }); } else { fontSize = $e.css('font-size'); $shadow.css('padding-right', '+=' + fontSize); $shadow.normalPaddingRight = $shadow.css('padding-right'); } update = (function(_this) { return function(event) { var height, val, width; val = _this.value.replace(/&/g, '&').replace(//g, '>').replace(/\n /g, '