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

17 lines
6.6 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-01 21:35:18 +02:00
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var d="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(K){var h=this.getValues("notation","thickness","padding","mathcolor","color");if(h.color&&!this.mathcolor){h.mathcolor=h.color}if(h.thickness==null){h.thickness=".075em"}if(h.padding==null){h.padding=".2em"}var F=b.length2em(h.padding);var y=b.length2em(h.thickness);var u=b.Em(y)+" solid";K=this.HTMLcreateSpan(K);var r=b.createStack(K);var o=b.createBox(r);this.HTMLmeasureChild(0,o);var w=o.bbox.h+F+y,A=o.bbox.d+F+y,j=o.bbox.w+2*(F+y);var z=b.createFrame(r,w+A,0,j,y,"none");z.id="MathJax-frame-"+this.spanID;b.addBox(r,z);r.insertBefore(z,o);var k=h.notation.split(/ /);var l=0,E=0,n=0,s=0,x=0,v=0;var C,g;if(!h.mathcolor){h.mathcolor="black"}else{K.style.color=h.mathcolor}for(var J=0,I=k.length;J<I;J++){switch(k[J]){case a.NOTATION.BOX:z.style.border=u;if(!b.msieBorderWidthBug){l=E=s=n=y}break;case a.NOTATION.ROUNDEDBOX:if(b.useVML){if(!g){g=this.HTMLvml(r,w,A,j,y,h.mathcolor)}this.HTMLvmlElement(g,"roundrect",{style:{width:this.HTMLpx(j-2*y),height:this.HTMLpx(w+A-2*y),left:this.HTMLpx(y)+0.5,top:this.HTMLpx(y)+0.5},arcsize:".25"})}else{if(!C){C=this.HTMLsvg(r,w,A,j,y,h.mathcolor)}this.HTMLsvgElement(C.firstChild,"rect",{x:1,y:1,width:this.HTMLpx(j-y)-1,height:this.HTMLpx(w+A-y)-1,rx:this.HTMLpx(Math.min(w+A,j)/4)})}break;case a.NOTATION.CIRCLE:if(b.useVML){if(!g){g=this.HTMLvml(r,w,A,j,y,h.mathcolor)}this.HTMLvmlElement(g,"oval",{style:{width:this.HTMLpx(j-2*y),height:this.HTMLpx(w+A-2*y),left:this.HTMLpx(y)+0.5,top:this.HTMLpx(y)+0.5}})}else{if(!C){C=this.HTMLsvg(r,w,A,j,y,h.mathcolor)}this.HTMLsvgElement(C.firstChild,"ellipse",{rx:this.HTMLpx(j/2-y),ry:this.HTMLpx((w+A)/2-y),cx:this.HTMLpx(j/2),cy:this.HTMLpx((w+A)/2)})}break;case a.NOTATION.LEFT:z.style.borderLeft=u;if(!b.msieBorderWidthBug){s=y}break;case a.NOTATION.ACTUARIAL:z.style.borderTop=u;if(!b.msieBorderWidthBug){l=y;z.bbox.w+=F-y}case a.NOTATION.RIGHT:z.style.borderRight=u;if(!b.msieBorderWidthBug){n=y}break;case a.NOTATION.VERTICALSTRIKE:var q=b.createRule(r,w+A-y/2,0,y);b.addBox(r,q);b.placeBox(q,F+y+o.bbox.w/2,-A,true);break;case a.NOTATION.TOP:z.style.borderTop=u;if(!b.msieBorderWidthBug){l=y}break;case a.NOTATION.BOTTOM:z.style.borderBottom=u;if(!b.msieBorderWidthBug){E=y}break;case a.NOTATION.HORIZONTALSTRIKE:var G=b.createRule(r,y,0,j-y/2);b.addBox(r,G);b.placeBox(G,0,(w+A)/2-A,true);break;case a.NOTATION.UPDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(r,w,A,j,y,h.mathcolor)}this.HTMLvmlElement(g,"line",{from:"0,"+this.HTMLpx(w+A-y),to:this.HTMLpx(j)+",0"})}else{if(!C){C=this.HTMLsvg(r,w,A,j,y,h.mathcolor)}this.HTMLsvgElement(C.firstChild,"line",{x1:1,y1:this.HTMLpx(w+A-y),x2:this.HTMLpx(j-y),y2:this.HTMLpx(y)})}break;case a.NOTATION.DOWNDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(r,w,A,j,y,h.mathcolor)}this.HTMLvmlElement(g,"line",{from:"0,0",to:this.HTMLpx(j)+","+this.HTMLpx(w+A-y)})}else{if(!C){C=this.HTMLsvg(r,w,A,j,y,h.mathcolor)}this.HTMLsvgElement(C.firstChild,"line",{x1:1,y1:this.HTMLpx(y),x2:this.HTMLpx(j-y),y2:this.HTMLpx(w+A-y)})}break;case a.NOTATION.MADRUWB:z.style.borderBottom=u;z.style.borderRight=u;if(!b.msieBorderWidthBug){E=n=y}break;case a.NOTATION.RADICAL:if(b.useVML){if(!g){g=this.HTMLvml(r,w,A,j,y,h.mathcolor)}this.HTMLvmlElement(g,"polyline",{points:this.HTMLpx(y/2)+","+this.HTMLpx(0.6*(w+A))+" "+this.HTMLpx(F)+","+this.HTMLpx(w+A-y)+" "+this.HTMLpx(2*F)+","+this.HTMLpx(y/2)+" "+this.HTMLpx(j)+","+this.HTMLpx(y/2)});x=F}else{if(!C){C=this.HTMLsvg(r,w,A,j,y,h.mathcolor)}this.HTMLsvgElement(C.firstChild,"path",{d:"M 1,"+this.HTMLpx(0.6*(w+A))+" L "+this.HTMLpx(F)+","+this.HTMLpx(w+A)+" L "+this.HTMLpx(2*F)+",1 L "+this.HTMLpx(j)+",1"});b.placeBox(C.parentNode,0,F/2-A,true);x=F;v=y}break;case a.NOTATION.LONGDIV:if(b.useVML){if(!g){g=this.HTMLvml(r,w,A,j,y,h.mathcolor)}this.HTMLvmlElement(g,"line",{from:"0,"+this.HTMLpx(y/2),to:this.HTMLpx(j-y)+","+this.HTMLpx(y/2)