markdown-live-preview/js/jquery.autosize-min.js
Hideaki Tanabe 32c07059da Merge design renewal branch.
Squashed commit of the following:

commit 0e5bd00043ffe0e8deba53447f998dc4b78da15a
Author: Hideaki Tanabe <tanablog@gmail.com>
Date:   Sun Feb 17 02:32:48 2013 +0900

    Update Google Analytics code.

commit f8121229e63a5d96cb2dd3e2916f3b65924295ae
Author: Hideaki Tanabe <tanablog@gmail.com>
Date:   Sun Feb 17 02:11:07 2013 +0900

    Add copyright.

commit b45120bb56d00f299907c1067a57a84df45ddc2f
Author: Hideaki Tanabe <tanablog@gmail.com>
Date:   Sun Feb 17 01:46:48 2013 +0900

    almost done.

commit 52c2c58c1477a825d5f30ae05412ca4b1d54c31e
Author: Hideaki Tanabe <tanablog@gmail.com>
Date:   Sun Feb 17 00:06:55 2013 +0900

    Imprement core feature.

commit b3ba7989a4dc285d3c15618ea267d29d8d8e6b6a
Author: Hideaki Tanabe <tanablog@gmail.com>
Date:   Fri Feb 15 22:05:59 2013 +0900

    Update libraries
2013-02-17 09:27:39 +09:00

7 lines
2.0 KiB
JavaScript

/*
jQuery Autosize v1.16.5
(c) 2013 Jack Moore - jacklmoore.com
updated: 2013-02-11
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(){t=b,h.className=s.className,e.each(r,function(e,t){h.style[t]=f.css(t)})}function a(){var e,n,a;if(t!==b&&o(),!d){d=!0,h.value=b.value+s.append,h.style.overflowY=b.style.overflowY,a=parseInt(b.style.height,10),h.style.width=Math.max(f.width(),0)+"px",h.scrollTop=0,h.scrollTop=9e4,e=h.scrollTop;var r=parseInt(f.css("maxHeight"),10);r=r&&r>0?r:9e4,e>r?(e=r,n="scroll"):p>e&&(e=p),e+=g,b.style.overflowY=n||i,a!==e&&(b.style.height=e+"px",x&&s.callback.call(b)),setTimeout(function(){d=!1},1)}}var p,d,u,b=this,f=e(b),g=0,x=e.isFunction(s.callback);f.data("autosize")||((f.css("box-sizing")===n||f.css("-moz-box-sizing")===n||f.css("-webkit-box-sizing")===n)&&(g=f.outerHeight()-f.height()),p=Math.max(parseInt(f.css("minHeight"),10)-g,f.height()),u="none"===f.css("resize")||"vertical"===f.css("resize")?"none":"horizontal",f.css({overflow:i,overflowY:i,wordWrap:"break-word",resize:u}).data("autosize",!0),c in b?l in b?b[l]=b.onkeyup=a:b[c]=a:b[l]=a,e(window).resize(function(){d=!1,a()}),f.bind("autosize",function(){d=!1,a()}),a())})}})(window.jQuery||window.Zepto);