forked from bbloomf/jgabc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.autosize-min.js
7 lines (7 loc) · 2.05 KB
/
jquery.autosize-min.js
1
2
3
4
5
6
7
/*!
jQuery Autosize v1.16.13
(c) 2013 Jack Moore - jacklmoore.com
updated: 2013-06-04
license: http://www.opensource.org/licenses/mit-license.php
*/
(function(e){var t,o={className:"autosizejs",append:"",callback:!1},i="hidden",n="border-box",s="lineHeight",a='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],l="oninput",c="onpropertychange",h=e(a).data("autosize",!0)[0];h.style.lineHeight="99px","99px"===e(h).css(s)&&r.push(s),h.style.lineHeight="",e.fn.autosize=function(s){return s=e.extend({},o,s||{}),h.parentNode!==document.body&&e(document.body).append(h),this.each(function(){function o(){if(t=f,h.className=s.className,d=parseInt(w.css("maxHeight"),10),e.each(r,function(e,t){h.style[t]=w.css(t)}),l in f){var o=f.style.width;f.style.width="0px",f.offsetWidth,f.style.width=o}}function a(){var e,n,a;t!==f&&o(),h.value=f.value+s.append,h.style.overflowY=f.style.overflowY,a=parseInt(f.style.height,10),h.style.width=Math.max(w.width(),0)+"px",h.scrollTop=0,h.scrollTop=9e4,e=h.scrollTop,d&&e>d?(e=d,n="scroll"):p>e&&(e=p),e+=b,f.style.overflowY=n||i,a!==e&&(f.style.height=e+"px",x&&s.callback.call(f,f))}var p,d,u,f=this,w=e(f),b=0,x=e.isFunction(s.callback);w.data("autosize")||((w.css("box-sizing")===n||w.css("-moz-box-sizing")===n||w.css("-webkit-box-sizing")===n)&&(b=w.outerHeight()-w.height()),p=Math.max(parseInt(w.css("minHeight"),10)-b||0,w.height()),u="none"===w.css("resize")||"vertical"===w.css("resize")?"none":"horizontal",w.css({overflow:i,overflowY:i,wordWrap:"break-word",resize:u}).data("autosize",!0),c in f?l in f?f[l]=f.onkeyup=a:f[c]=function(){"value"===event.propertyName&&a()}:f[l]=a,e(window).on("resize",function(){active=!1,a()}),w.on("autosize",function(){active=!1,a()}),a())})}})(window.jQuery||window.Zepto);