instiki/public/MathJax/extensions/MathZoom.js
Jacques Distler 1663d9f5c8 MathJax
For those without MathML-capable browsers,
we present MathJax. It's crappy 'n slow,
but it's better than nothing.
2010-10-17 22:30:56 -05:00

19 lines
7.6 KiB
JavaScript

/*
* ../SourceForge/trunk/mathjax/extensions/MathZoom.js
*
* Copyright (c) 2010 Design Science, Inc.
*
* 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.Unpack([
['(','function(','a,c,e,b,h){var i="1.0";var g=a.Insert({delay:400,styles:{"#','MathJax_Zoom','":{position:"absolute','","','background-color','":"#F0F0F0",overflow:"auto",display:"block","z-index":301,padding:".5em",border:"1px solid black",','margin:0,"','font-family":"serif","font-size":"85%","font-weight','":"normal","','font-style',10,'text-align":"left","text-indent":0,"text-transform":"none","line-height',10,'letter-spacing',10,'word-spacing',10,'word-wrap',10,'white-space":"nowrap","float":"none","','box-shadow":"5px 5px 15px #AAAAAA','","-webkit-',22,'","-moz-',22,'","-khtml-',22,'",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color=\'gray\', Positive=\'true\')"},"#','MathJax_ZoomOverlay',4,'",left:0,top:0',',"z-index":300,','display:"inline-block','",','width:"100%",height:"100%",','border:0,padding:0,',8,6,'":"','white",opacity:0',',filter:"alpha(opacity=0)"}}},(a.config.MathZoom||{}));var d=',1,'j){if(!j){j','=window.event}if(','j){if(','j.preventDefault','){',47,'()}if(','j.stopPropagation','){',51,'()}j.cancelBubble=true;j.returnValue=','false}','return false','};var f=MathJax.Extension.MathZoom={version:i,settings:a.config.menuSettings,HandleEvent:',1,'l,j,k){if(!l){l',45,'f.settings.CTRL&&!l.ctrlKey','){return true}if(f.settings.','ALT&&!l.altKey',62,'CMD&&!l.metaKey',62,'Shift&&!','l.shiftKey){','return true','}return f[j](l,k)},Click:',1,'k,j){','if(this.settings.','zoom==="','Click"){return this.Zoom(j,k)}},','DblClick',':',1,72,73,74,'Double-',75,'Mouseover:',1,72,73,74,'Hover"){','f.oldMouseOver','=j','.onmouseover',';j',92,'=null;j','.onmousemove=this.','Mousemove;j.','onmouseout=','this.Mouseout;','return f.Timer(','k,j)}},Mouseout:',1,'j){this',92,'=',90,';delete ',90,';this',96,98,'null;f.','ClearTimer();','return d(','j)},Mousemove:',1,'j){',100,'j||window.event,this)},Timer:',1,72,'this.',113,'this.timer','=','setTimeout(','MathJax.Callback','(["Zoom",this,j,{}]),g.delay);',114,'k)},ClearTimer:function(){if(',124,'){clearTimeout(',124,');delete ',124,'}},Zoom:',1,'s,l){this.',113,'this.Remove','();var v=s','.parentNode',';if(v','.className==="MathJax_MathContainer"){v=v.parentNode','}if(v',142,144,142,'}var q=(String(v.className).match(/^MathJax_(MathML|Display)$/)?v:s).','nextSibling',';var m=a.getJaxFor(q),r=m.root;var o=(b','&&m.outputJax.isa(','b','.constructor)?"','HTMLCSS":(h',152,'h',154,'MathML":null));if(!o){return}var j','=Math.floor(0.85*document.body.','clientWidth','),p',160,'clientHeight);var k=c.Element("span','",{style:{position:"','relative",',34,'",height:0,width:0},id:"','MathJax_ZoomFrame','"},[["','span",{id:"',30,'",onmousedown:',140,'}],["',171,3,'",onclick:',140,',style:{visibility:"hidden",fontSize:','this.settings.','zscale,"max-width":j+"px","max-height":p+"px"}},[["span"]]]]);var x=k.lastChild,u=x.firstChild,n=k.firstChild;s',142,'.insertBefore(k,s',');if(this','.msieZIndexBug','){var t=','c.Element("img",{','src:"about:blank','",id:"','MathJax_ZoomTracker','",','style:{width:0,height:0',',position:"relative"}});','document.body','.appendChild(','k);k','.style.position="absolute";','k.style.zIndex=g.styles["#',30,'"]["z-index"];k=t}var w=(this["Zoom"+o])(r,u,s);if(this','.msiePositionBug','){if(this.msieIE8Bug){u',198,'x','.style.height','=u','.offsetHeight',';u.style.position="";if(x',208,'<=p&&x','.offsetWidth','<=j){x.style.overflow="visible"}}if(this','.msieWidthBug','){x','.style.width','=Math.min(j,','w.w)}else{if(w.w>j){x',216,'=j}}if(x',208,'>p){x.style.Height=p+"px"}if(s.',150,'){s',142,184,'.',150,')}else{v',196,'k)}}else{if(this','.operaPositionBug','){x',216,217,'u',212,')+"px"}}this.Position(x,w,(o==="MathML"&&v.nodeName.toLowerCase()==="div"));x.style.visibility="";',73,74,89,'n',92,'=',140,'}','if(window.','addEventListener','){',248,'("resize",','this','.Resize,false)}else{if(window.','attachEvent){attachEvent("onresize",this','.Resize)}else{','this.onresize=','window.onresize',';',257,'=this.Resize','}}',114,'l)},ZoomHTMLCSS:',1,'o,q,p){q.className="MathJax";b.idPostfix="-zoom";b.getScales(q,q);o.toHTML(q,q);var r=o.HTMLspanElement().bbox;b.idPostfix="";if(r.width&&r.width!=="100%"){var j',160,161,');q',216,'=j+"px";q.style.display="inline-block";var k=(o.id||"MathJax-Span-"+o.spanID)+"-zoom";var l=','document.getElementById','(k).firstChild;while(l&&l',216,'!==r.width){l=l.',150,'}if(l){l',216,'="100%"}}q',196,'this.topImg);var ','n=this.topImg.offsetTop;','q','.removeChild(',280,'m=(this',214,'?b.getW(p)*b.em:p',212,');return{w:r.w*b.em,Y:-n,W:m}},ZoomMathML:',1,'k,l,m){k.toNativeMML(l,l);var n;l',196,'this.topImg);',281,'l',283,280,'j=(this.ffMMLwidthBug?m',142,':m).offsetWidth;return{w:l',212,',Y:-n,W:j}},Position:',1,'p,n,r){var k',260,'(),m=k.x,l=k.y,j=n.W;if(this',202,'){j=-j}if(r&&this','.ffMMLcenterBug','){j=0}var q=-Math.floor((p',212,'-j)/2),o=n.Y;p.style.left=Math.max(q,20-m)+"px";p.style.top=Math.max(o,20-l)+"px"},Resize:',1,'l){if(f.onresize){f.onresize(l)}var j=0,o=0,n=',271,'("',169,'"),k=',271,'("',30,'");var m=(f',186,'?',271,'("',191,'"):n);if(f',232,'){n','.style.border="1px solid"}','if(m.offsetParent){do{j+=m.offsetLeft;o+=m.offsetTop}while(m=m.offsetParent)}if(f',232,'){n.style.','border=""}if(f',186,334,'left=j+"px";n.style.top=o+"px"}k.style.left=(-j)+"px";k.style.top=(-o)+"px";if(f',202,'){',126,'f.SetWH,0)}else{f.SetWH()}return{x:j,y:o}},SetWH:function(){var j=',271,'("',30,'");j',216,'=j',206,'="1px";j',216,'=',195,'.scrollWidth+"px";j',206,'=',195,'.scrollHeight+"px"},Remove:',1,'k){var l=',271,'("',169,'");if(l){l',142,283,'l);l=',271,'("',191,'");if(l){l',142,283,'l)}if(','f.operaRefreshBug','){var j=c.addElement(',195,',"div',165,'fixed',32,',',36,'backgroundColor:"',41,'},id:"MathJax_OperaDiv"});',195,283,'j)}',247,'removeEventListener','){',391,251,'f',253,'detachEvent){detachEvent("onresize",f',255,257,'=f.onresize;delete f.onresize}}}',114,'k)}};','a.Register.StartupHook("','HTML-CSS',' Jax Ready",function(){','b=','MathJax.OutputJax','["HTML-CSS','"];b','.Augment({HandleEvent:f.HandleEvent','})});',403,'NativeMML',405,'h=',407,'.',413,';h',410,',MSIEmouseup:',1,'l,k,j){if(this.','trapUp){delete this.trapUp;',69,'}if(','this.MSIEzoomKeys(l)){return ','true}',56,'},MSIEclick:',1,423,'trapClick){delete this.trapClick;',69,'}if(!',427,55,'if(!',181,'zoom.match(/Click/)){',56,'}','return(f.','Click','(l,k)===false)},','MSIEdblclick:',1,'l,',72,'if(!',427,55,443,76,445,'MSIEmouseover',':function(l,k,j){if(this.settings.zoom!=="Hover"){return false}f.','Timer(l,k);',69,'},MSIEmouseout',457,113,69,'},MSIEmousemove',457,'Timer(l,k);',69,'},MSIEzoomKeys:',1,'j){',73,'CTRL&&!j.ctrlKey){',56,'}',73,'CMD&&!j.metaKey){',56,'}',73,'ALT&&!j.altKey){',56,'}',73,67,'j.shiftKey){',56,'}',69,'}})});a.Browser.Select({MSIE:',1,'j){var k=(document.compatMode==="BackCompat");var l=j.versionAtLeast("8.0")&&document.documentMode>7;f',202,'=true;f',214,'=!k;f.msieIE8Bug=l;f',186,'=!l;','f.msieInlineBlockAlignBug','=(!l||k)},Opera:',1,'j){f',232,'=true;',375,'=true},Firefox:',1,'j){f.ffMMLwidthBug=true;f',309,'=true}});f.topImg=(',498,'?',188,193,'},',189,'"}):c.Element("span",{',193,',',34,'"}}));if(f',232,'){f.topImg',331,127,'.Queue(["Styles",e,g.styles],["Post",a.Startup.signal,"MathZoom Ready"],["loadComplete",e,"[MathJax]/extensions/MathZoom.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,',407,408,'"],',407,'.NativeMML);']
]);