instiki/public/MathJax/jax/output/HTML-CSS/autoload/menclose.js

17 lines
7.1 KiB
JavaScript
Raw Normal View History

/*
2011-01-28 02:12:00 +01:00
* /MathJax/jax/output/HTML-CSS/autoload/menclose.js
*
* Copyright (c) 2010 Design Science, Inc.
*
* Part of the MathJax library.
* See http://www.mathjax.org for details.
*
* Licensed under the Apache License, Version 2.0;
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
2011-06-03 09:03:06 +02:00
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var d="1.1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];var c="http://www.w3.org/2000/svg";var f="urn:schemas-microsoft-com:vml";var e="mjxvml";a.menclose.Augment({toHTML:function(Q){var j=this.getValues("notation","thickness","padding","mathcolor","color");if(j.color&&!this.mathcolor){j.mathcolor=j.color}if(j.thickness==null){j.thickness=".075em"}if(j.padding==null){j.padding=".2em"}var M=b.length2em(j.padding);var E=b.length2em(j.thickness);var x=b.Em(E)+" solid";Q=this.HTMLcreateSpan(Q);var u=b.createStack(Q);var q=b.createBox(u);this.HTMLmeasureChild(0,q);var A=q.bbox.h+M+E,G=q.bbox.d+M+E,k=q.bbox.w+2*(M+E);var F=b.createFrame(u,A+G,0,k,E,"none");F.id="MathJax-frame-"+this.spanID;b.addBox(u,F);u.insertBefore(F,q);var l=j.notation.split(/ /);var n=0,K=0,o=0,v=0,C=0,z=0;var J,g;if(!j.mathcolor){j.mathcolor="black"}else{Q.style.color=j.mathcolor}for(var P=0,O=l.length;P<O;P++){switch(l[P]){case a.NOTATION.BOX:F.style.border=x;if(!b.msieBorderWidthBug){n=K=v=o=E}break;case a.NOTATION.ROUNDEDBOX:if(b.useVML){if(!g){g=this.HTMLvml(u,A,G,k,E,j.mathcolor)}var I=Math.floor(1000*Math.min(k,A+G)-2*E);var y=Math.floor(4000*(k-2*E)),S=Math.floor(4000*(A+G-2*E));this.HTMLvmlElement(g,"shape",{style:{width:this.HTMLpx(k-2*E),height:this.HTMLpx(A+G-2*E),left:this.HTMLpx(E,0.5),top:this.HTMLpx(E,0.5)},path:"m "+I+",0 qx 0,"+I+" l 0,"+(S-I)+" qy "+I+","+S+" l "+(y-I)+","+S+" qx "+y+","+(S-I)+" l "+y+","+I+" qy "+(y-I)+",0 x e",coordsize:y+","+S})}else{if(!J){J=this.HTMLsvg(u,A,G,k,E,j.mathcolor)}this.HTMLsvgElement(J.firstChild,"rect",{x:1,y:1,width:this.HTMLpx(k-E)-1,height:this.HTMLpx(A+G-E)-1,rx:this.HTMLpx(Math.min(A+G,k)/4)})}break;case a.NOTATION.CIRCLE:if(b.useVML){if(!g){g=this.HTMLvml(u,A,G,k,E,j.mathcolor)}this.HTMLvmlElement(g,"oval",{style:{width:this.HTMLpx(k-2*E),height:this.HTMLpx(A+G-2*E),left:this.HTMLpx(E,0.5),top:this.HTMLpx(E,0.5)}})}else{if(!J){J=this.HTMLsvg(u,A,G,k,E,j.mathcolor)}this.HTMLsvgElement(J.firstChild,"ellipse",{rx:this.HTMLpx(k/2-E),ry:this.HTMLpx((A+G)/2-E),cx:this.HTMLpx(k/2),cy:this.HTMLpx((A+G)/2)})}break;case a.NOTATION.LEFT:F.style.borderLeft=x;if(!b.msieBorderWidthBug){v=E}break;case a.NOTATION.ACTUARIAL:F.style.borderTop=x;if(!b.msieBorderWidthBug){n=E;F.bbox.w+=M-E}case a.NOTATION.RIGHT:F.style.borderRight=x;if(!b.msieBorderWidthBug){o=E}break;case a.NOTATION.VERTICALSTRIKE:var s=b.createRule(u,A+G-E/2,0,E);b.addBox(u,s);b.placeBox(s,M+E+q.bbox.w/2,-G,true);break;case a.NOTATION.TOP:F.style.borderTop=x;if(!b.msieBorderWidthBug){n=E}break;case a.NOTATION.BOTTOM:F.style.borderBottom=x;if(!b.msieBorderWidthBug){K=E}break;case a.NOTATION.HORIZONTALSTRIKE:var N=b.createRule(u,E,0,k-E/2);b.addBox(u,N);b.placeBox(N,0,(A+G)/2-G,true);break;case a.NOTATION.UPDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(u,A,G,k,E,j.mathcolor)}this.HTMLvmlElement(g,"line",{from:"0,"+this.HTMLpx(A+G-E),to:this.HTMLpx(k)+",0"})}else{if(!J){J=this.HTMLsvg(u,A,G,k,E,j.mathcolor)}this.HTMLsvgElement(J.firstChild,"line",{x1:1,y1:this.HTMLpx(A+G-E),x2:this.HTMLpx(k-E),y2:this.HTMLpx(E)})}break;case a.NOTATION.DOWNDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(u,A,G,k,E,j.mathcolor)}this.HTMLvmlElement(g,"line",{from:"0,0",to:this.HTMLpx(k)+","+this.HTMLpx(A+G-E)})}else{if(!J){J=this.HTMLsvg(u,A,G,k,E,j.mathcolor)}this.HTMLsvgElement(J.firstChild,"line",{x1:1,y1:this.HTMLpx(E),x2:this.HTMLpx(k-E),y2:this.HTMLpx(A+G-E)})}break;case a.NOTATION.MADRUWB:F.style.borderBottom=x;F.style.borderRight=x;if(!b.msieBorderWidthBug){K=o=E}break;case a.NOTATION.RADICAL:if(b.useVML){if(!g){g=this.HTMLvml(u,A,G,k,E,j.mathcolor)}this.HTMLvmlElement(g,"shape",{style:{width:this.HTMLpx(k),height:this.HTMLpx(A+G)},path:"m "+this.HTMLpt(E/2,0.6*(A+G))+" l "+this.HTMLpt(M,A+G-E)+" "+this.HTMLpt(2*M,E/2)+" "+this.HTMLpt(k,E/2)+" e",coordsize:this.HTMLpt(k,A+G)});C=M}else{if(!J){J=this.HTMLsvg(u,A,G,k,E,j.mathcolor)}this.HTMLsvgElement(J.firstChild,"path",{d:"M 1,"+this.HTMLpx(0.6*(A+G))+" L "+this.HTMLpx(M)+","+this.HTMLpx(A+G)+" L "+this.HTMLpx(2*M)+",1 L "+