scribble-math/mathjax/extensions/MathMenu.js

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 ','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-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"','border-radius":e',',"-','webkit-',34,',"-','moz-',34,',"-','khtml-',34,',"','box-shadow":"0px 10px 20px #808080','","-',36,45,46,39,45,46,42,45,'",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',61,'MathJax_MenuArrow','":{',21,'",right:".5em",color:"#666666','","font-family":(g?"\'Arial unicode MS\'":null)},".','MathJax_MenuActive',' .',73,'":{color:"','white',61,'MathJax_MenuCheck','":{',21,'",left:".7em',77,'MathJax_MenuRadioCheck','":{',21,'",left:(i?"1em":".7em")},".','MathJax_MenuLabel','":{',25,' 2em 4px 1.33em":"1px 2em 3px 1.33em"),"',68,69,61,'MathJax_MenuRule',63,'border-top":(i?"',27,'":"1px solid #DDDDDD"),margin:(i?"4px 1px 0px":"4px 3px")},".','MathJax_MenuDisabled',81,'GrayText',61,78,63,23,'":(i?"Highlight":"#606872"),color:(i?"HighlightText":"white")}}},(b.config.MathMenu||{}));var d=',1,'k){if(!k){k','=window.event}','if(','k){if(','k.preventDefault','){',118,'()}if(','k.stopPropagation','){',122,'()}k.cancelBubble=true;k.returnValue=false}','return ','false};var a=MathJax.Menu','=MathJax.Object.Subclass({','items:[],posted',14,'title:null,margin:5,Init:',1,'k){this.items=[].','slice.call(arguments,','0)},With:',1,'k){if(k){b.Insert(this,k)}return this},','Post:',1,'l,u){if(!l){l',115,'var s=(!this.title?null:[["div",{','className:"',62,'"},[this.','title]]]);var k','=document.getElementById("MathJax_MenuFrame','");if(!k){k','=a.Background(','this)}var n=c','.addElement(','k',',"div",{','onmouseup:a.Mouseup,','ondblclick',':this.False,ondragstart:this.False,onselectstart:this.False,','oncontextmenu',':this.False,','menuItem',':this,',143,19,'"},s);for(var p=0,o=this.items.length;p<o;p++){this.items[p].Create(n)}this.posted=true;n','.style.width','=(n.','offsetWidth','+2)+"px";var t=l.pageX,r=l.pageY;if(!t&&!r){t=l.clientX+','document.body.','scrollLeft+','document.documentElement','.scrollLeft;r=l.clientY+',168,'scrollTop','+',170,'.',173,'}if(!u){if(t+n.',166,'>',168,166,'-this.margin','){t=',168,166,'-n.',166,183,'}a.skipUp=true}else{var q="left",v=u.',166,';t=u.',166,'-2;r=0;while(u&&u!==k){t+=u.offsetLeft;r+=u.offsetTop;u=u.parentNode}if(t+n.',166,'>',168,166,183,'){q="right";t=Math.max(this.margin,t-v-n.',166,'+6)}if(!i){n.style["borderRadiusTop','"+q]=0;n.style["','WebkitBorderRadiusTop',203,'MozBorderRadiusTop',203,'KhtmlBorderRadiusTop"+q]=0}}n.style.left=t+"px";n.style.top=r+"px";if(','document.selection','&&',209,'.empty){',209,'.empty()}','return this.False(','l)},Remove:',1,'k,l){','var m',147,'");if(m){m.','parentNode.removeChild(','m',');if(this.','msieBackgroundBug','){detachEvent("onresize",a.Resize)}}},Mouseup:',1,218,'if(a.skipUp){delete a.skipUp}else{','this.Remove(k,l',')}},False:d},{config:j,div:null,Remove:',1,'k){a.Event(k,this,"','Remove")},Mouseover:',1,233,'Mouseover")},Mouseout:',1,233,'Mouseout")},Mousedown:',1,233,'Mousedown")},Mouseup:',1,233,'Mouseup")},Mousemove:',1,233,'Mousemove")},Event:',1,'m,n,k){if(!m){m',115,'var l=n.',159,';if(l&&l[k]){',126,'l[k](m,n)}',126,'null},BGSTYLE:{',21,'",left:0,top:0,"z-index":200,width:"100%",height:"100%",border:0,padding:0,margin:0},Background:',1,'l',3,'m=c',151,'document.','body,"','div",{style:this.BGSTYLE,','id:"MathJax_MenuFrame"},[["',269,159,':l,','onmousedown',':this.Remove}]]);var k=m.','firstChild',';if(l.',225,'){k.style.backgroundColor="white";k.style.filter="alpha(opacity=0)";m.width=m.height=0;this.Resize();attachEvent("onresize",this.Resize)}else{k','.style.position="','fixed"}',126,'m},Resize:','function(){','setTimeout(a.SetWH,0)},SetWH:','function(){var ','k',147,'");if(k){k=k.',276,';k',164,'=k.style.height="1px";k',164,'=',168,'scrollWidth+"px";k.style.height=',168,'scrollHeight','+"px"}},saveCookie:',284,'c.Cookie.Set("menu",this.cookie)},getCookie:',284,'this.cookie=c.Cookie.Get("menu")}});var h=a.ITEM',128,'name:"",Create:',1,'l){if(!','this.hidden',3,'k={onmouseover:a.Mouseover,onmouseout:a.Mouseout,',154,274,156,'onselectend',158,143,57,'",',159,':this};if(this.disabled){','k.className+=" ',105,'"}c',151,'l,"div",k,this.Label(k,l))}},Mouseover:',1,'p,r','){if(!this.disabled){','this.Activate(r)}','if(!this.menu||!this.menu.posted){','var q',147,'").childNodes,','l=r','.parentNode.childNodes;for(var ','n=0,k=l.length;n<k;n++){var o=l[n].',159,';if(o&&o.menu&&o','.menu.posted){','o.Deactivate(l[n])}}k=q','.length-1;while(k>=0','&&r','.parentNode.',159,'!==q[k].',159,'){q[k].',159,'.posted=false;','q[k].',222,'q[k]);k--}if(this.Timer){this.Timer(p,r)}}},Mouseout:',1,218,331,'this.Deactivate(','l)}','if(this.timer){clearTimeout(this.timer',');delete this.timer','}},Mouseup:',1,218,126,230,')},Remove:',1,218,'l=l',344,159,';',126,'l.Remove(k,l)},Activate:',1,'k){',357,'k);',322,78,'"},Deactivate:',1,'k){k.className=k.className.replace(/ ',78,'/,"")},With:',1,137,'False:d});a.ITEM.COMMAND','=a.ITEM.Subclass({','action:function(){},Init:',1,'k,m',',l){this.name=k;this.','action=m;this.With(l)},Label:',1,218,'return[this.name',']},Mouseup:',1,'k,l',329,230,');this.action.call(this)}',215,'k',')}});a.ITEM.','SUBMENU',389,'menu:null,marker:(i&&!',5,'isSafari?"\\u25B6":"\\u25B8"),Init:',1,'k,m){this.name=k;var l=1;if(!(m instanceof a.ITEM)){this.With(m),l++}this.menu=a.apply(a,[].',134,'l))},Label:',1,218,'k.onmousemove=a.Mousemove;this.menu',350,397,'+" ",["span",{',143,73,145,'marker]]]},Timer:',1,218,359,')}k={clientX:k.clientX,clientY:k.clientY};this.timer=setTimeout(MathJax.Callback(["Mouseup",this,k,l]),j.delay)},Mouseup:',1,'l,o',329,'if(!this',340,359,360,'}this.menu.Post(l,o)}else{var n',147,334,'k=n',342,3,'p=n[k];p.',159,350,'p.',222,'p);if(p.',159,'===this.menu){break}k--}}}',215,'l',406,'RADIO',389,'variable:null,marker',':(i?"\\u25CF":"\\u2713"),Init:',1,'l,k,m){this.name=l;this.variable=k;this.With(m',224,'value==null){this.value=this.name}},Label:',1,'l,m){var k={className:"',89,'"};if(','j.settings[this.variable',']!==this.value){k={','style:{display:"','none"}}}return[["span",k,[this.marker]]," "+this.name]},Mouseup:',1,'o,p',329,'var q=p',336,'l=0,k=q.length;l<k;l++){var n=q[l].',159,';if(n&&n.variable===this.variable){q[l].',276,'.style.display="none"}}p.',276,'.display="";',466,']=this.value;a.cookie','[this.variable]=',466,'];a.saveCookie();if(this.action){this.action.call(a)}}this.Remove(','o,p);',215,'o',406,'CHECKBOX',389,456,':"\\u2713",Init:',1,459,')},Label:',1,463,84,'"};if(!',466,']){k={',468,'none"}}}return[["span",k,[this.marker]]," "+this.name]},Mouseup:',1,'k,l',329,'l.',276,'.display=(',466,']?"none":"");',466,']=!',466,'];a.cookie',484,466,486,'k,l);',215,'k',406,'LABEL',389,'Init:',1,'k',393,'With(l)},Label:',1,'k,l){delete k.onmouseover,delete k.onmouseout;delete k.onmousedown;k.className+=" ',93,'";',397,']}});a.ITEM.RULE',389,'Label:',1,533,100,'";',126,'null}});a.About=',286,'n=','MathJax.OutputJax','["HTML-CSS','"]||{fontInUse:""};var p=(n.webFonts?"":"local "),l=(n.webFonts?" web":"");var m=(n.imgFonts?"Image":p+n.fontInUse+l);var k=[];','a.About.GetJax','(k,','MathJax.InputJax',',"Input");',551,'(k,',548,',"Output");',551,'(k,','MathJax.ElementJax',',"Element");','a.About.div',149,'a.About);var q=','MathJax.HTML',151,563,153,'style:{position:"fixed",left:"50%",width:"auto","',31,'center",border:"2px outset",padding:"1em 2em","',23,'":"#DDDDDD",',29,'","font-family":"serif","',68,'normal',33,'box-shadow":"5px 5px 10px #AAAAAA',46,36,580,46,39,580,46,42,580,55,'\')"},onclick:a.About.Remove},[["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],"using "+m+" fonts",["br"],["br"],["span",{',468,'inline-block","',31,'left',70,'%","',23,'":"#E4E4E4",padding:".4em .6em",border:"1px inset"}},k],["br"],["br"],["a",{href',9,'/"},["wwww.mathjax.org"]]]);var r=(',170,'||{});var o=window.innerHeight||r.clientHeight||r.',299,'||0;if(a.prototype.msieAboutBug){q',164,'="20em";q',280,'absolute";q.style.left=Math.floor((',170,'.scrollWidth-q.',166,')/','2)+"px";q.style.top','=(','Math.floor((o-q.offsetHeight)/3',')+',168,173,')+"px"}else{q.style.marginLeft=Math.floor(-q.',166,'/',614,'=',616,')+"px"}};a.About.Remove=',1,117,563,'){',168,'removeChild(',563,');delete ',563,'}};',551,'=',1,'k,m,l){','for(var n in ','m){if(m[n].isa&&m[n].isa(m)){k.push(m[n].name+" "+l+" Jax v"+m[n].version,["br"])}}',126,'k};a.Help=',284,'window.open(j.helpURL,"MathJaxHelp")};a.ShowSource=',1,'m){if(!m){m',115,'if(!a.jax){return}if(','j.settings.','format==="MathML"){var k=',561,'.mml;if(k&&typeof(k.mbase.prototype.toMathML)!=="undefined"){','a.ShowSource.','Text(a.jax.root.toMathML(),m)}else{if(!','f.loadingToMathML','){',657,'=true;var l={screenX:m.screenX,screenY:m.screenY};',655,'Window(m);','MathJax.Callback.Queue','(','f.Require("[MathJax]/extensions/','toMathML.js"),',284,'delete f.loadingToMenu},[this,arguments.callee,l]);return}}}else{if','(a.jax.originalText','==null){alert("No TeX form available");return}',655,'Text',669,',m)}};',655,'Window=',1,308,655,'w',3,'m=[],k=j.',17,';',641,117,'k.hasOwnProperty(n)){m.push(n+"="+k[n])}}',655,'w=window.open("","_blank",m.join(","))}',126,655,'w};',655,'Text=',1,'q,p',3,'m=',655,'Window(p);q=q.replace(/^\\s*/,"").replace(/\\s*$/,"");q=q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");m.',267,'open();','m.document.write','("<html><head><title>MathJax Equation Source</title></head><body style=\'font-size:85%\'>");',703,'("<table><tr><td><pre>"+q+"</pre></td></tr></table>");',703,'("</body></html>");m.',267,'close();var o=m.',168,276,';var n=(m.outerHeight-m.innerHeight)||30,l=(m.outerWidth-m.innerWidth)||30;l','=Math.min(Math.floor(0.5*screen.','width),o.',166,'+l+25);n',714,'height),o.offsetHeight+n+25);m.resizeTo(l,n);if(p&&p.screenX!=null',3,'k','=Math.max(0,Math.min(p.','screenX-Math.floor(l/2),screen.width-l-20)),r',722,'screenY-Math.floor(n/2),screen.height-n-20));m.moveTo(k,r)}delete ',655,'w};a.Scale=',286,'l=',548,549,'"],k=',548,'.NativeMML;var n=(l?l','.config.scale',':k',735,');var m=prompt("Scale all mathematics (compared to surrounding text) by",n+"%");if(m){if(m.match(/^\\s*\\d+\\s*%?\\s*$/)){m=parseInt(m);if(m){if(m!==n){if(l){l',735,'=m}if(k){k',735,'=m}a.cookie.scale=m;a.saveCookie();b.Reprocess()}}','else{alert("The scale should ','not be zero")}}',743,'be a perentage (e.g., 120%)")}}};a.Zoom=',284,'if(!MathJax.Extension.MathZoom){',665,'MathZoom.js")}};a.Renderer=',286,'k=b.config.outputJax["jax/mml"];if(k[0]!==',651,'renderer','){',663,'(["Require','",f,"[MathJax]/','jax/output/"+',651,754,'+"/config.js"],[',286,'o=',548,'[',651,754,'];for(var n=0,l=k.length;n<l;n++){if(k[n]===o){k.splice(n,1);break}}k.unshift(o)}],["Reprocess",b])}};a.Font=',286,'k=',548,549,'"];if(!k){return}',267,'location.reload()};',5,'Select({MSIE:',1,'k',3,'l=(',267,'compatMode==="BackCompat");var m=k.versionAtLeast("8.0")&&',267,'documentMode>7;a.Augment({margin:20,',225,':(l||!m),msieAboutBug:l})}});j.settings=b.config.menuSettings;if(!',651,'format){',651,'format=(',553,'.TeX?"TeX":"MathML")}if(typeof(',651,11,')!=="undefined"){j.',11,'=',651,11,'}if(typeof(',651,13,797,13,'=',651,13,'}if(typeof(',651,15,797,15,'=',651,15,'}a.getCookie();a.menu=a(h.COMMAND("Show Source",a.ShowSource),','h.SUBMENU("','Format",h.RADIO("MathML","format"),h.RADIO("TeX","format",{disabled:!',553,'.TeX})),h.RULE(),',819,'Settings",',819,'Zoom Trigger",h.RADIO("Hover','","zoom",{action:a.Zoom}),h.RADIO("','Click',827,'Double-Click',827,'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,838,'Shift","Shift")),',819,'Zoom Factor",h.RADIO("125','%","zscale"),h.RADIO("','133',845,'150',845,'175',845,'200',845,'250',845,'300',845,'400%","zscale")),h.RULE(),',819,'Math Renderer','",{hidden:!j.',11,'},h.RADIO("','HTML-CSS','","renderer",{action:a.Renderer','}),h.RADIO("MathML',865,',value:"NativeMML"})),',819,'Font Preference',861,13,'},h.LABEL("For HTML-CSS:"),h.RADIO("Auto","','font",{action:a.Font}),h.',833,'RADIO("TeX (','local)","',874,876,'web)","',874,876,'image)","',874,833,'RADIO("STIX (local)","font",{action:a.Font})),',819,'Contextual Menu',861,15,863,'MathJax","context"),h.RADIO("Browser","context")),h.COMMAND("Scale All Math ...",a.Scale)),h.',833,'COMMAND("About MathJax",a.About),h.COMMAND("MathJax Help",a.Help));a.',11,'=',1,'k){a.cookie.',11,'=j.',11,'=k;a.saveCookie();a.menu.items[3].menu.','item[3','].hidden=!k};','a.',13,'=',1,898,13,'=j.',13,902,'items[4',904,'a.',15,'=',1,898,15,'=j.',15,902,'items[5',904,663,'(["Styles",f,j.styles],["Post",b.Startup.signal,"MathMenu Ready"],["loadComplete',758,'extensions/MathMenu.js"])})(MathJax.Hub,',566,',MathJax.Ajax);']
]);