d4b805fc9078e38c3916880ad63f9db3ab076a61
[Packages/TYPO3.CMS.git] / typo3 / contrib / jquery / jquery.autosize.min.js
1 /*!
2 Autosize 1.18.17 as UMD module
3 license: MIT
4 http://www.jacklmoore.com/autosize
5 derived: https://github.com/bmack/autosize
6 */
7 (function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);}else{if(typeof exports==="object"){a(require("jquery"));}else{a(jQuery);}}}(function(b){var e={className:"autosizejs",id:"autosizejs",append:"\n",callback:false,resizeDelay:10,placeholder:true},f='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 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; transition:none; -webkit-transition:none; -moz-transition:none;"/>',a=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent","whiteSpace"],d,c=b(f).data("autosize",true)[0];c.style.lineHeight="99px";if(b(c).css("lineHeight")==="99px"){a.push("lineHeight");}c.style.lineHeight="";b.fn.autosize=function(g){if(!this.length){return this;}g=b.extend({},e,g||{});if(c.parentNode!==document.body){b(document.body).append(c);}return this.each(function(){var m=this,l=b(m),s,u,k=0,t=b.isFunction(g.callback),n={height:m.style.height,overflow:m.style.overflow,overflowY:m.style.overflowY,wordWrap:m.style.wordWrap,resize:m.style.resize},p,h=l.width(),j=l.css("resize");if(l.data("autosize")){return;}l.data("autosize",true);if(l.css("box-sizing")==="border-box"||l.css("-moz-box-sizing")==="border-box"||l.css("-webkit-box-sizing")==="border-box"){k=l.outerHeight()-l.height();}u=Math.max(parseFloat(l.css("minHeight"))-k||0,l.height());l.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word"});if(j==="vertical"){l.css("resize","none");}else{if(j==="both"){l.css("resize","horizontal");}}function o(){var w;var v=window.getComputedStyle?window.getComputedStyle(m,null):null;if(v){w=parseFloat(v.width);if(v.boxSizing==="border-box"||v.webkitBoxSizing==="border-box"||v.mozBoxSizing==="border-box"){b.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(x,y){w-=parseFloat(v[y]);});}}else{w=l.width();}c.style.width=Math.max(w,0)+"px";}function r(){var w={};d=m;c.className=g.className;c.id=g.id;s=parseFloat(l.css("maxHeight"));b.each(a,function(y,z){w[z]=l.css(z);});b(c).css(w).attr("wrap",l.attr("wrap"));o();if(window.chrome){var v=m.style.width;m.style.width="0px";var x=m.offsetWidth;m.style.width=v;}}function q(){var v,w;if(d!==m){r();}else{o();}if(!m.value&&g.placeholder){c.value=(l.attr("placeholder")||"");}else{c.value=m.value;}c.value+=g.append||"";c.style.overflowY=m.style.overflowY;w=parseFloat(m.style.height)||0;c.scrollTop=0;c.scrollTop=90000;v=c.scrollTop;if(s&&v>s){m.style.overflowY="scroll";v=s;}else{m.style.overflowY="hidden";if(v<u){v=u;}}v+=k;if(Math.abs(w-v)>1/100){m.style.height=v+"px";c.className=c.className;if(t){g.callback.call(m,m);}l.trigger("autosize.resized");}}function i(){clearTimeout(p);p=setTimeout(function(){var v=l.width();if(v!==h){h=v;q();}},parseInt(g.resizeDelay,10));}if("onpropertychange" in m){if("oninput" in m){l.on("input.autosize keyup.autosize",q);}else{l.on("propertychange.autosize",function(){if(event.propertyName==="value"){q();}});}}else{l.on("input.autosize",q);}if(g.resizeDelay!==false){b(window).on("resize.autosize",i);}l.on("autosize.resize",q);l.on("autosize.resizeIncludeStyle",function(){d=null;q();});l.on("autosize.destroy",function(){d=null;clearTimeout(p);b(window).off("resize",i);l.off("autosize").off(".autosize").css(n).removeData("autosize");});q();});};}));