reveal-js-base-theme/plugin/math/mathjax/jax/output/SVG/jax.js

20 lines
47 KiB
JavaScript
Raw Normal View History

/*
* /MathJax/jax/output/SVG/jax.js
*
* Copyright (c) 2009-2013 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",border:0,padding:0,margin:0},".MathJax_SVG_Display":{position:"relative",display:"block",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"},".MathJax_SVG_Processed":{display:"none!important"},".MathJax_SVG_ExBox":{display:"block",overflow:"hidden",width:"1px",height:"60ex"},"#MathJax_SVG_Tooltip":{position:"absolute",left:0,top:0,width:"auto",height:"auto",display:"none"}}},hideProcessedMath:true,Config:function(){var k=c.config.menuSettings;if(k.scale){this.config.scale=k.scale}this.SUPER(arguments).Config.apply(this,arguments);this.fontInUse=this.config.font;if(k.font&&k.font!=="Auto"){if(k.font==="TeXWeb"){this.fontInUse="TeX"}else{if(k.font==="STIXWeb"){this.fontInUse="STIX-Web"}else{if(k.font==="AsanaMathWeb"){this.fontInUse="Asana-Math"}else{if(k.font==="GyrePagellaWeb"){this.fontInUse="Gyre-Pagella"}else{if(k.font==="GyreTermesWeb"){this.fontInUse="Gyre-Termes"}else{if(k.font==="LatinModernWeb"){this.fontInUse="Latin-Modern"}else{if(k.font==="NeoEulerWeb"){this.fontInUse="Neo-Euler"}}}}}}}}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.className).match(/^MathJax(_SVG)?(_Display)?( MathJax(_SVG)?_Processing)?$/)){s.parentNode.remove