mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-30 00:53:20 +00:00
20 lines
11 KiB
JavaScript
20 lines
11 KiB
JavaScript
|
/*
|
||
|
* /MathJax/jax/output/CommonHTML/autoload/mtable.js
|
||
|
*
|
||
|
* Copyright (c) 2009-2018 The MathJax Consortium
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function(){var g="2.7.5";var b=MathJax.ElementJax.mml,a=MathJax.Hub.config,e=MathJax.OutputJax.CommonHTML,d=MathJax.Hub.SplitList;var c=-1,f=1000000;b.mtable.Augment({toCommonHTML:function(l){var m={rows:[],labels:[],labeled:false};l=this.CHTMLdefaultNode(l,{noBBox:true,childOptions:m});var k=e.Element("mjx-table");while(l.firstChild){k.appendChild(l.firstChild)}l.appendChild(k);var h=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","width","side","minlabelspacing","useHeight");var j=e.TEX.min_rule_thickness/e.em;m.t=e.Px(j*this.CHTML.scale,1);this.CHTMLgetBoxSizes(h,m);this.CHTMLgetAttributes(h,m);this.CHTMLadjustCells(h,m);if(h.frame){k.style.border=m.t+" "+h.frame}this.CHTMLalignV(h,m,l);this.CHTMLcolumnWidths(h,m,l);this.CHTMLstretchCells(h,m);if(m.labeled){this.CHTMLaddLabels(h,m,l,k)}var i=this.CHTML;i.w=i.r=m.R;i.h=i.t=m.T-m.B;i.d=i.b=m.B;if(!h.frame&&!i.pwidth){l.style.padding="0 "+e.Em(1/6);i.L=i.R=1/6}this.CHTMLhandleSpace(l);this.CHTMLhandleBBox(l);this.CHTMLhandleColor(l);return l},CHTMLgetBoxSizes:function(z,k){var r=e.FONTDATA.lineH*z.useHeight,t=e.FONTDATA.lineD*z.useHeight;var y=[],h=[],l=[],w=-1,q,n;for(q=0,n=this.data.length;q<n;q++){var B=this.data[q],A=(B.type==="mtr"?0:c);y[q]=r;h[q]=t;for(var p=A,v=B.data.length+A;p<v;p++){if(l[p]==null){l[p]=-f;if(p>w){w=p}}var u=B.data[p-A].CHTML;if(u.h>y[q]){y[q]=u.h}if(u.d>h[q]){h[q]=u.d}if(u.w>l[p]){l[p]=u.w}}}if(z.equalrows){k.HD=true;var x=Math.max.apply(Math,y);var o=Math.max.apply(Math,h);for(q=0,n=y.length;q<n;q++){y[q]=x;h[q]=o}}k.H=y;k.D=h;k.W=l,k.J=w},CHTMLgetAttributes:function(v,j){var l=d(v.columnspacing),x=d(v.rowspacing),t=d(v.columnalign),r=d(v.rowalign),k=d(v.columnlines),w=d(v.rowlines),o=d(v.columnwidth),n=[],q,p,u=j.J,s=j.rows.length-1;for(q=0,p=l.length;q<p;q++){l[q]=this.CHTMLlength2em(l[q])}for(q=0,p=x.length;q<p;q++){x[q]=this.CHTMLlength2em(x[q])}while(l.length<u){l.push(l[l.length-1])}while(t.length<=u){t.push(t[t.length-1])}while(k.length<u){k.push(k[k.length-1])}while(o.length<=u){o.push(o[o.length-1])}while(x.length<s){x.push(x[x.length-1])}while(r.length<=s){r.push(r[r.length-1])}while(w.length<s){w.push(w[w.length-1])}t[c]=(v.side.substr(0,1)==="l"?"left":"right");for(q=0;q<=s;q++){var y=this.data[q];n[q]=[];if(y.rowalign){r[q]=y.rowalign}if(y.columnalign){n[q]=d(y.columnalign);while(n[q].length<=u){n[q].push(n[q][n[q].length-1])}}}var h=d(v.framespacing);if(h.length!=2){h=d(this.defaults.framespacing)}h[0]=Math.max(0,this.CHTMLlength2em(h[0]));h[1]=Math.max(0,this.CHTMLlength2em(h[1]));if(v.columnlines.replace(/none/g,"").replace(/ /g,"")!==""||v.rowlines.replace(/none/g,"").replace(/ /g,"")!==""){v.fspace=true}if(v.frame===b.LINES.NONE){delete v.frame}else{v.fspace=true}if(v.frame){h[0]=Math.max(0,h[0]);h[1]=Math.max(0,h[1])}if(v.fspace){l[u]=h[0];x[s]=h[1]}else{l[u]=x[s]=0}k[u]=w[s]=b.LINES.NONE;j.CSPACE=l;j.RSPACE=x;j.CALIGN=t;j.RALIGN=r;j.CLINES=k;j.RLINES=w;j.CWIDTH=o;j.RCALIGN=n;j.FSPACE=h},CHTMLadjustCells:function(l,r){var S=r.rows,W=r.CSPACE,o=r.CLINES,x=r.RSPACE,F=r.RLINES,V=r.CALIGN,q=r.RALIGN,G=r.RCALIGN;W[r.J]*=2;x[S.length-1]*=2;var p="0",I,t,z,N,n,P,U=0;if(l.fspace){U=r.FSPACE[1];p=e.Em(r.FSPACE[1])}r.RHD=[];r.RH=[];for(var Q=0,K=S.length;Q<K;Q++){var w=S[Q],v=this.data[Q];I=x[Q]/2;N=null;z="0";if(F[Q]!==b.LINES.NONE&&F[Q]!==""){N=r.t+" "+F[Q]}if(N||(o[O]!==b.LINES.NONE&&o[O]!=="")){while(w.length<=r.J){w.push(e.addElement(w.node,"mjx-mtd",null,[["span"]]))}}r.RH[Q]=U+r.H[Q];U=Math.max(0,I);r.RHD[Q]=r.RH[Q]+U+r.D[Q];I=e.Em(U);if(l.fspace){z=e.Em(r.FSPACE[0])}for(var O=0,y=w.length;O<y;O++){var E=(v.type==="mtr"?0:c);var J=v.data[O-E]||{CHTML:e.BBOX.zero()};var k=w[O].style;n=J.CHTML;t=W[O]/2;if(o[O]!==b.LINES.NONE){k.borderRight=r.t+" "+o[O];t-=1/e.em/2}t=e.Em(Math.max(0,t));k.padding=p+" "+t+" 0px "+z;if(N){k.borderBottom=N}z=t;P=(J.rowalign||(this.data[Q]||{}).rowalign||q[Q]);var A=Math.max(1,n.h),C=Math.max(0.2,n.d),h=(r.H[Q]+r.D[Q])-(A+C),u=w
|