12345678910111213 |
- /*
- * /MathJax/extensions/MathZoom.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
- */(function(l,m,p,w,x){var q=l.CombineConfig("MathZoom",{styles:{"#MathJax_Zoom":{position:"absolute","background-color":"#F0F0F0",overflow:"auto",display:"block","z-index":301,padding:".5em",border:"1px solid black",margin:0,"font-weight":"normal","font-style":"normal","text-align":"left","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","box-shadow":"5px 5px 15px #AAAAAA","-webkit-box-shadow":"5px 5px 15px #AAAAAA","-moz-box-shadow":"5px 5px 15px #AAAAAA","-khtml-box-shadow":"5px 5px 15px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX\x3d2, OffY\x3d2, Color\x3d'gray', Positive\x3d'true')"},"#MathJax_ZoomOverlay":{position:"absolute",left:0,top:0,"z-index":300,display:"inline-block",width:"100%",height:"100%",border:0,padding:0,margin:0,"background-color":"white",opacity:0,filter:"alpha(opacity\x3d0)"},"#MathJax_ZoomFrame":{position:"relative",display:"inline-block",height:0,width:0},"#MathJax_ZoomEventTrap":{position:"absolute",left:0,top:0,"z-index":302,display:"inline-block",border:0,padding:0,margin:0,"background-color":"white",opacity:0,filter:"alpha(opacity\x3d0)"}}}),r,t,v;MathJax.Hub.Register.StartupHook("MathEvents Ready",function(){v=MathJax.Extension.MathEvents.Event;r=MathJax.Extension.MathEvents.Event.False;t=MathJax.Extension.MathEvents.Hover});var c=MathJax.Extension.MathZoom={version:"2.2",settings:l.config.menuSettings,scrollSize:18,HandleEvent:function(b,a,d){return c.settings.CTRL&&!b.ctrlKey||c.settings.ALT&&!b.altKey||c.settings.CMD&&!b.metaKey||c.settings.Shift&&!b.shiftKey||!c[a]?!0:c[a](b,d)},Click:function(b,a){if("Click"===this.settings.zoom)return this.Zoom(b,a)},DblClick:function(b,a){if("Double-Click"===this.settings.zoom)return this.Zoom(b,a)},Hover:function(b,a){return"Hover"===this.settings.zoom?(this.Zoom(b,a),!0):!1},Zoom:function(b,a){this.Remove();t.ClearHoverTimer();v.ClearSelection();var d=MathJax.OutputJax[a.jaxID],c=d.getJaxFromMath(a);c.hover&&t.UnHover(c);var g=Math.floor(.85*document.body.clientWidth),h=Math.floor(.85*Math.max(document.body.clientHeight,document.documentElement.clientHeight)),k=m.Element("span",{id:"MathJax_ZoomFrame"},[["span",{id:"MathJax_ZoomOverlay",onmousedown:this.Remove}],["span",{id:"MathJax_Zoom",onclick:this.Remove,style:{visibility:"hidden",fontSize:this.settings.zscale,"max-width":g+"px","max-height":h+"px"}},[["span",{style:{display:"inline-block","white-space":"nowrap"}}]]]]),e=k.lastChild,u=e.firstChild,p=k.firstChild;a.parentNode.insertBefore(k,a);a.parentNode.insertBefore(a,k);u.addEventListener&&u.addEventListener("mousedown",this.Remove,!0);if(this.msieTrapEventBug){var n=m.Element("span",{id:"MathJax_ZoomEventTrap",onmousedown:this.Remove});k.insertBefore(n,e)}this.msieZIndexBug&&(m.addElement(document.body,"img",{src:"about:blank",id:"MathJax_ZoomTracker",width:0,height:0,style:{width:0,height:0,position:"relative"}}),k.style.position="relative",k.style.zIndex=q.styles["#MathJax_ZoomOverlay"]["z-index"]);d=d.Zoom(c,u,a,g,h);this.msiePositionBug&&(this.msieSizeBug&&(e.style.height=d.zH+"px",e.style.width=d.zW+"px"),e.offsetHeight>h&&(e.style.height=h+"px",e.style.width=d.zW+this.scrollSize+"px"),e.offsetWidth>g&&(e.style.width=g+"px",e.style.height=d.zH+this.scrollSize+"px"));this.operaPositionBug&&(e.style.width=Math.min(g,d.zW)+"px");e.offsetWidth&&e.offsetWidth<g&&e.offsetHeight<h&&(e.style.overflow="visible");this.Position(e,d);this.msieTrapEventBug&&(n.style.height=e.clientHeight+"px",n.style.width=e.clientWidth+"px",n.style.left=parseFloat(e.style.left)+e.clientLeft+"px",n.style.top=parseFloat(e.style.top)+e.clientTop+"px");e.style.visibility="";"Hover"===this.settings.zoom&&(p.onmouseover=this.Remove);window.addEventListener?addEventListener("resize",this.Resize,!1):window.attachEvent?attachEvent("onresize",this.Resize):(this.onresize=window.onresize,window.onresize=this.Resize);l.signal.Post(["math zoomed",c]);return r(b)},Position:function(b,a){var d=this.Resize(),f=d.y,g=a.mW,h=a.Y;b.style.left=Math.max(-g-Math.floor((b.offsetWidth-g)/2),10-d.x)+"px";b.style.top=Math.max(h,10-f)+"px";c.msiePositionBug||c.SetWH()},Resize:function(b){if(c.onresize)c.onresize(b);var a=document.getElementById("MathJax_ZoomFrame");b=document.getElementById("MathJax_ZoomOverlay");for(var d=c.getXY(a),a=a.parentNode,f=c.getOverflow(a);a.parentNode&&a!==document.body&&"visible"===f;)a=a.parentNode,f=c.getOverflow(a);"visible"!==f&&(b.scroll_parent=a,f=c.getXY(a),d.x-=f.x,d.y-=f.y,f=c.getBorder(a),d.x-=f.x,d.y-=f.y);b.style.left=-d.x+"px";b.style.top=-d.y+"px";c.msiePositionBug?setTimeout(c.SetWH,0):c.SetWH();return d},SetWH:function(){var b=document.getElementById("MathJax_ZoomOverlay");b.style.width=b.style.height="1px";var a=b.scroll_parent||document.documentElement||document.body;b.style.width=a.scrollWidth+"px";b.style.height=Math.max(a.clientHeight,a.scrollHeight)+"px"},getOverflow:window.getComputedStyle?function(b){return getComputedStyle(b).overflow}:function(b){return(b.currentStyle||{overflow:"visible"}).overflow},getBorder:function(b){var a={thin:1,medium:2,thick:3},c=window.getComputedStyle?getComputedStyle(b):b.currentStyle||{borderLeftWidth:0,borderTopWidth:0};b=c.borderLeftWidth;c=c.borderTopWidth;b=a[b]?a[b]:parseInt(b);c=a[c]?a[c]:parseInt(c);return{x:b,y:c}},getXY:function(b){var a=0,d=0,f;for(f=b;f.offsetParent;)a+=f.offsetLeft,f=f.offsetParent;c.operaPositionBug&&(b.style.border="1px solid");for(f=b;f.offsetParent;)d+=f.offsetTop,f=f.offsetParent;c.operaPositionBug&&(b.style.border="");return{x:a,y:d}},Remove:function(b){var a=document.getElementById("MathJax_ZoomFrame");if(a){var d=MathJax.OutputJax[a.previousSibling.jaxID].getJaxFromMath(a.previousSibling);l.signal.Post(["math unzoomed",d]);a.parentNode.removeChild(a);(a=document.getElementById("MathJax_ZoomTracker"))&&a.parentNode.removeChild(a);c.operaRefreshBug&&(a=m.addElement(document.body,"div",{style:{position:"fixed",left:0,top:0,width:"100%",height:"100%",backgroundColor:"white",opacity:0},id:"MathJax_OperaDiv"}),document.body.removeChild(a));window.removeEventListener?removeEventListener("resize",c.Resize,!1):window.detachEvent?detachEvent("onresize",c.Resize):(window.onresize=c.onresize,delete c.onresize)}return r(b)}};l.Browser.Select({MSIE:function(b){var a=document.documentMode||0,d=9<=a;c.msiePositionBug=!d;c.msieSizeBug=b.versionAtLeast("7.0")&&(!document.documentMode||7===a||8===a);c.msieZIndexBug=7>=a;c.msieInlineBlockAlignBug=7>=a;c.msieTrapEventBug=!window.addEventListener;"BackCompat"===document.compatMode&&(c.scrollSize=52);d&&delete q.styles["#MathJax_Zoom"].filter},Opera:function(b){c.operaPositionBug=!0;c.operaRefreshBug=!0}});c.topImg=c.msieInlineBlockAlignBug?m.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}):m.Element("span",{style:{width:0,height:0,display:"inline-block"}});if(c.operaPositionBug||c.msieTopBug)c.topImg.style.border="1px solid";MathJax.Callback.Queue(["StartupHook",MathJax.Hub.Register,"Begin Styles",{}],["Styles",p,q.styles],["Post",l.Startup.signal,"MathZoom Ready"],["loadComplete",p,"[MathJax]/extensions/MathZoom.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.OutputJax["HTML-CSS"],MathJax.OutputJax.NativeMML);
|