/* * /MathJax/jax/output/HTML-CSS/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("HTML-CSS Jax Ready",function(){var k=MathJax.ElementJax.mml,d=MathJax.OutputJax["HTML-CSS"],m,g,f,h=d.config.tooltip=MathJax.Hub.Insert({delayPost:600,delayClear:600,offsetX:10,offsetY:5},d.config.tooltip||{});k.maction.Augment({HTMLtooltip:d.addElement(document.body,"div",{id:"MathJax_Tooltip"}),toHTML:function(a,b,c){var e=this.selected();if("null"==e.type)return a=this.HTMLcreateSpan(a),a.bbox=this.HTMLzeroBBox(),a;a=this.HTMLhandleSize(this.HTMLcreateSpan(a));a.bbox=null;var f=e.toHTML(a);null!=c?d.Remeasured(e.HTMLstretchV(a,b,c),a):null!=b?d.Remeasured(e.HTMLstretchH(a,b),a):d.Measured(f,a);this.HTMLhandleHitBox(a);this.HTMLhandleSpace(a);this.HTMLhandleColor(a);return a},HTMLhandleHitBox:function(a,b){var c;if(d.msieHitBoxBug){var e=d.addElement(a,"span",{isMathJax:!0});c=d.createFrame(e,a.bbox.h,a.bbox.d,a.bbox.w,0,"none");a.insertBefore(e,a.firstChild);e.style.marginRight=d.Em(-a.bbox.w);d.msieInlineBlockAlignBug&&(c.style.verticalAlign=d.Em(d.getHD(a).d-a.bbox.d))}else c=d.createFrame(a,a.bbox.h,a.bbox.d,a.bbox.w,0,"none"),a.insertBefore(c,a.firstChild),c.style.marginRight=d.Em(-a.bbox.w);c.className="MathJax_HitBox";c.id="MathJax-HitBox-"+this.spanID+(b||"")+d.idPostfix;e=this.Get("actiontype");this.HTMLaction[e]&&this.HTMLaction[e].call(this,a,c,this.Get("selection"))},HTMLstretchH:k.mbase.HTMLstretchH,HTMLstretchV:k.mbase.HTMLstretchV,HTMLaction:{toggle:function(a,b,c){this.selection=c;b.onclick=a.childNodes[1].onclick=MathJax.Callback(["HTMLclick",this]);b.style.cursor=a.childNodes[1].style.cursor="pointer"},statusline:function(a,b,c){b.onmouseover=a.childNodes[1].onmouseover=MathJax.Callback(["HTMLsetStatus",this]);b.onmouseout=a.childNodes[1].onmouseout=MathJax.Callback(["HTMLclearStatus",this]);b.onmouseover.autoReset=b.onmouseout.autoReset=!0},tooltip:function(a,b,c){this.data[1]&&this.data[1].isToken?b.title=b.alt=a.childNodes[1].title=a.childNodes[1].alt=this.data[1].data.join(""):(b.onmouseover=a.childNodes[1].onmouseover=MathJax.Callback(["HTMLtooltipOver",this]),b.onmouseout=a.childNodes[1].onmouseout=MathJax.Callback(["HTMLtooltipOut",this]),b.onmouseover.autoReset=b.onmouseout.autoReset=!0)}},HTMLclick:function(a){this.selection++;this.selection>this.data.length&&(this.selection=1);for(var b=this;"math"!==b.type;)b=b.inherit;var b=MathJax.Hub.getJaxFor(b.inputID),c=!!b.hover;b.Update();c&&(c=document.getElementById(b.inputID+"-Span"),MathJax.Extension.MathEvents.Hover.Hover(b,c));return MathJax.Extension.MathEvents.Event.False(a)},HTMLsetStatus:function(a){this.messageID=MathJax.Message.Set(this.data[1]&&this.data[1].isToken?this.data[1].data.join(""):this.data[1].toString())},HTMLclearStatus:function(a){this.messageID&&MathJax.Message.Clear(this.messageID,0);delete this.messageID},HTMLtooltipOver:function(a){a||(a=window.event);f&&(clearTimeout(f),f=null);g&&clearTimeout(g);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(["HTMLtooltipPost",this,b+h.offsetX,c+h.offsetY]);g=setTimeout(a,h.delayPost)},HTMLtooltipOut:function(a){g&&(clearTimeout(g),g=null);f&&clearTimeout(f);a=MathJax.Callback(["HTMLtooltipClear",this,80]);f=setTimeout(a,h.delayClear)},HTMLtooltipPost:function(a,b){g=null;f&&(clearTimeout(f),f=null);var c=this.HTMLtooltip;c.style.display="block";c.style.opacity="";c.style.filter=d.config.styles["#MathJax_Tooltip"].filter;if(this!==m){c.style.left=a+"px";c.style.top=b+"px";c.innerHTML='\x3cspan class\x3d"MathJax"\x3e\x3cnobr\x3e\x3c/nobr\x3e\x3c/span\x3e';var e=c.insertBefore(d.EmExSpan.cloneNode(!0),c.firstChild),h=e.firstChild.offsetHeight/60,n=e.lastChild.firstChild.offsetHeight/60;d.em=d.outerEm=k.mbase.prototype.em=n;c.firstChild.style.fontSize=Math.floor(Math.max(d.config.minScaleAdjust/100,h/d.TeX.x_height/n)*d.config.scale)+"%";e.parentNode.removeChild(e);e=d.createStack(c.firstChild.firstChild);e=d.createBox(e);try{d.Measured(this.data[1].toHTML(e),e)}catch(l){if(!l.restart)throw l;c.style.display="none";MathJax.Callback.After(["HTMLtooltipPost",this,a,b],l.restart);return}d.placeBox(e,0,0);d.createRule(c.firstChild.firstChild,e.bbox.h,e.bbox.d,0);m=this}},HTMLtooltipClear:function(a){var b=this.HTMLtooltip;0>=a?(b.style.display="none",b.style.opacity=b.style.filter="",f=null):(b.style.opacity=a/100,b.style.filter="alpha(opacity\x3d"+a+")",f=setTimeout(MathJax.Callback(["HTMLtooltipClear",this,a-20]),50))}});MathJax.Hub.Browser.Select({MSIE:function(a){d.msieHitBoxBug=!0}});MathJax.Hub.Startup.signal.Post("HTML-CSS maction Ready");MathJax.Ajax.loadComplete(d.autoloadDir+"/maction.js")});