20 lines
49 KiB
JavaScript
20 lines
49 KiB
JavaScript
|
/*
|
||
|
* /MathJax/jax/output/SVG/jax.js
|
||
|
*
|
||
|
* Copyright (c) 2009-2014 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.
|
||
|
*/
|
||
|
|
||
|
(function(h,c,e,a){var g;var b="http://www.w3.org/2000/svg";var j="http://www.w3.org/1999/xlink";a.Augment({config:{styles:{".MathJax_SVG":{display:"inline","font-style":"normal","font-weight":"normal","line-height":"normal","font-size":"100%","font-size-adjust":"none","text-indent":0,"text-align":"left","text-transform":"none","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none",direction:"ltr","max-width":"none","max-height":"none","min-width":0,"min-height":0,border:0,padding:0,margin:0},".MathJax_SVG_Display":{position:"relative",display:"block!important","text-indent":0,"max-width":"none","max-height":"none","min-width":0,"min-height":0,width:"100%"},".MathJax_SVG *":{transition:"none","-webkit-transition":"none","-moz-transition":"none","-ms-transition":"none","-o-transition":"none"},".mjx-svg-href":{fill:"blue",stroke:"blue"},".MathJax_SVG_Processing":{visibility:"hidden",position:"absolute",top:0,left:0,width:0,height:0,overflow:"hidden",display:"block!important"},".MathJax_SVG_Processed":{display:"none!important"},".MathJax_SVG_ExBox":{display:"block!important",overflow:"hidden",width:"1px",height:"60ex","min-height":0,"max-height":"none",padding:0,border:0,margin:0},"#MathJax_SVG_Tooltip":{position:"absolute",left:0,top:0,width:"auto",height:"auto",display:"none"}}},hideProcessedMath:true,fontNames:["TeX","STIX","STIX-Web","Asana-Math","Gyre-Termes","Gyre-Pagella","Latin-Modern","Neo-Euler"],Config:function(){this.SUPER(arguments).Config.apply(this,arguments);var m=c.config.menuSettings,l=this.config,k=m.font;if(m.scale){l.scale=m.scale}if(k&&k!=="Auto"){k=k.replace(/(Local|Web|Image)$/i,"");k=k.replace(/([a-z])([A-Z])/,"$1-$2");this.fontInUse=k}else{this.fontInUse=l.font||"TeX"}if(this.fontNames.indexOf(this.fontInUse)<0){this.fontInUse="TeX"}this.fontDir+="/"+this.fontInUse;if(!this.require){this.require=[]}this.require.push(this.fontDir+"/fontdata.js");this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js")},Startup:function(){EVENT=MathJax.Extension.MathEvents.Event;TOUCH=MathJax.Extension.MathEvents.Touch;HOVER=MathJax.Extension.MathEvents.Hover;this.ContextMenu=EVENT.ContextMenu;this.Mousedown=EVENT.AltContextMenu;this.Mouseover=HOVER.Mouseover;this.Mouseout=HOVER.Mouseout;this.Mousemove=HOVER.Mousemove;this.hiddenDiv=e.Element("div",{style:{visibility:"hidden",overflow:"hidden",position:"absolute",top:0,height:"1px",width:"auto",padding:0,border:0,margin:0,textAlign:"left",textIndent:0,textTransform:"none",lineHeight:"normal",letterSpacing:"normal",wordSpacing:"normal"}});if(!document.body.firstChild){document.body.appendChild(this.hiddenDiv)}else{document.body.insertBefore(this.hiddenDiv,document.body.firstChild)}this.hiddenDiv=e.addElement(this.hiddenDiv,"div",{id:"MathJax_SVG_Hidden"});var k=e.addElement(this.hiddenDiv,"div",{style:{width:"5in"}});this.pxPerInch=k.offsetWidth/5;this.hiddenDiv.removeChild(k);this.textSVG=this.Element("svg");d=this.addElement(this.addElement(this.hiddenDiv.parentNode,"svg"),"defs",{id:"MathJax_SVG_glyphs"});f={};this.ExSpan=e.Element("span",{style:{position:"absolute","font-size-adjust":"none"}},[["span",{className:"MathJax_SVG_ExBox"}]]);this.linebreakSpan=e.Element("span",null,[["hr",{style:{width:"auto",size:1,padding:0,border:0,margin:0}}]]);return h.Styles(this.config.styles,["InitializeSVG",this])},InitializeSVG:function(){document.body.appendChild(this.ExSpan);document.body.appendChild(this.linebreakSpan);this.defaultEx=this.ExSpan.firstChild.offsetHeight/60;this.defaultWidth=this.linebreakSpan.firstChild.offsetWidth;document.body.removeChild(this.linebreakSpan);document.body.removeChild(this.ExSpan)},preTranslate:function(o){var t=o.jax[this.id],u,r=t.length,z,s,A,n,y,l,x,q,k,w=false,v,B=this.config.linebreaks.automatic,p=this.config.linebreaks.width;if(B){w=(p.match(/^\s*(\d+(\.\d*)?%\s*)?container\s*$/)!=null);if(w){p=p.replace(/\s*container\s*/,"")}else{k=this.defaultWidth}if(p===""){p="100%"}}else{k=100000}for(u=0;u<r;u++){z=t[u];if(!z.parentNode){continue}s=z.previousSibling;if(s&&String(s.
|