For those without MathML-capable browsers, we present MathJax. It's crappy 'n slow, but it's better than nothing.
19 lines
14 KiB
JavaScript
19 lines
14 KiB
JavaScript
/*
|
|
* ../SourceForge/trunk/mathjax/extensions/MathMenu.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(','b,c,f','){var ','k="1.0.1";var i=','b.Browser.','isPC,g=',5,'isMSIE;var e=(i?null:"5px");var j=b.Insert({delay:150,helpURL',':"http://www.mathjax.org','/help/user/",','showRenderer',':true,','showFontMenu',':false,','showContext',14,'windowSettings',':{status:"no",toolbar:"no",locationbar:"no",menubar:"no",directories:"no",personalbar:"no",resizable:"yes",scrollbars:"yes",width:100,height:50},styles:{".','MathJax_Menu','":{','position:"absolute','","','background-color','":"white",color:"black",width:"auto",','padding:(i?"2px','":"5px 0px"),border:"','1px solid #CCCCCC','",margin:0,','cursor:"default','",font:"menu","','text-align":"','left","text-indent":0,"text-transform','":"none","','line-height','":"normal","','letter-','spacing":"normal","word-',37,'wrap',35,'white-space":"nowrap","float',33,'z-index":','201,"','border-radius":e',',"-webkit-',45,',"-moz-',45,',"-khtml-',45,',"box-shadow":"0px 10px 20px #808080","-webkit-box-shadow":"0px 10px 20px #808080","-moz-box-shadow":"0px 10px 20px #808080","-khtml-box-shadow":"0px 10px 20px #808080",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color=\'gray\', Positive=\'true','\')"},".','MathJax_MenuItem','":{',25,' 2em":"1px 2em"),background:"transparent','"},".','MathJax_MenuTitle','":{"',23,'":"#CCCCCC",margin:(i?"-1px -1px 1px -1px":"-5px 0 0 0"),"',31,'center","','font-style":"italic','","font-size":"','80%",color:"#444444",padding:"2px 0",overflow:"hidden',58,'MathJax_MenuArrow','":{',21,'",right:".5em",color:"#666666','","font-family":(g?"\'Arial unicode MS\'":null)},".','MathJax_MenuActive',' .',69,'":{color:"','white',58,'MathJax_MenuCheck','":{',21,'",left:".7em',73,'MathJax_MenuRadioCheck','":{',21,'",left:(i?"1em":".7em")},".','MathJax_MenuLabel','":{',25,' 2em 4px 1.33em":"1px 2em 3px 1.33em"),"',65,58,'MathJax_MenuRule',60,'border-top":(i?"',27,'":"1px solid #DDDDDD"),margin:(i?"4px 1px 0px":"4px 3px")},".','MathJax_MenuDisabled',77,'GrayText',58,74,60,23,'":(i?"Highlight":"#606872"),color:(i?"HighlightText":"white")}}},(b.config.MathMenu||{}));var d=',1,'l){if(!l){l=window.event}if(','l){if(','l.preventDefault','){',111,'()}if(','l.stopPropagation','){',115,'()}l.cancelBubble=true;l.returnValue=false}','return ','false};var a=','MathJax.','Menu','=MathJax.Object.Subclass({','version:k,items:[],posted',14,'title:null,margin:5,Init:',1,'l){this.items=[].','slice.call(arguments,','0)},With:',1,'l){if(l){b.Insert(this,l)}return this},','Post:',1,'n,v','){if(!n){n=window.event}','var t=(!this.title?null:[["div",{','className:"',59,'"},[this.','title]]]);var l','=document.getElementById("MathJax_MenuFrame','");if(!l){l','=a.Background(','this)}var o=c','.addElement(','l',',"div",{','onmouseup:a.Mouseup,','ondblclick',':this.False,ondragstart:this.False,onselectstart:this.False,','oncontextmenu',':this.False,','menuItem',':this,',138,19,'"},t);for(var q=0,p=this.items.length;q<p;q++){this.items[q].Create(o)}this.posted=true;o','.style.width','=(o.','offsetWidth','+2)+"px";var u=n.pageX,s=n.pageY;if(!u&&!s){u=n.clientX+','document.body.','scrollLeft+','document.documentElement','.scrollLeft;s=n.clientY+',163,'scrollTop','+',165,'.',168,'}if(!v){if(u+o.',161,'>',163,161,'-this.margin','){u=',163,161,'-o.',161,178,'}a.skipUp=true}else{var r="left",w=v.',161,';u=v.',161,'-2;s=0;while(v&&v!==l){u+=v.offsetLeft;s+=v.offsetTop;v=v.parentNode}if(u+o.',161,'>',163,161,178,'){r="right";u=Math.max(this.margin,u-w-o.',161,'+6)}if(!i){o.style["borderRadiusTop','"+r]=0;o.style["','WebkitBorderRadiusTop',198,'MozBorderRadiusTop',198,'KhtmlBorderRadiusTop"+r]=0}}o.style.left=u+"px";o.style.top=s+"px";if(','document.selection','&&',204,'.empty){',204,'.empty()}','return this.False(','n)},Remove:',1,'l,m){','var n',142,'");if(n){n.','parentNode.removeChild(','n',');if(this.','msieBackgroundBug','){detachEvent("onresize",a.Resize)}}},Mouseup:',1,213,'if(a.skipUp){','delete ','a.skipUp}else{','this.Remove(l,m',')}},False:d},{config:j,div:null,Remove:',1,'l){a.Event(l,this,"','Remove")},Mouseover:',1,230,'Mouseover")},Mouseout:',1,230,'Mouseout")},Mousedown:',1,230,'Mousedown")},Mouseup:',1,230,'Mouseup")},Mousemove:',1,230,'Mousemove")},Event:',1,'n,o,l',136,'var m=o.',154,';if(m&&m[l]){',119,'m[l](n,o)}',119,'null},BGSTYLE:{',21,'",left:0,top:0,"',43,'200,width:"100%",height:"100%",border:0,padding:0,margin:0},Background:',1,'m',3,'n=c',146,'document.','body,"','div",{style:this.BGSTYLE,','id:"MathJax_MenuFrame"},[["',268,154,':m,','onmousedown',':this.Remove}]]);var l=n.','firstChild',';if(m.',220,'){l.style.backgroundColor="white";l.style.filter="alpha(opacity=0)";n.width=n.height=0;this.Resize();attachEvent("onresize",this.Resize)}else{l','.style.position="','fixed"}',119,'n},Resize:','function(){','setTimeout(','a.SetWH,0)},SetWH:','function(){var ','l',142,'");if(l){l=l.',275,';l',159,'=l.style.height="1px";l',159,'=',163,'scrollWidth+"px";l.style.height=',163,'scrollHeight','+"px"}},saveCookie:',283,'c.Cookie.Set("menu",this.cookie)},getCookie:',283,'this.cookie=c.Cookie.Get("menu")}});var h=a.ITEM',123,'name:"",Create:',1,'m){if(!','this.hidden',3,'l={onmouseover:a.Mouseover,onmouseout:a.Mouseout,',149,273,151,'onselectend',153,138,54,'",',154,':this};if(this.disabled){','l.className+=" ',100,'"}c',146,'m,"div",l,this.Label(l,m))}},Mouseover:',1,'q,s','){if(!this.disabled){','this.Activate(s)}','if(!this.menu||!this.menu.posted){','var r',142,'").childNodes,','n=s','.parentNode.childNodes;for(var ','o=0,l=n.length;o<l;o++){var p=n[o].',154,';if(p&&p.menu&&p','.menu.posted){','p.Deactivate(n[o])}}l=r','.length-1;while(l>=0','&&s','.parentNode.',154,'!==r[l].',154,'){r[l].',154,'.posted=false;','r[l].',217,'r[l]);l--}if(this.Timer){this.Timer(q,s)}}},Mouseout:',1,213,331,'this.Deactivate(','m)}','if(this.timer){clearTimeout(this.timer',');delete this.timer','}},Mouseup:',1,213,119,227,')},Remove:',1,213,'m=m',344,154,';',119,'m.Remove(l,m)},Activate:',1,'l){',357,'l);',322,74,'"},Deactivate:',1,'l){l.className=l.className.replace(/ ',74,'/,"")},With:',1,132,'False:d});a.ITEM.COMMAND','=a.ITEM.Subclass({','action:function(){},Init:',1,'l,n',',m){this.name=l;this.','action=n;this.With(m)},Label:',1,213,'return[this.name',']},Mouseup:',1,'l,m',329,227,');this.action.call(this,l)}',210,'l',')}});a.ITEM.','SUBMENU',389,'menu:null,marker:(i&&!',5,'isSafari?"\\u25B6":"\\u25B8"),Init:',1,'l,n){this.name=l;var m=1;if(!(n instanceof a.ITEM)){this.With(n),m++}this.menu=a.apply(a,[].',129,'m))},Label:',1,213,'l.onmousemove=a.Mousemove;this.menu',350,397,'+" ",["span",{',138,69,140,'marker]]]},Timer:',1,213,359,')}l={clientX:l.clientX,clientY:l.clientY};this.timer=',284,121,'Callback(["Mouseup",this,l,m]),j.delay)},Mouseup:',1,'n,p',329,'if(!this',340,359,360,'}this.menu.Post(n,p)}else{var o',142,334,'l=o',342,3,'q=o[l];q.',154,350,'q.',217,'q);if(q.',154,'===this.menu){break}l--}}}',210,'n',406,'RADIO',389,'variable:null,marker',':(i?"\\u25CF":"\\u2713"),Init:',1,'m,l,n){this.name=m;this.variable=l;this.With(n',219,'value==null){this.value=this.name}},Label:',1,'m,n){var l={className:"',85,'"};if(','j.settings[this.variable',']!==this.value){l={','style:{display:"','none"}}}return[["span",l,[this.marker]]," "+this.name]},Mouseup:',1,'p,q',329,'var r=q',336,'n=0,l=r.length;n<l;n++){var o=r[n].',154,';if(o&&o.variable===this.variable){r[n].',275,'.style.display="none"}}q.',275,'.display="";',469,']=this.value;a.cookie','[this.variable]=',469,'];a.saveCookie();if(this.action){this.action.call(a)}}this.Remove(','p,q);',210,'p',406,'CHECKBOX',389,459,':"\\u2713",Init:',1,462,')},Label:',1,466,80,'"};if(!',469,']){l={',471,'none"}}}return[["span",l,[this.marker]]," "+this.name]},Mouseup:',1,'l,m',329,'m.',275,'.display=(',469,']?"none":"");',469,']=!',469,'];a.cookie',487,469,489,'l,m);',210,'l',406,'LABEL',389,'Init:',1,'l',393,'With(m)},Label:',1,'l,m){delete l.onmouseover,delete l.onmouseout;delete l.onmousedown;l.className+=" ',89,'";',397,']}});a.ITEM.RULE',389,'Label:',1,536,95,'";',119,'null}});a.About=',286,'o=','MathJax.OutputJax','["HTML-CSS','"]||{fontInUse:""};var q=(o.webFonts?"":"local "),m=(o.webFonts?" web":"");var n=(o.imgFonts?"Image":q+o.fontInUse+m);var l=[];','a.About.GetJax','(l,',121,'InputJax,"Input");',554,'(l,',551,',"Output");',554,'(l,',121,'ElementJax',',"Element");','a.About.div',144,'a.About);var r=',121,'HTML',146,567,148,'style:{position:"fixed",left:"50%",width:"auto","',31,'center",border:"3px outset",padding:"1em 2em","',23,'":"#DDDDDD",',29,'","font-family":"message-box',66,'120%","font-style',35,'text-indent":0,"text-transform',33,'line-height',35,'letter-',37,37,'wrap',35,'white-space":"nowrap","float',33,43,'201',52,'\')"},onclick:a.About.Remove},[["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+',121,'version,["br','"],"using "+n+" fonts",["br"],["br"],["span",{',471,'inline-block","',31,'left',66,'80%","',23,'":"#E4E4E4",padding:".4em .6em",border:"1px inset"}},l],["br"],["br"],["a",{href',9,'/"},["wwww.mathjax.org"]]]);var s=(',165,'||{});var p=window.innerHeight||s.clientHeight||s.',299,'||0;if(a.prototype.msieAboutBug){r',159,'="20em";r',279,'absolute";r.style.left=Math.floor((',165,'.scrollWidth-r.',161,')/','2)+"px";r.style.top','=(','Math.floor((p-r.offsetHeight)/3',')+',163,168,')+"px"}else{r.style.marginLeft=Math.floor(-r.',161,'/',625,'=',627,')+"px"}};a.About.Remove=',1,110,567,'){',163,'removeChild(',567,');',225,567,'}};',554,'=',1,'l,n,m){','for(var o in ','n){if(n[o].isa&&n[o].isa(n)){l.push(n[o].name+" "+m+" Jax v"+n[o].',601,'"])}}',119,'l};a.Help=',283,'window.open(j.helpURL,"MathJaxHelp")};a.ShowSource=',1,'n',136,'if(!a.jax){return}if(','j.settings.','format==="MathML"){var l=',121,565,'.mml;if(l&&typeof(l.mbase.prototype.toMathML)!=="undefined"){','a.ShowSource.','Text(a.jax.root.toMathML(),n)}else{if(!','f.loadingToMathML','){',672,'=true;var m={screenX:n.screenX,screenY:n.screenY};',670,'Window(n);','MathJax.Callback.Queue','(','f.Require("[MathJax]/extensions/','toMathML.js"),',283,225,672,'},[this,arguments.callee,m]);return}}}else{if','(a.jax.originalText','==null){alert("No TeX form available");return}',670,'Text',686,',n)}};',670,'Window=',1,308,670,'w',3,'n=[],l=j.',17,';',653,110,'l.hasOwnProperty(o)){n.push(o+"="+l[o])}}',670,'w=window.open("","_blank",n.join(","))}',119,670,'w};',670,'Text=',1,'r,q',3,'n=',670,'Window(q);r=r.replace(/^\\s*/,"").replace(/\\s*$/,"");r=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.',266,'open();','n.document.write','("<html><head><title>MathJax Equation Source</title></head><body style=\'font-size:85%\'>");',720,'("<table><tr><td><pre>"+r+"</pre></td></tr></table>");',720,'("</body></html>");n.',266,'close();var p=n.',163,275,';var o=(n.outerHeight-n.innerHeight)||30,m=(n.outerWidth-n.innerWidth)||30;m','=Math.min(Math.floor(0.5*screen.','width),p.',161,'+m+25);o',731,'height),p.offsetHeight+o+25);n.resizeTo(m,o);if(q&&q.screenX!=null',3,'l','=Math.max(0,Math.min(q.','screenX-Math.floor(m/2),screen.width-m-20)),s',739,'screenY-Math.floor(o/2),screen.height-o-20));n.moveTo(l,s)}',225,670,'w};a.Scale=',286,'m=',551,552,'"],l=',551,'.NativeMML;var o=(m?m','.config.scale',':l',753,');var n=prompt("Scale all mathematics (compared to surrounding text) by",o+"%");if(n){if(n.match(/^\\s*\\d+\\s*%?\\s*$/)){n=parseInt(n);if(n){if(n!==o){if(m){m',753,'=n}if(l){l',753,'=n}a.cookie.scale=n;a.saveCookie();b.Reprocess()}}','else{alert("The scale should ','not be zero")}}',761,'be a perentage (e.g., 120%)")}}};a.Zoom=',283,'if(!',121,'Extension.MathZoom){',680,'MathZoom.js")}};a.Renderer=',286,'l=b.config.outputJax["jax/mml"];if(l[0]!==',665,'renderer','){',678,'(["Require','",f,"[MathJax]/','jax/output/"+',665,774,'+"/config.js"],[',286,'p=',551,'[',665,774,'];for(var o=0,n=l.length;o<n;o++){if(l[o]===p){l.splice(o,1);break}}l.unshift(p)}],["Reprocess",b])}};a.Font=',286,'l=',551,552,'"];if(!l){return}',266,'location.reload()};',5,'Select({MSIE:',1,'l',3,'m=(',266,'compatMode==="BackCompat");var n=l.versionAtLeast("8.0")&&',266,'documentMode>7;a.Augment({margin:20,',220,':(m||!n),msieAboutBug:m})}});j.settings=b.config.menuSettings;if(!',665,'format){',665,'format=(',121,'InputJax.TeX?"Original":"MathML")}if(typeof(',665,11,')!=="undefined"){j.',11,'=',665,11,'}if(typeof(',665,13,817,13,'=',665,13,'}if(typeof(',665,15,817,15,'=',665,15,'}a.getCookie();a.menu=a(h.COMMAND("Show Source",a.ShowSource),','h.SUBMENU("','Format",h.RADIO("MathML","format"),h.RADIO("Original","format",{value:"Original"})),h.RULE(),',839,'Settings",',839,'Zoom Trigger",h.RADIO("Hover','","zoom",{action:a.Zoom}),h.RADIO("','Click',845,'Double-Click',845,'No Zoom","zoom",{value:"None"}),h.','RULE(),h.','LABEL("Trigger Requires:"),h.CHECKBOX((',5,'isMac?"Option":"Alt"),"ALT"),h.CHECKBOX("Command","CMD",{hidden:!',5,'isMac}),h.CHECKBOX("','Control","CTRL",{hidden:',5,856,'Shift","Shift")),',839,'Zoom Factor",h.RADIO("125','%","zscale"),h.RADIO("','133',863,'150',863,'175',863,'200',863,'250',863,'300',863,'400%","zscale")),h.RULE(),',839,'Math Renderer','",{hidden:!j.',11,'},h.RADIO("','HTML-CSS','","renderer",{action:a.Renderer','}),h.RADIO("MathML',883,',value:"NativeMML"})),',839,'Font Preference',879,13,'},h.LABEL("For HTML-CSS:"),h.RADIO("Auto","','font",{action:a.Font}),h.',851,'RADIO("TeX (','local)","',892,894,'web)","',892,894,'image)","',892,851,'RADIO("STIX (local)","font",{action:a.Font})),',839,'Contextual Menu',879,15,881,'MathJax","context"),h.RADIO("Browser","context")),h.COMMAND("Scale All Math ...",a.Scale)),h.',851,'COMMAND("About MathJax",a.About),h.COMMAND("MathJax Help",a.Help));a.',11,'=',1,'l){a.cookie.',11,'=j.',11,'=l;a.saveCookie();a.menu.items[3].menu.','item[3','].hidden=!l};','a.',13,'=',1,916,13,'=j.',13,920,'items[4',922,'a.',15,'=',1,916,15,'=j.',15,920,'items[5',922,678,'(["Styles",f,j.styles],["Post",b.Startup.signal,"MathMenu Ready"],["loadComplete',778,'extensions/MathMenu.js"])})(',121,'Hub,',121,'HTML,',121,'Ajax);']
|
|
]);
|
|
|