12345678910111213 |
- /*
- * /MathJax/jax/output/SVG/autoload/maction.js
- *
- * Copyright (c) 2009-2013 The MathJax Consortium
- *
- * 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
- */MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var k=MathJax.ElementJax.mml,g=MathJax.OutputJax.SVG,m,h,d,f=g.config.tooltip=MathJax.Hub.Insert({delayPost:600,delayClear:600,offsetX:10,offsetY:5},g.config.tooltip||{});k.maction.Augment({SVGtooltip:MathJax.HTML.addElement(document.body,"div",{id:"MathJax_SVG_Tooltip"}),toSVG:function(a,b){this.SVGgetStyles();var c=this.SVG();if("null"==this.selected().type)return this.SVGsaveData(c),c;c.Add(this.SVGdataStretched(this.Get("selection")-1,a,b));this.SVGhandleHitBox(c);this.SVGhandleSpace(c);this.SVGhandleColor(c);this.SVGsaveData(c);return c},SVGhandleHitBox:function(a){var b=g.addElement(a.element,"rect",{width:a.w,height:a.h+a.d,y:-a.d,fill:"none","pointer-events":"all"}),c=this.Get("actiontype");this.SVGaction[c]&&this.SVGaction[c].call(this,a,b,this.Get("selection"))},SVGstretchH:k.mbase.prototype.SVGstretchH,SVGstretchV:k.mbase.prototype.SVGstretchV,SVGaction:{toggle:function(a,b,c){this.selection=c;g.Element(b,{cursor:"pointer"});b.onclick=MathJax.Callback(["SVGclick",this])},statusline:function(a,b,c){b.onmouseover=MathJax.Callback(["SVGsetStatus",this]);b.onmouseout=MathJax.Callback(["SVGclearStatus",this]);b.onmouseover.autoReset=b.onmouseout.autoReset=!0},tooltip:function(a,b,c){b.onmouseover=MathJax.Callback(["SVGtooltipOver",this]);b.onmouseout=MathJax.Callback(["SVGtooltipOut",this]);b.onmouseover.autoReset=b.onmouseout.autoReset=!0}},SVGclick:function(a){this.selection++;this.selection>this.data.length&&(this.selection=1);for(var b=this;"math"!==b.type;)b=b.inherit;MathJax.Hub.getJaxFor(b.inputID).Update();return MathJax.Extension.MathEvents.Event.False(a)},SVGsetStatus:function(a){this.messageID=MathJax.Message.Set(this.data[1]&&this.data[1].isToken?this.data[1].data.join(""):this.data[1].toString())},SVGclearStatus:function(a){this.messageID&&MathJax.Message.Clear(this.messageID,0);delete this.messageID},SVGtooltipOver:function(a){a||(a=window.event);d&&(clearTimeout(d),d=null);h&&clearTimeout(h);var b=a.pageX,c=a.pageY;null==b&&(b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);a=MathJax.Callback(["SVGtooltipPost",this,b+f.offsetX,c+f.offsetY]);h=setTimeout(a,f.delayPost)},SVGtooltipOut:function(a){h&&(clearTimeout(h),h=null);d&&clearTimeout(d);a=MathJax.Callback(["SVGtooltipClear",this,80]);d=setTimeout(a,f.delayClear)},SVGtooltipPost:function(a,b){h=null;d&&(clearTimeout(d),d=null);var c=this.SVGtooltip;c.style.display="block";c.style.opacity="";if(this!==m){c.style.left=a+"px";c.style.top=b+"px";c.innerHTML="";for(var g=MathJax.HTML.addElement(c,"span"),e=this;"math"!==e.type;)e=e.inherit;e=MathJax.Hub.getJaxFor(e.inputID);this.em=k.mbase.prototype.em=e.SVG.em;this.ex=e.SVG.ex;this.linebreakWidth=1E3*e.SVG.lineWidth;this.cwidth=e.SVG.cwidth;var f=this.data[1],e=k.math(f);try{e.toSVG(g,c)}catch(l){this.SetData(1,f);c.style.display="none";if(!l.restart)throw l;MathJax.Callback.After(["SVGtooltipPost",this,a,b],l.restart);return}this.SetData(1,f);m=this}},SVGtooltipClear:function(a){var b=this.SVGtooltip;0>=a?(b.style.display="none",b.style.opacity="",d=null):(b.style.opacity=a/100,d=setTimeout(MathJax.Callback(["SVGtooltipClear",this,a-20]),50))}});MathJax.Hub.Startup.signal.Post("SVG maction Ready");MathJax.Ajax.loadComplete(g.autoloadDir+"/maction.js")});
|