123456789101112131415161718192021222324252627 |
- /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
- /* vim: set ts=2 et sw=2 tw=80: */
- /*************************************************************
- *
- * MathJax/extensions/MathMenu.js
- *
- * Implements a right-mouse (or CTRL-click) menu over mathematics
- * elements that gives the user the ability to copy the source,
- * change the math size, and zoom settings.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright (c) 2010-2013 The MathJax Consortium
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */(function(g,q,p,w,t){var u=MathJax.Callback.Signal("menu");MathJax.Extension.MathMenu={version:"2.2",signal:u};var k=function(a){return MathJax.Localization._.apply(MathJax.Localization,[["MathMenu",a]].concat([].slice.call(arguments,1)))},n=g.Browser.isPC,y=g.Browser.isMSIE,v=8<(document.documentMode||0),x=n?null:"5px",e=g.CombineConfig("MathMenu",{delay:150,closeImg:p.fileURL(t.imageDir+"/CloseX-31.png"),showRenderer:!0,showMathPlayer:!0,showFontMenu:!1,showContext:!1,showDiscoverable:!1,showLocale:!0,showLocaleURL:!1,windowSettings:{status:"no",toolbar:"no",locationbar:"no",menubar:"no",directories:"no",personalbar:"no",resizable:"yes",scrollbars:"yes",width:400,height:300,left:Math.round((screen.width-400)/2),top:Math.round((screen.height-300)/3)},styles:{"#MathJax_About":{position:"fixed",left:"50%",width:"auto","text-align":"center",border:"3px outset",padding:"1em 2em","background-color":"#DDDDDD",color:"black",cursor:"default","font-family":"message-box","font-size":"120%","font-style":"normal","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"border-radius":"15px","-webkit-border-radius":"15px","-moz-border-radius":"15px","-khtml-border-radius":"15px","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\x3d2, OffY\x3d2, Color\x3d'gray', Positive\x3d'true')"},".MathJax_Menu":{position:"absolute","background-color":"white",color:"black",width:"auto",padding:n?"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-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"border-radius":x,"-webkit-border-radius":x,"-moz-border-radius":x,"-khtml-border-radius":x,"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\x3d2, OffY\x3d2, Color\x3d'gray', Positive\x3d'true')"},".MathJax_MenuItem":{padding:n?"2px 2em":"1px 2em",background:"transparent"},".MathJax_MenuArrow":{position:"absolute",right:".5em",color:"#666666","font-family":y?"'Arial unicode MS'":null},".MathJax_MenuActive .MathJax_MenuArrow":{color:"white"},".MathJax_MenuCheck":{position:"absolute",left:".7em","font-family":y?"'Arial unicode MS'":null},".MathJax_MenuRadioCheck":{position:"absolute",left:n?"1em":".7em"},".MathJax_MenuLabel":{padding:n?"2px 2em 4px 1.33em":"1px 2em 3px 1.33em","font-style":"italic"},".MathJax_MenuRule":{"border-top":n?"1px solid #CCCCCC":"1px solid #DDDDDD",margin:n?"4px 1px 0px":"4px 3px"},".MathJax_MenuDisabled":{color:"GrayText"},".MathJax_MenuActive":{"background-color":n?"Highlight":"#606872",color:n?"HighlightText":"white"},".MathJax_Menu_Close":{position:"absolute",width:"31px",height:"31px",top:"-15px",left:"-15px"}}}),l,z;g.Register.StartupHook("MathEvents Ready",function(){l=MathJax.Extension.MathEvents.Event.False;z=MathJax.Extension.MathEvents.Hover});var b=MathJax.Menu=MathJax.Object.Subclass({version:"2.2",items:[],posted:!1,title:null,margin:5,Init:function(a){this.items=[].slice.call(arguments,0)},With:function(a){a&&g.Insert(this,a);return this},Post:function(a,f){a||(a=window.event);var d=document.getElementById("MathJax_MenuFrame");d||(d=b.Background(this),delete c.lastItem,delete c.lastMenu,delete b.skipUp,u.Post(["post",b.jax]));var m=q.addElement(d,"div",{onmouseup:b.Mouseup,ondblclick:l,ondragstart:l,onselectstart:l,oncontextmenu:l,menuItem:this,className:"MathJax_Menu"});MathJax.Localization.setCSS(m);for(var h=0,r=this.items.length;h<r;h++)this.items[h].Create(m);b.isMobile&&q.addElement(m,"span",{className:"MathJax_Menu_Close",menu:f,ontouchstart:b.Close,ontouchend:l,onmousedown:b.Close,onmouseup:l},[["img",{src:e.closeImg,style:{width:"100%",height:"100%"}}]]);this.posted=!0;m.style.width=m.offsetWidth+2+"px";h=a.pageX;r=a.pageY;h||r||(h=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,r=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);if(f){for(var g="left",k=f.offsetWidth,h=b.isMobile?30:k-2,r=0;f&&f!==d;)h+=f.offsetLeft,r+=f.offsetTop,f=f.parentNode;h+m.offsetWidth>document.body.offsetWidth-this.margin&&!b.isMobile&&(g="right",h=Math.max(this.margin,h-k-m.offsetWidth+6));n||(m.style["borderRadiusTop"+g]=0,m.style["WebkitBorderRadiusTop"+g]=0,m.style["MozBorderRadiusTop"+g]=0,m.style["KhtmlBorderRadiusTop"+g]=0)}else h+m.offsetWidth>document.body.offsetWidth-this.margin&&(h=document.body.offsetWidth-m.offsetWidth-this.margin),b.isMobile&&(h=Math.max(5,h-Math.floor(m.offsetWidth/2)),r-=20),b.skipUp=a.isContextMenu;m.style.left=h+"px";m.style.top=r+"px";document.selection&&document.selection.empty&&document.selection.empty();return l(a)},Remove:function(a,f){u.Post(["unpost",b.jax]);var d=document.getElementById("MathJax_MenuFrame");d&&(d.parentNode.removeChild(d),this.msieFixedPositionBug&&detachEvent("onresize",b.Resize));b.jax.hover&&(delete b.jax.hover.nofade,z.UnHover(b.jax));return l(a)},Find:function(a){return this.FindN(1,a,[].slice.call(arguments,1))},FindId:function(a){return this.FindN(0,a,[].slice.call(arguments,1))},FindN:function(a,b,d){for(var c=0,h=this.items.length;c<h;c++)if(this.items[c].name[a]===b){if(d.length){if(!this.items[c].menu)break;return this.items[c].menu.FindN(a,d[0],d.slice(1))}return this.items[c]}return null},IndexOf:function(a){return this.IndexOfN(1,a)},IndexOfId:function(a){return this.IndexOfN(0,a)},IndexOfN:function(a,b){for(var d=0,c=this.items.length;d<c;d++)if(this.items[d].name[a]===b)return d;return null}},{config:e,div:null,Close:function(a){return b.Event(a,this.menu||this.parentNode,this.menu?"Touchend":"Remove")},Remove:function(a){return b.Event(a,this,"Remove")},Mouseover:function(a){return b.Event(a,this,"Mouseover")},Mouseout:function(a){return b.Event(a,this,"Mouseout")},Mousedown:function(a){return b.Event(a,this,"Mousedown")},Mouseup:function(a){return b.Event(a,this,"Mouseup")},Touchstart:function(a){return b.Event(a,this,"Touchstart")},Touchend:function(a){return b.Event(a,this,"Touchend")},Event:function(a,f,d,c){if(b.skipMouseover&&"Mouseover"===d&&!c)return l(a);if(b.skipUp){if(d.match(/Mouseup|Touchend/))return delete b.skipUp,l(a);("Touchstart"===d||"Mousedown"===d&&!b.skipMousedown)&&delete b.skipUp}a||(a=window.event);return(c=f.menuItem)&&c[d]?c[d](a,f):null},BGSTYLE:{position:"absolute",left:0,top:0,"z-index":200,width:"100%",height:"100%",border:0,padding:0,margin:0},Background:function(a){a=q.addElement(document.body,"div",{style:this.BGSTYLE,id:"MathJax_MenuFrame"},[["div",{style:this.BGSTYLE,menuItem:a,onmousedown:this.Remove}]]);var f=a.firstChild;b.msieBackgroundBug&&(f.style.backgroundColor="white",f.style.filter="alpha(opacity\x3d0)");b.msieFixedPositionBug?(a.width=a.height=0,this.Resize(),attachEvent("onresize",this.Resize)):f.style.position="fixed";return a},Resize:function(){setTimeout(b.SetWH,0)},SetWH:function(){var a=document.getElementById("MathJax_MenuFrame");a&&(a=a.firstChild,a.style.width=a.style.height="1px",a.style.width=document.body.scrollWidth+"px",a.style.height=document.body.scrollHeight+"px")},saveCookie:function(){q.Cookie.Set("menu",this.cookie)},getCookie:function(){this.cookie=q.Cookie.Get("menu")},getImages:function(){b.isMobile&&((new Image).src=e.closeImg)}}),c=b.ITEM=MathJax.Object.Subclass({name:"",Create:function(a){if(!this.hidden){var f={onmouseover:b.Mouseover,onmouseout:b.Mouseout,onmouseup:b.Mouseup,onmousedown:b.Mousedown,ondragstart:l,onselectstart:l,onselectend:l,ontouchstart:b.Touchstart,ontouchend:b.Touchend,className:"MathJax_MenuItem",menuItem:this};this.disabled&&(f.className+=" MathJax_MenuDisabled");q.addElement(a,"div",f,this.Label(f,a))}},Name:function(){return k(this.name[0],this.name[1])},Mouseover:function(a,f){this.disabled||this.Activate(f);if(!this.menu||!this.menu.posted){for(var d=document.getElementById("MathJax_MenuFrame").childNodes,c=f.parentNode.childNodes,h=0,e=c.length;h<e;h++){var g=c[h].menuItem;g&&g.menu&&g.menu.posted&&g.Deactivate(c[h])}for(e=d.length-1;0<=e&&f.parentNode.menuItem!==d[e].menuItem;)d[e].menuItem.posted=!1,d[e].parentNode.removeChild(d[e]),e--;this.Timer&&!b.isMobile&&this.Timer(a,f)}},Mouseout:function(a,b){this.menu&&this.menu.posted||this.Deactivate(b);this.timer&&(clearTimeout(this.timer),delete this.timer)},Mouseup:function(a,b){return this.Remove(a,b)},Touchstart:function(a,b){return this.TouchEvent(a,b,"Mousedown")},Touchend:function(a,b){return this.TouchEvent(a,b,"Mouseup")},TouchEvent:function(a,f,d){this!==c.lastItem&&(c.lastMenu&&b.Event(a,c.lastMenu,"Mouseout"),b.Event(a,f,"Mouseover",!0),c.lastItem=this,c.lastMenu=f);if(this.nativeTouch)return null;b.Event(a,f,d);return!1},Remove:function(a,b){b=b.parentNode.menuItem;return b.Remove(a,b)},Activate:function(a){this.Deactivate(a);a.className+=" MathJax_MenuActive"},Deactivate:function(a){a.className=a.className.replace(/ MathJax_MenuActive/,"")},With:function(a){a&&g.Insert(this,a);return this}});b.ITEM.COMMAND=b.ITEM.Subclass({action:function(){},Init:function(a,b,d){a instanceof Array||(a=[a,a]);this.name=a;this.action=b;this.With(d)},Label:function(a,b){return[this.Name()]},Mouseup:function(a,b){this.disabled||(this.Remove(a,b),u.Post(["command",this]),this.action.call(this,a));return l(a)}});b.ITEM.SUBMENU=b.ITEM.Subclass({menu:null,marker:n&&!g.Browser.isSafari?"\u25b6":"\u25b8",Init:function(a,f){a instanceof Array||(a=[a,a]);this.name=a;var d=1;f instanceof b.ITEM||(this.With(f),d++);this.menu=b.apply(b,[].slice.call(arguments,d))},Label:function(a,b){this.menu.posted=!1;return[this.Name()+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]]},Timer:function(a,b){this.timer&&clearTimeout(this.timer);a={clientX:a.clientX,clientY:a.clientY};this.timer=setTimeout(w(["Mouseup",this,a,b]),e.delay)},Touchend:function(a,b){var d=this.menu.posted,e=this.SUPER(arguments).Touchend.apply(this,arguments);d&&(this.Deactivate(b),delete c.lastItem,delete c.lastMenu);return e},Mouseup:function(a,b){if(!this.disabled)if(this.menu.posted)for(var d=document.getElementById("MathJax_MenuFrame").childNodes,c=d.length-1;0<=c;){var e=d[c];e.menuItem.posted=!1;e.parentNode.removeChild(e);if(e.menuItem===this.menu)break;c--}else this.timer&&(clearTimeout(this.timer),delete this.timer),this.menu.Post(a,b);return l(a)}});b.ITEM.RADIO=b.ITEM.Subclass({variable:null,marker:n?"\u25cf":"\u2713",Init:function(a,b,d){a instanceof Array||(a=[a,a]);this.name=a;this.variable=b;this.With(d);null==this.value&&(this.value=this.name[0])},Label:function(a,b){var d={className:"MathJax_MenuRadioCheck"};e.settings[this.variable]!==this.value&&(d={style:{display:"none"}});return[["span",d,[this.marker]]," "+this.Name()]},Mouseup:function(a,f){if(!this.disabled){for(var d=f.parentNode.childNodes,c=0,h=d.length;c<h;c++){var g=d[c].menuItem;g&&g.variable===this.variable&&(d[c].firstChild.style.display="none")}f.firstChild.display="";e.settings[this.variable]=this.value;b.cookie[this.variable]=e.settings[this.variable];b.saveCookie();u.Post(["radio button",this])}this.Remove(a,f);this.action&&!this.disabled&&this.action.call(b,this);return l(a)}});b.ITEM.CHECKBOX=b.ITEM.Subclass({variable:null,marker:"\u2713",Init:function(a,b,d){a instanceof Array||(a=[a,a]);this.name=a;this.variable=b;this.With(d)},Label:function(a,b){var d={className:"MathJax_MenuCheck"};e.settings[this.variable]||(d={style:{display:"none"}});return[["span",d,[this.marker]]," "+this.Name()]},Mouseup:function(a,f){this.disabled||(f.firstChild.display=e.settings[this.variable]?"none":"",e.settings[this.variable]=!e.settings[this.variable],b.cookie[this.variable]=e.settings[this.variable],b.saveCookie(),u.Post(["checkbox",this]));this.Remove(a,f);this.action&&!this.disabled&&this.action.call(b,this);return l(a)}});b.ITEM.LABEL=b.ITEM.Subclass({Init:function(a,b){a instanceof Array||(a=[a,a]);this.name=a;this.With(b)},Label:function(a,b){delete a.onmouseover;delete a.onmouseout;delete a.onmousedown;a.className+=" MathJax_MenuLabel";return[this.Name()]}});b.ITEM.RULE=b.ITEM.Subclass({Label:function(a,b){delete a.onmouseover;delete a.onmouseout;delete a.onmousedown;a.className+=" MathJax_MenuRule";return null}});b.About=function(){var a=t["HTML-CSS"]||{},f=(a.imgFonts?"image":a.fontInUse?(a.webFonts?"web":"local")+" "+a.fontInUse:t.SVG?"web SVG":"generic")+" fonts",a=!a.webFonts||a.imgFonts?null:a.allowWebFonts.replace(/otf/,"woff or otf")+" fonts",d=["MathJax.js v"+MathJax.fileversion,["br"]];d.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);b.About.GetJax(d,MathJax.InputJax,["InputJax","%1 Input Jax v%2"]);b.About.GetJax(d,MathJax.OutputJax,["OutputJax","%1 Output Jax v%2"]);b.About.GetJax(d,MathJax.ElementJax,["ElementJax","%1 Element Jax v%2"]);d.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);b.About.GetJax(d,MathJax.Extension,["Extension","%1 Extension v%2"],!0);d.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[g.Browser+" v"+g.Browser.version+(a?" \u2014 "+k(a.replace(/ /g,""),a):"")]]);b.About.div=b.Background(b.About);f=q.addElement(b.About.div,"div",{id:"MathJax_About"},[["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],k(f.replace(/ /g,""),"using "+f),["br"],["br"],["span",{style:{display:"inline-block","text-align":"left","font-size":"80%","max-height":"20em",overflow:"auto","background-color":"#E4E4E4",padding:".4em .6em",border:"1px inset"}},d],["br"],["br"],["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],["img",{src:e.closeImg,style:{width:"21px",height:"21px",position:"absolute",top:".2em",right:".2em"},onclick:b.About.Remove}]]);MathJax.Localization.setCSS(f);a=document.documentElement||{};a=window.innerHeight||a.clientHeight||a.scrollHeight||0;b.prototype.msieAboutBug?(f.style.width="20em",f.style.position="absolute",f.style.left=Math.floor((document.documentElement.scrollWidth-f.offsetWidth)/2)+"px",f.style.top=Math.floor((a-f.offsetHeight)/3)+document.body.scrollTop+"px"):(f.style.marginLeft=Math.floor(-f.offsetWidth/2)+"px",f.style.top=Math.floor((a-f.offsetHeight)/3)+"px")};b.About.Remove=function(a){b.About.div&&(document.body.removeChild(b.About.div),delete b.About.div)};b.About.GetJax=function(a,b,d,c){var e=[],g;for(g in b)b.hasOwnProperty(g)&&b[g]&&(c&&b[g].version||b[g].isa&&b[g].isa(b))&&e.push(k(d[0],d[1],b[g].id||g,b[g].version));e.sort();b=0;for(d=e.length;b<d;b++)a.push(e[b],["br"]);return a};b.Help=function(){p.Require("[MathJax]/extensions/HelpDialog.js",function(){MathJax.Extension.Help.Dialog()})};b.ShowSource=function(a){a||(a=window.event);var f={screenX:a.screenX,screenY:a.screenY};if(b.jax)if("MathML"===this.format){var d=MathJax.ElementJax.mml;if(d&&"undefined"!==typeof d.mbase.prototype.toMathML)try{b.ShowSource.Text(b.jax.root.toMathML(),a)}catch(c){if(!c.restart)throw c;w.After([this,b.ShowSource,f],c.restart)}else p.loadingToMathML||(p.loadingToMathML=!0,b.ShowSource.Window(a),w.Queue(p.Require("[MathJax]/extensions/toMathML.js"),function(){delete p.loadingToMathML;d.mbase.prototype.toMathML||(d.mbase.prototype.toMathML=function(){})},[this,b.ShowSource,f]))}else"Error"===this.format?b.ShowSource.Text(b.jax.errorText,a):null==b.jax.originalText?alert(k("NoOriginalForm","No original form available")):b.ShowSource.Text(b.jax.originalText,a)};b.ShowSource.Window=function(a){if(!b.ShowSource.w){a=[];var c=e.windowSettings,d;for(d in c)c.hasOwnProperty(d)&&a.push(d+"\x3d"+c[d]);b.ShowSource.w=window.open("","_blank",a.join(","))}return b.ShowSource.w};b.ShowSource.Text=function(a,c){var d=b.ShowSource.Window(c);delete b.ShowSource.w;a=a.replace(/^\s*/,"").replace(/\s*$/,"");a=a.replace(/&/g,"\x26amp;").replace(/</g,"\x26lt;").replace(/>/g,"\x26gt;");var e=k("EqSource","MathJax Equation Source");if(b.isMobile)d.document.open(),d.document.write("\x3chtml\x3e\x3chead\x3e\x3cmeta name\x3d'viewport' content\x3d'width\x3ddevice-width, initial-scale\x3d1.0' /\x3e\x3ctitle\x3e"+e+"\x3c/title\x3e\x3c/head\x3e\x3cbody style\x3d'font-size:85%'\x3e"),d.document.write("\x3cpre\x3e"+a+"\x3c/pre\x3e"),d.document.write("\x3chr\x3e\x3cinput type\x3d'button' value\x3d'"+k("Close","Close")+"' onclick\x3d'window.close()' /\x3e"),d.document.write("\x3c/body\x3e\x3c/html\x3e"),d.document.close();else{d.document.open();d.document.write("\x3chtml\x3e\x3chead\x3e\x3ctitle\x3e"+e+"\x3c/title\x3e\x3c/head\x3e\x3cbody style\x3d'font-size:85%'\x3e");d.document.write("\x3ctable\x3e\x3ctr\x3e\x3ctd\x3e\x3cpre\x3e"+a+"\x3c/pre\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e");d.document.write("\x3c/body\x3e\x3c/html\x3e");d.document.close();var h=d.document.body.firstChild;setTimeout(function(){var a=d.outerHeight-d.innerHeight||30,b=d.outerWidth-d.innerWidth||30,b=Math.max(100,Math.min(Math.floor(.5*screen.width),h.offsetWidth+b+25)),a=Math.max(40,Math.min(Math.floor(.5*screen.height),h.offsetHeight+a+25));d.resizeTo(b,a);c&&null!=c.screenX&&(b=Math.max(0,Math.min(c.screenX-Math.floor(b/2),screen.width-b-20)),a=Math.max(0,Math.min(c.screenY-Math.floor(a/2),screen.height-a-20)),d.moveTo(b,a))},50)}};b.Scale=function(){var a=t["HTML-CSS"],c=t.NativeMML,d=t.SVG,e=(a||c||d||{config:{scale:100}}).config.scale,h=prompt(k("ScaleMath","Scale all mathematics (compared to surrounding text) by"),e+"%");h&&(h.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)?(h=parseFloat(h))?h!==e&&(a&&(a.config.scale=h),c&&(c.config.scale=h),d&&(d.config.scale=h),b.cookie.scale=h,b.saveCookie(),g.Reprocess()):alert(k("NonZeroScale","The scale should not be zero")):alert(k("PercentScale","The scale should be a percentage (e.g., 120%%)")))};b.Zoom=function(){MathJax.Extension.MathZoom||p.Require("[MathJax]/extensions/MathZoom.js")};b.Renderer=function(){var a=g.outputJax["jax/mml"];if(a[0]!==e.settings.renderer){var c=g.Browser,d,m=b.Renderer.Messages,h;switch(e.settings.renderer){case "NativeMML":e.settings.warnedMML||(c.isChrome&&"24."!==c.version.substr(0,3)?d=m.MML.WebKit:c.isSafari&&!c.versionAtLeast("5.0")?d=m.MML.WebKit:c.isMSIE?c.hasMathPlayer||(d=m.MML.MSIE):d=m.MML[c],h="warnedMML");break;case "SVG":e.settings.warnedSVG||!c.isMSIE||v||(d=m.SVG.MSIE)}if(d){d=k(d[0],d[1]);d=d+"\n\n"+k("SwitchAnyway","Switch the renderer anyway?\n\n(Press OK to switch, CANCEL to continue with the current renderer)");b.cookie.renderer=a[0].id;b.saveCookie();if(!confirm(d)){b.cookie.renderer=e.settings.renderer=q.Cookie.Get("menu").renderer;b.saveCookie();return}h&&(b.cookie.warned=e.settings.warned=!0);b.cookie.renderer=e.settings.renderer;b.saveCookie()}g.Queue(["setRenderer",g,e.settings.renderer,"jax/mml"],["Rerender",g])}};b.Renderer.Messages={MML:{WebKit:["WebkitNativeMMLWarning","Your browser doesn't seem to support MathML natively, so switching to MathML output may cause the mathematics on the page to become unreadable."],MSIE:["MSIENativeMMLWarning","Internet Explorer requires the MathPlayer plugin in order to process MathML output."],Opera:["OperaNativeMMLWarning","Opera's support for MathML is limited, so switching to MathML output may cause some expressions to render poorly."],Safari:["SafariNativeMMLWarning","Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly."],Firefox:["FirefoxNativeMMLWarning","Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly."]},SVG:{MSIE:["MSIESVGWarning","SVG is not implemented in Internet Explorer prior to IE9 or when it is emulating IE8 or below. Switching to SVG output will cause the mathematics to not display properly."]}};b.Font=function(){t["HTML-CSS"]&&document.location.reload()};b.Locale=function(){MathJax.Localization.setLocale(e.settings.locale);MathJax.Hub.Queue(["Reprocess",MathJax.Hub])};b.LoadLocale=function(){var a=prompt(k("LoadURL","Load translation data from this URL:"));a&&(a.match(/\.js$/)||alert(k("BadURL","The URL should be for a javascript file that defines MathJax translation data. Javascript file names should end with '.js'")),p.Require(a,function(b){b!=p.STATUS.OK&&alert(k("BadData","Failed to load translation data from %1",a))}))};b.MPEvents=function(a){var c=e.settings.discoverable,d=b.MPEvents.Messages;v?!c&&"Menu Events"===a.name[1]&&e.settings.mpContext&&alert(k.apply(k,d.IE9warning)):e.settings.mpMouse&&!confirm(k.apply(k,d.IE8warning))?(delete b.cookie.mpContext,delete e.settings.mpContext,delete b.cookie.mpMouse,delete e.settings.mpMouse,b.saveCookie()):(e.settings.mpContext=e.settings.mpMouse,b.cookie.mpContext=b.cookie.mpMouse=e.settings.mpMouse,b.saveCookie(),MathJax.Hub.Queue(["Rerender",MathJax.Hub]))};b.MPEvents.Messages={IE8warning:["IE8warning","This will disable the MathJax menu and zoom features, but you can Alt-Click on an expression to obtain the MathJax menu instead.\n\nReally change the MathPlayer settings?"],IE9warning:["IE9warning","The MathJax contextual menu will be disabled, but you can Alt-Click on an expression to obtain the MathJax menu instead."]};g.Browser.Select({MSIE:function(a){var c="BackCompat"===document.compatMode;a=a.versionAtLeast("8.0")&&7<document.documentMode;b.Augment({margin:20,msieBackgroundBug:9>document.documentMode,msieFixedPositionBug:c||!a,msieAboutBug:c});v&&(delete e.styles["#MathJax_About"].filter,delete e.styles[".MathJax_Menu"].filter)},Firefox:function(a){b.skipMouseover=a.isMobile&&a.versionAtLeast("6.0");b.skipMousedown=a.isMobile}});b.isMobile=g.Browser.isMobile;b.noContextMenu=g.Browser.noContextMenu;b.CreateLocaleMenu=function(){if(b.menu){var a=b.menu.Find("Language").menu,e=a.items,d=[],g=MathJax.Localization.strings,h;for(h in g)g.hasOwnProperty(h)&&d.push(h);d=d.sort();a.items=[];h=0;for(var k=d.length;h<k;h++){var l=g[d[h]].menuTitle,l=l?l+(" ("+d[h]+")"):d[h];a.items.push(c.RADIO([d[h],l],"locale",{action:b.Locale}))}a.items.push(e[e.length-2],e[e.length-1])}};g.Register.StartupHook("End Config",function(){e.settings=g.config.menuSettings;"undefined"!==typeof e.settings.showRenderer&&(e.showRenderer=e.settings.showRenderer);"undefined"!==typeof e.settings.showFontMenu&&(e.showFontMenu=e.settings.showFontMenu);"undefined"!==typeof e.settings.showContext&&(e.showContext=e.settings.showContext);b.getCookie();b.menu=b(c.SUBMENU(["Show","Show Math As"],c.COMMAND(["MathMLcode","MathML Code"],b.ShowSource,{nativeTouch:!0,format:"MathML"}),c.COMMAND(["Original","Original Form"],b.ShowSource,{nativeTouch:!0}),c.RULE(),c.CHECKBOX(["texHints","Show TeX hints in MathML"],"texHints")),c.RULE(),c.SUBMENU(["Settings","Math Settings"],c.SUBMENU(["ZoomTrigger","Zoom Trigger"],c.RADIO(["Hover","Hover"],"zoom",{action:b.Zoom}),c.RADIO(["Click","Click"],"zoom",{action:b.Zoom}),c.RADIO(["DoubleClick","Double-Click"],"zoom",{action:b.Zoom}),c.RADIO(["NoZoom","No Zoom"],"zoom",{value:"None"}),c.RULE(),c.LABEL(["TriggerRequires","Trigger Requires:"]),c.CHECKBOX(g.Browser.isMac?["Option","Option"]:["Alt","Alt"],"ALT"),c.CHECKBOX(["Command","Command"],"CMD",{hidden:!g.Browser.isMac}),c.CHECKBOX(["Control","Control"],"CTRL",{hidden:g.Browser.isMac}),c.CHECKBOX(["Shift","Shift"],"Shift")),c.SUBMENU(["ZoomFactor","Zoom Factor"],c.RADIO("125%","zscale"),c.RADIO("133%","zscale"),c.RADIO("150%","zscale"),c.RADIO("175%","zscale"),c.RADIO("200%","zscale"),c.RADIO("250%","zscale"),c.RADIO("300%","zscale"),c.RADIO("400%","zscale")),c.RULE(),c.SUBMENU(["Renderer","Math Renderer"],{hidden:!e.showRenderer},c.RADIO("HTML-CSS","renderer",{action:b.Renderer}),c.RADIO("MathML","renderer",{action:b.Renderer,value:"NativeMML"}),c.RADIO("SVG","renderer",{action:b.Renderer})),c.SUBMENU("MathPlayer",{hidden:!g.Browser.isMSIE||!e.showMathPlayer,disabled:!g.Browser.hasMathPlayer},c.LABEL(["MPHandles","Let MathPlayer Handle:"]),c.CHECKBOX(["MenuEvents","Menu Events"],"mpContext",{action:b.MPEvents,hidden:!v}),c.CHECKBOX(["MouseEvents","Mouse Events"],"mpMouse",{action:b.MPEvents,hidden:!v}),c.CHECKBOX(["MenuAndMouse","Mouse and Menu Events"],"mpMouse",{action:b.MPEvents,hidden:v})),c.SUBMENU(["FontPrefs","Font Preference"],{hidden:!e.showFontMenu},c.LABEL(["ForHTMLCSS","For HTML-CSS:"]),c.RADIO(["Auto","Auto"],"font",{action:b.Font}),c.RULE(),c.RADIO(["TeXLocal","TeX (local)"],"font",{action:b.Font}),c.RADIO(["TeXWeb","TeX (web)"],"font",{action:b.Font}),c.RADIO(["TeXImage","TeX (image)"],"font",{action:b.Font}),c.RULE(),c.RADIO(["STIXlocal","STIX (local)"],"font",{action:b.Font})),c.SUBMENU(["ContextMenu","Contextual Menu"],{hidden:!e.showContext},c.RADIO("MathJax","context"),c.RADIO(["Browser","Browser"],"context")),c.COMMAND(["Scale","Scale All Math ..."],b.Scale),c.RULE().With({hidden:!e.showDiscoverable,name:["","discover_rule"]}),c.CHECKBOX(["Discoverable","Highlight on Hover"],"discoverable",{hidden:!e.showDiscoverable})),c.SUBMENU(["Locale","Language"],{hidden:!e.showLocale},c.RADIO("en","locale",{action:b.Locale}),c.RULE().With({hidden:!e.showLocaleURL,name:["","localURL_rule"]}),c.COMMAND(["LoadLocale","Load from URL ..."],b.LoadLocale,{hidden:!e.showLocaleURL})),c.RULE(),c.COMMAND(["About","About MathJax"],b.About),c.COMMAND(["Help","MathJax Help"],b.Help));if(b.isMobile){var a=e.settings,f=b.menu.Find("Math Settings","Zoom Trigger").menu;f.items[0].disabled=f.items[1].disabled=!0;if("Hover"===a.zoom||"Click"==a.zoom)a.zoom="None";f.items=f.items.slice(0,4);navigator.appVersion.match(/[ (]Android[) ]/)&&b.ITEM.SUBMENU.Augment({marker:"\u00bb"})}b.CreateLocaleMenu()});b.showRenderer=function(a){b.cookie.showRenderer=e.showRenderer=a;b.saveCookie();b.menu.Find("Math Settings","Math Renderer").hidden=!a};b.showMathPlayer=function(a){b.cookie.showMathPlayer=e.showMathPlayer=a;b.saveCookie();b.menu.Find("Math Settings","MathPlayer").hidden=!a};b.showFontMenu=function(a){b.cookie.showFontMenu=e.showFontMenu=a;b.saveCookie();b.menu.Find("Math Settings","Font Preference").hidden=!a};b.showContext=function(a){b.cookie.showContext=e.showContext=a;b.saveCookie();b.menu.Find("Math Settings","Contextual Menu").hidden=!a};b.showDiscoverable=function(a){b.cookie.showDiscoverable=e.showDiscoverable=a;b.saveCookie();b.menu.Find("Math Settings","Highlight on Hover").hidden=!a;b.menu.Find("Math Settings","discover_rule").hidden=!a};b.showLocale=function(a){b.cookie.showLocale=e.showLocale=a;b.saveCookie();b.menu.Find("Language").hidden=!a};MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){MathJax.OutputJax["HTML-CSS"].config.imageFont||(b.menu.Find("Math Settings","Font Preference","TeX (image)").disabled=!0)});w.Queue(g.Register.StartupHook("End Config",{}),["getImages",b],["Styles",p,e.styles],["Post",g.Startup.signal,"MathMenu Ready"],["loadComplete",p,"[MathJax]/extensions/MathMenu.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.CallBack,MathJax.OutputJax);
|