Merge branch 'zoom-update' into v2.0-candidate
This commit is contained in:
commit
3f4f54e2c0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16
extensions/MathEvents.js
Normal file
16
extensions/MathEvents.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(){var c="1.1.1";var a=MathJax.Hub.CombineConfig("TeX.noErrors",{multiLine:true,inlineDelimiters:["",""],style:{"font-size":"80%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}});var b="\u00A0";MathJax.Extension["TeX/noErrors"]={version:c,config:a};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Augment({formatError:function(f,e,g,d){var i=a.inlineDelimiters;var h=(g||a.multiLine);if(!g){e=i[0]+e+i[1]}if(h){e=e.replace(/ /g,b)}else{e=e.replace(/\n/g," ")}return MathJax.ElementJax.mml.merror(e).With({isError:true,multiLine:h})}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Config",function(){MathJax.Hub.Config({"HTML-CSS":{styles:{".MathJax .merror":MathJax.Hub.Insert({"font-style":null,"background-color":null,"vertical-align":(MathJax.Hub.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})})})();MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.ElementJax.mml;var b=MathJax.OutputJax["HTML-CSS"];var c=a.math.prototype.toHTML;a.math.Augment({toHTML:function(d,e){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){d=this.HTMLcreateSpan(d);d.bbox=this.data[0].data[0].toHTML(d).bbox;return d}return c.call(this,d,e)}});a.merror.Augment({toHTML:function(j){if(!this.isError){return a.mbase.prototype.toHTML.call(this,j)}j=this.HTMLcreateSpan(j);if(this.multiLine){j.style.display="inline-block"}var l=this.data[0].data[0].data.join("").split(/\n/);for(var g=0,e=l.length;g<e;g++){b.addText(j,l[g]);if(g!==e-1){b.addElement(j,"br")}}var n=b.getHD(j.parentNode),d=b.getW(j.parentNode);if(e>1){var k=(n.h+n.d)/2,h=b.TeX.x_height/2;var f=b.config.styles[".MathJax .merror"]["font-size"];if(f&&f.match(/%/)){h*=parseInt(f)/100}j.parentNode.style.verticalAlign=b.Em(n.d+(h-k));n.h=h+k;n.d=k-h}j.bbox={h:n.h,d:n.d,w:d,lw:0,rw:d};return j}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Hub.Register.StartupHook("NativeMML Jax Ready",function(){var b=MathJax.ElementJax.mml;var a=MathJax.Extension["TeX/noErrors"].config;var c=b.math.prototype.toNativeMML;b.math.Augment({toNativeMML:function(d){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toNativeMML(d)}return c.call(this,d)}});b.merror.Augment({toNativeMML:function(g){if(!this.isError){return b.mbase.prototype.toNativeMML.call(this,g)}g=g.appendChild(document.createElement("span"));var h=this.data[0].data[0].data.join("").split(/\n/);for(var f=0,e=h.length;f<e;f++){g.appendChild(document.createTextNode(h[f]));if(f!==e-1){g.appendChild(document.createElement("br"))}}if(this.multiLine){g.style.display="inline-block";if(e>1){g.style.verticalAlign="middle"}}for(var j in a.style){if(a.style.hasOwnProperty(j)){var d=j.replace(/-./g,function(i){return i.charAt(1).toUpperCase()});g.style[d]=a.style[j]}}return g}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");
|
||||
(function(){var c="1.1.1";var a=MathJax.Hub.CombineConfig("TeX.noErrors",{multiLine:true,inlineDelimiters:["",""],style:{"font-size":"80%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}});var b="\u00A0";MathJax.Extension["TeX/noErrors"]={version:c,config:a};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Augment({formatError:function(f,e,g,d){var i=a.inlineDelimiters;var h=(g||a.multiLine);if(!g){e=i[0]+e+i[1]}if(h){e=e.replace(/ /g,b)}else{e=e.replace(/\n/g," ")}return MathJax.ElementJax.mml.merror(e).With({isError:true,multiLine:h})}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Config",function(){MathJax.Hub.Config({"HTML-CSS":{styles:{".MathJax .merror":MathJax.Hub.Insert({"font-style":null,"background-color":null,"vertical-align":(MathJax.Hub.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})})})();MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.ElementJax.mml;var b=MathJax.OutputJax["HTML-CSS"];var c=a.math.prototype.toHTML;a.math.Augment({toHTML:function(d,e){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){d=this.HTMLcreateSpan(d);d.bbox=this.data[0].data[0].toHTML(d).bbox;return d}return c.call(this,d,e)}});a.merror.Augment({toHTML:function(j){if(!this.isError){return a.mbase.prototype.toHTML.call(this,j)}j=this.HTMLcreateSpan(j);if(this.multiLine){j.style.display="inline-block"}var l=this.data[0].data[0].data.join("").split(/\n/);for(var g=0,e=l.length;g<e;g++){b.addText(j,l[g]);if(g!==e-1){b.addElement(j,"br",{isMathJax:true})}}var n=b.getHD(j.parentNode),d=b.getW(j.parentNode);if(e>1){var k=(n.h+n.d)/2,h=b.TeX.x_height/2;var f=b.config.styles[".MathJax .merror"]["font-size"];if(f&&f.match(/%/)){h*=parseInt(f)/100}j.parentNode.style.verticalAlign=b.Em(n.d+(h-k));n.h=h+k;n.d=k-h}j.bbox={h:n.h,d:n.d,w:d,lw:0,rw:d};return j}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Hub.Register.StartupHook("NativeMML Jax Ready",function(){var b=MathJax.ElementJax.mml;var a=MathJax.Extension["TeX/noErrors"].config;var c=b.math.prototype.toNativeMML;b.math.Augment({toNativeMML:function(d){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toNativeMML(d)}return c.call(this,d)}});b.merror.Augment({toNativeMML:function(g){if(!this.isError){return b.mbase.prototype.toNativeMML.call(this,g)}g=g.appendChild(document.createElement("span"));var h=this.data[0].data[0].data.join("").split(/\n/);for(var f=0,e=h.length;f<e;f++){g.appendChild(document.createTextNode(h[f]));if(f!==e-1){g.appendChild(document.createElement("br"))}}if(this.multiLine){g.style.display="inline-block";if(e>1){g.style.verticalAlign="middle"}}for(var j in a.style){if(a.style.hasOwnProperty(j)){var d=j.replace(/-./g,function(i){return i.charAt(1).toUpperCase()});g.style[d]=a.style[j]}}return g}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");
|
||||
|
||||
|
|
BIN
images/CloseX-31.png
Normal file
BIN
images/CloseX-31.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
images/MenuArrow-15.png
Normal file
BIN
images/MenuArrow-15.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 725 B |
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.InputJax.MathML=MathJax.InputJax({id:"MathML",version:"1.1.7",directory:MathJax.InputJax.directory+"/MathML",extensionDir:MathJax.InputJax.extensionDir+"/MathML",entityDir:MathJax.InputJax.directory+"/MathML/entities",config:{useMathMLspacing:false}});MathJax.InputJax.MathML.Register("math/mml");MathJax.InputJax.MathML.loadComplete("config.js");
|
||||
MathJax.InputJax.MathML=MathJax.InputJax({id:"MathML",version:"1.1.8",directory:MathJax.InputJax.directory+"/MathML",extensionDir:MathJax.InputJax.extensionDir+"/MathML",entityDir:MathJax.InputJax.directory+"/MathML/entities",config:{useMathMLspacing:false}});MathJax.InputJax.MathML.Register("math/mml");MathJax.InputJax.MathML.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.8",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%"}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.9",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%"}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var g="1.1.2";var c=MathJax.ElementJax.mml,e=MathJax.OutputJax["HTML-CSS"];var d,f,b;var a=e.config.tooltip=MathJax.Hub.Insert({delayPost:600,delayClear:600,offsetX:10,offsetY:5},e.config.tooltip||{});c.maction.Augment({HTMLtooltip:e.addElement(document.body,"div",{id:"MathJax_Tooltip"}),toHTML:function(k,h,m){k=this.HTMLhandleSize(this.HTMLcreateSpan(k));k.bbox=null;var i=this.getValues("actiontype","selection"),n;var j=this.data[i.selection-1];if(j){e.Measured(j.toHTML(k),k);if(m!=null){e.Remeasured(j.HTMLstretchV(k,h,m),k)}else{if(h!=null){e.Remeasured(j.HTMLstretchH(k,h),k)}}if(e.msieHitBoxBug){var l=e.addElement(k,"span");n=e.createFrame(l,k.bbox.h,k.bbox.d,k.bbox.w,0,"none");k.insertBefore(l,k.firstChild);l.style.marginRight=e.Em(-k.bbox.w);if(e.msieInlineBlockAlignBug){n.style.verticalAlign=e.Em(e.getHD(k).d-k.bbox.d)}}else{n=e.createFrame(k,k.bbox.h,k.bbox.d,k.bbox.w,0,"none");k.insertBefore(n,k.firstChild);n.style.marginRight=e.Em(-k.bbox.w)}n.className="MathJax_HitBox";n.id="MathJax-HitBox-"+this.spanID;if(this.HTMLaction[i.actiontype]){this.HTMLaction[i.actiontype].call(this,k,n,i.selection)}}this.HTMLhandleSpace(k);this.HTMLhandleColor(k);return k},HTMLstretchH:c.mbase.HTMLstretchH,HTMLstretchV:c.mbase.HTMLstretchV,HTMLaction:{toggle:function(i,j,h){this.selection=h;j.onclick=i.childNodes[1].onclick=MathJax.Callback(["HTMLclick",this]);j.style.cursor=i.childNodes[1].style.cursor="pointer"},statusline:function(i,j,h){j.onmouseover=i.childNodes[1].onmouseover=MathJax.Callback(["HTMLsetStatus",this]);j.onmouseout=i.childNodes[1].onmouseout=MathJax.Callback(["HTMLclearStatus",this]);j.onmouseover.autoReset=j.onmouseout.autoReset=true},tooltip:function(i,j,h){if(this.data[1]&&this.data[1].isToken){j.title=j.alt=i.childNodes[1].title=i.childNodes[1].alt=this.data[1].data.join("")}else{j.onmouseover=i.childNodes[1].onmouseover=MathJax.Callback(["HTMLtooltipOver",this]);j.onmouseout=i.childNodes[1].onmouseout=MathJax.Callback(["HTMLtooltipOut",this]);j.onmouseover.autoReset=j.onmouseout.autoReset=true}}},HTMLclick:function(i){this.selection++;if(this.selection>this.data.length){this.selection=1}var h=this;while(h.type!=="math"){h=h.inherit}MathJax.Hub.getJaxFor(h.inputID).Update();if(!i){i=window.event}if(i.preventDefault){i.preventDefault()}if(i.stopPropagation){i.stopPropagation()}i.cancelBubble=true;i.returnValue=false;return false},HTMLsetStatus:function(h){window.status=((this.data[1]&&this.data[1].isToken)?this.data[1].data.join(""):this.data[1].toString())},HTMLclearStatus:function(h){window.status=""},HTMLtooltipOver:function(i){if(!i){i=window.event}if(b){clearTimeout(b);b=null}if(f){clearTimeout(f)}var h=i.pageX;var k=i.pageY;if(h==null){h=i.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;k=i.clientY+document.body.scrollTop+document.documentElement.scrollTop}var j=MathJax.Callback(["HTMLtooltipPost",this,h+a.offsetX,k+a.offsetY]);f=setTimeout(j,a.delayPost)},HTMLtooltipOut:function(h){if(f){clearTimeout(f);f=null}if(b){clearTimeout(b)}var i=MathJax.Callback(["HTMLtooltipClear",this,80]);b=setTimeout(i,a.delayClear)},HTMLtooltipPost:function(i,m){f=null;if(b){clearTimeout(b);b=null}var l=this.HTMLtooltip;l.style.display="block";l.style.opacity="";l.style.filter=e.config.styles["#MathJax_Tooltip"].filter;if(this===d){return}l.style.left=i+"px";l.style.top=m+"px";l.innerHTML='<span class="MathJax"><nobr></nobr></span>';e.getScales(l.firstChild,l.firstChild);var h=e.createStack(l.firstChild.firstChild);var k=e.createBox(h);try{e.Measured(this.data[1].toHTML(k),k)}catch(j){if(!j.restart){throw j}l.style.display="none";MathJax.Callback.After(["HTMLtooltipPost",this,i,m],j.restart)}e.placeBox(k,0,0);e.createRule(l.firstChild.firstChild,k.bbox.h,k.bbox.d,0);d=this},HTMLtooltipClear:function(i){var h=this.HTMLtooltip;if(i<=0){h.style.display="none";h.style.opacity=h.style.filter="";b=null}else{h.style.opacity=i/100;h.style.filter="alpha(opacity="+i+")";b=setTimeout(MathJax.Callback(["HTMLtooltipClear",this,i-20]),50)}}});MathJax.Hub.Browser.Select({MSIE:function(h){e.msieHitBoxBug=true}});MathJax.Hub.Startup.signal.Post("HTML-CSS maction Ready");MathJax.Ajax.loadComplete(e.autoloadDir+"/maction.js")});
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var g="1.1.4";var c=MathJax.ElementJax.mml,e=MathJax.OutputJax["HTML-CSS"];var d,f,b;var a=e.config.tooltip=MathJax.Hub.Insert({delayPost:600,delayClear:600,offsetX:10,offsetY:5},e.config.tooltip||{});c.maction.Augment({HTMLtooltip:e.addElement(document.body,"div",{id:"MathJax_Tooltip"}),toHTML:function(k,h,m){k=this.HTMLhandleSize(this.HTMLcreateSpan(k));k.bbox=null;var i=this.getValues("actiontype","selection"),n;var j=this.data[i.selection-1];if(j){e.Measured(j.toHTML(k),k);if(m!=null){e.Remeasured(j.HTMLstretchV(k,h,m),k)}else{if(h!=null){e.Remeasured(j.HTMLstretchH(k,h),k)}}if(e.msieHitBoxBug){var l=e.addElement(k,"span",{isMathJax:true});n=e.createFrame(l,k.bbox.h,k.bbox.d,k.bbox.w,0,"none");k.insertBefore(l,k.firstChild);l.style.marginRight=e.Em(-k.bbox.w);if(e.msieInlineBlockAlignBug){n.style.verticalAlign=e.Em(e.getHD(k).d-k.bbox.d)}}else{n=e.createFrame(k,k.bbox.h,k.bbox.d,k.bbox.w,0,"none");k.insertBefore(n,k.firstChild);n.style.marginRight=e.Em(-k.bbox.w)}n.className="MathJax_HitBox";n.id="MathJax-HitBox-"+this.spanID;if(this.HTMLaction[i.actiontype]){this.HTMLaction[i.actiontype].call(this,k,n,i.selection)}}this.HTMLhandleSpace(k);this.HTMLhandleColor(k);return k},HTMLstretchH:c.mbase.HTMLstretchH,HTMLstretchV:c.mbase.HTMLstretchV,HTMLaction:{toggle:function(i,j,h){this.selection=h;j.onclick=i.childNodes[1].onclick=MathJax.Callback(["HTMLclick",this]);j.style.cursor=i.childNodes[1].style.cursor="pointer"},statusline:function(i,j,h){j.onmouseover=i.childNodes[1].onmouseover=MathJax.Callback(["HTMLsetStatus",this]);j.onmouseout=i.childNodes[1].onmouseout=MathJax.Callback(["HTMLclearStatus",this]);j.onmouseover.autoReset=j.onmouseout.autoReset=true},tooltip:function(i,j,h){if(this.data[1]&&this.data[1].isToken){j.title=j.alt=i.childNodes[1].title=i.childNodes[1].alt=this.data[1].data.join("")}else{j.onmouseover=i.childNodes[1].onmouseover=MathJax.Callback(["HTMLtooltipOver",this]);j.onmouseout=i.childNodes[1].onmouseout=MathJax.Callback(["HTMLtooltipOut",this]);j.onmouseover.autoReset=j.onmouseout.autoReset=true}}},HTMLclick:function(l){this.selection++;if(this.selection>this.data.length){this.selection=1}var k=this;while(k.type!=="math"){k=k.inherit}var h=MathJax.Hub.getJaxFor(k.inputID),j=!!h.hover;h.Update();if(j){var i=document.getElementById(h.inputID+"-Span");MathJax.Extension.MathEvents.Hover.Hover(h,i)}return MathJax.Extension.MathEvents.Event.False(l)},HTMLsetStatus:function(h){window.status=((this.data[1]&&this.data[1].isToken)?this.data[1].data.join(""):this.data[1].toString())},HTMLclearStatus:function(h){window.status=""},HTMLtooltipOver:function(i){if(!i){i=window.event}if(b){clearTimeout(b);b=null}if(f){clearTimeout(f)}var h=i.pageX;var k=i.pageY;if(h==null){h=i.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;k=i.clientY+document.body.scrollTop+document.documentElement.scrollTop}var j=MathJax.Callback(["HTMLtooltipPost",this,h+a.offsetX,k+a.offsetY]);f=setTimeout(j,a.delayPost)},HTMLtooltipOut:function(h){if(f){clearTimeout(f);f=null}if(b){clearTimeout(b)}var i=MathJax.Callback(["HTMLtooltipClear",this,80]);b=setTimeout(i,a.delayClear)},HTMLtooltipPost:function(i,m){f=null;if(b){clearTimeout(b);b=null}var l=this.HTMLtooltip;l.style.display="block";l.style.opacity="";l.style.filter=e.config.styles["#MathJax_Tooltip"].filter;if(this===d){return}l.style.left=i+"px";l.style.top=m+"px";l.innerHTML='<span class="MathJax"><nobr></nobr></span>';e.getScales(l.firstChild,l.firstChild);var h=e.createStack(l.firstChild.firstChild);var k=e.createBox(h);try{e.Measured(this.data[1].toHTML(k),k)}catch(j){if(!j.restart){throw j}l.style.display="none";MathJax.Callback.After(["HTMLtooltipPost",this,i,m],j.restart)}e.placeBox(k,0,0);e.createRule(l.firstChild.firstChild,k.bbox.h,k.bbox.d,0);d=this},HTMLtooltipClear:function(i){var h=this.HTMLtooltip;if(i<=0){h.style.display="none";h.style.opacity=h.style.filter="";b=null}else{h.style.opacity=i/100;h.style.filter="alpha(opacity="+i+")";b=setTimeout(MathJax.Callback(["HTMLtooltipClear",this,i-20]),50)}}});MathJax.Hub.Browser.Select({MSIE:function(h){e.msieHitBoxBug=true}});MathJax.Hub.Startup.signal.Post("HTML-CSS maction Ready");MathJax.Ajax.loadComplete(e.autoloadDir+"/maction.js")});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="1.1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mglyph.Augment({toHTML:function(j,f){var i=j,k=this.getValues("src","width","height","valign","alt"),e;j=this.HTMLcreateSpan(j);if(k.src===""){var h=this.Get("index");if(h){f=this.HTMLgetVariant();var d=f.defaultFont;if(d){d.noStyleChar=true;d.testString=String.fromCharCode(h)+"ABCabc";if(b.Font.testFont(d)){this.HTMLhandleVariant(j,f,String.fromCharCode(h))}else{if(k.alt===""){k.alt="Bad font: "+d.family}e=a.merror(k.alt).With({mathsize:"75%"});this.Append(e);e.toHTML(j);this.data.pop();j.bbox=e.HTMLspanElement().bbox}}}}else{if(!this.img){this.img=a.mglyph.GLYPH[k.src]}if(!this.img){this.img=a.mglyph.GLYPH[k.src]={img:new Image(),status:"pending"};var g=this.img.img;g.onload=MathJax.Callback(["HTMLimgLoaded",this]);g.onerror=MathJax.Callback(["HTMLimgError",this]);g.src=k.src;MathJax.Hub.RestartAfter(g.onload)}if(this.img.status!=="OK"){e=a.merror("Bad mglyph: "+k.src).With({mathsize:"75%"});this.Append(e);e.toHTML(j);this.data.pop();j.bbox=e.HTMLspanElement().bbox}else{var l=this.HTMLgetMu(j);g=b.addElement(j,"img",{src:k.src,alt:k.alt,title:k.alt});if(k.width){if(String(k.width).match(/^\s*-?\d+\s*$/)){k.width+="px"}g.style.width=b.Em(b.length2em(k.width,l,this.img.img.width/b.em))}if(k.height){if(String(k.height).match(/^\s*-?\d+\s*$/)){k.height+="px"}g.style.height=b.Em(b.length2em(k.height,l,this.img.img.height/b.em))}j.bbox.w=j.bbox.rw=g.offsetWidth/b.em;j.bbox.h=g.offsetHeight/b.em;if(k.valign){if(String(k.valign).match(/^\s*-?\d+\s*$/)){k.valign+="px"}j.bbox.d=-b.length2em(k.valign,l,this.img.img.height/b.em);g.style.verticalAlign=b.Em(-j.bbox.d);j.bbox.h-=j.bbox.d}}}if(!i.bbox){i.bbox={w:j.bbox.w,h:j.bbox.h,d:j.bbox.d,rw:j.bbox.rw,lw:j.bbox.lw}}else{if(j.bbox){i.bbox.w+=j.bbox.w;if(i.bbox.w>i.bbox.rw){i.bbox.rw=i.bbox.w}if(j.bbox.h>i.bbox.h){i.bbox.h=j.bbox.h}if(j.bbox.d>i.bbox.d){i.bbox.d=j.bbox.d}}}this.HTMLhandleSpace(j);this.HTMLhandleColor(j);return j},HTMLimgLoaded:function(e,d){if(typeof(e)==="string"){d=e}this.img.status=(d||"OK")},HTMLimgError:function(){this.img.img.onload("error")}},{GLYPH:{}});MathJax.Hub.Startup.signal.Post("HTML-CSS mglyph Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/mglyph.js")});
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="1.1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mglyph.Augment({toHTML:function(j,f){var i=j,k=this.getValues("src","width","height","valign","alt"),e;j=this.HTMLcreateSpan(j);if(k.src===""){var h=this.Get("index");if(h){f=this.HTMLgetVariant();var d=f.defaultFont;if(d){d.noStyleChar=true;d.testString=String.fromCharCode(h)+"ABCabc";if(b.Font.testFont(d)){this.HTMLhandleVariant(j,f,String.fromCharCode(h))}else{if(k.alt===""){k.alt="Bad font: "+d.family}e=a.merror(k.alt).With({mathsize:"75%"});this.Append(e);e.toHTML(j);this.data.pop();j.bbox=e.HTMLspanElement().bbox}}}}else{if(!this.img){this.img=a.mglyph.GLYPH[k.src]}if(!this.img){this.img=a.mglyph.GLYPH[k.src]={img:new Image(),status:"pending"};var g=this.img.img;g.onload=MathJax.Callback(["HTMLimgLoaded",this]);g.onerror=MathJax.Callback(["HTMLimgError",this]);g.src=k.src;MathJax.Hub.RestartAfter(g.onload)}if(this.img.status!=="OK"){e=a.merror("Bad mglyph: "+k.src).With({mathsize:"75%"});this.Append(e);e.toHTML(j);this.data.pop();j.bbox=e.HTMLspanElement().bbox}else{var l=this.HTMLgetMu(j);g=b.addElement(j,"img",{isMathJax:true,src:k.src,alt:k.alt,title:k.alt});if(k.width){if(String(k.width).match(/^\s*-?\d+\s*$/)){k.width+="px"}g.style.width=b.Em(b.length2em(k.width,l,this.img.img.width/b.em))}if(k.height){if(String(k.height).match(/^\s*-?\d+\s*$/)){k.height+="px"}g.style.height=b.Em(b.length2em(k.height,l,this.img.img.height/b.em))}j.bbox.w=j.bbox.rw=g.offsetWidth/b.em;j.bbox.h=g.offsetHeight/b.em;if(k.valign){if(String(k.valign).match(/^\s*-?\d+\s*$/)){k.valign+="px"}j.bbox.d=-b.length2em(k.valign,l,this.img.img.height/b.em);g.style.verticalAlign=b.Em(-j.bbox.d);j.bbox.h-=j.bbox.d}}}if(!i.bbox){i.bbox={w:j.bbox.w,h:j.bbox.h,d:j.bbox.d,rw:j.bbox.rw,lw:j.bbox.lw}}else{if(j.bbox){i.bbox.w+=j.bbox.w;if(i.bbox.w>i.bbox.rw){i.bbox.rw=i.bbox.w}if(j.bbox.h>i.bbox.h){i.bbox.h=j.bbox.h}if(j.bbox.d>i.bbox.d){i.bbox.d=j.bbox.d}}}this.HTMLhandleSpace(j);this.HTMLhandleColor(j);return j},HTMLimgLoaded:function(e,d){if(typeof(e)==="string"){d=e}this.img.status=(d||"OK")},HTMLimgError:function(){this.img.img.onload("error")}},{GLYPH:{}});MathJax.Hub.Startup.signal.Post("HTML-CSS mglyph Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/mglyph.js")});
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.OutputJax["HTML-CSS"]=MathJax.OutputJax({id:"HTML-CSS",version:"1.1.12",directory:MathJax.OutputJax.directory+"/HTML-CSS",extensionDir:MathJax.OutputJax.extensionDir+"/HTML-CSS",autoloadDir:MathJax.OutputJax.directory+"/HTML-CSS/autoload",fontDir:MathJax.OutputJax.directory+"/HTML-CSS/fonts",webfontDir:MathJax.OutputJax.fontDir+"/HTML-CSS",config:{scale:100,minScaleAdjust:50,availableFonts:["STIX","TeX"],preferredFont:"TeX",webFont:"TeX",imageFont:"TeX",undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",showMathMenu:true,styles:{".MathJax_Display":{"text-align":"center",margin:"1em 0em"},".MathJax .merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-family":"serif","font-style":"normal","font-size":"90%"},".MathJax_Preview":{color:"#888888"},"#MathJax_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')",padding:"3px 4px"}}}});if(MathJax.Hub.Browser.isMSIE&&document.documentMode>=9){delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter}if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}MathJax.Hub.Register.StartupHook("End Config",[function(b,c){var a=b.Insert({minBrowserVersion:{Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4},inlineMathDelimiters:["$","$"],displayMathDelimiters:["$$","$$"],multilineDisplay:true,minBrowserTranslate:function(f){var e=b.getJaxFor(f),k=["[Math]"],j;var h=document.createElement("span",{className:"MathJax_Preview"});if(e.inputJax.id==="TeX"){if(e.root.Get("displaystyle")){j=a.displayMathDelimiters;k=[j[0]+e.originalText+j[1]];if(a.multilineDisplay){k=k[0].split(/\n/)}}else{j=a.inlineMathDelimiters;k=[j[0]+e.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+j[1]]}}for(var g=0,d=k.length;g<d;g++){h.appendChild(document.createTextNode(k[g]));if(g<d-1){h.appendChild(document.createElement("br"))}}f.parentNode.insertBefore(h,f)}},(b.config["HTML-CSS"]||{}));if(b.Browser.version!=="0.0"&&!b.Browser.versionAtLeast(a.minBrowserVersion[b.Browser]||0)){c.Translate=a.minBrowserTranslate;b.Config({showProcessingMessages:false});MathJax.Message.Set("Your browser does not support MathJax",null,4000);b.Startup.signal.Post("MathJax not supported")}},MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]);MathJax.OutputJax["HTML-CSS"].loadComplete("config.js");
|
||||
MathJax.OutputJax["HTML-CSS"]=MathJax.OutputJax({id:"HTML-CSS",version:"1.1.13",directory:MathJax.OutputJax.directory+"/HTML-CSS",extensionDir:MathJax.OutputJax.extensionDir+"/HTML-CSS",autoloadDir:MathJax.OutputJax.directory+"/HTML-CSS/autoload",fontDir:MathJax.OutputJax.directory+"/HTML-CSS/fonts",webfontDir:MathJax.OutputJax.fontDir+"/HTML-CSS",config:{scale:100,minScaleAdjust:50,availableFonts:["STIX","TeX"],preferredFont:"TeX",webFont:"TeX",imageFont:"TeX",undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",styles:{".MathJax_Display":{"text-align":"center",margin:"1em 0em"},".MathJax .merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-family":"serif","font-style":"normal","font-size":"90%"},".MathJax_Preview":{color:"#888888"},"#MathJax_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')",padding:"3px 4px"}}}});if(MathJax.Hub.Browser.isMSIE&&document.documentMode>=9){delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter}if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}MathJax.Hub.Register.StartupHook("End Config",[function(b,c){var a=b.Insert({minBrowserVersion:{Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4},inlineMathDelimiters:["$","$"],displayMathDelimiters:["$$","$$"],multilineDisplay:true,minBrowserTranslate:function(f){var e=b.getJaxFor(f),k=["[Math]"],j;var h=document.createElement("span",{className:"MathJax_Preview"});if(e.inputJax.id==="TeX"){if(e.root.Get("displaystyle")){j=a.displayMathDelimiters;k=[j[0]+e.originalText+j[1]];if(a.multilineDisplay){k=k[0].split(/\n/)}}else{j=a.inlineMathDelimiters;k=[j[0]+e.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+j[1]]}}for(var g=0,d=k.length;g<d;g++){h.appendChild(document.createTextNode(k[g]));if(g<d-1){h.appendChild(document.createElement("br"))}}f.parentNode.insertBefore(h,f)}},(b.config["HTML-CSS"]||{}));if(b.Browser.version!=="0.0"&&!b.Browser.versionAtLeast(a.minBrowserVersion[b.Browser]||0)){c.Translate=a.minBrowserTranslate;b.Config({showProcessingMessages:false});MathJax.Message.Set("Your browser does not support MathJax",null,4000);b.Startup.signal.Post("MathJax not supported")}},MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]);MathJax.OutputJax["HTML-CSS"].loadComplete("config.js");
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(b,c,a){var d="1.1";b.Register.LoadHook(c.fontDir+"/fontdata.js",function(){c.Augment({allowWebFonts:false,imgDir:c.webfontDir+"/png",imgPacked:(MathJax.isPacked?"":"/unpacked"),imgSize:["050","060","071","085",100,120,141,168,200,238,283,336,400,476],imgBaseIndex:4,imgSizeForEm:{},imgSizeForScale:{},imgZoom:1,handleImg:function(t,i,r,h,u){if(u.length){this.addText(t,u)}var s=r[5].orig;if(!s){s=r[5].orig=[r[0],r[1],r[2],r[3],r[4]]}var m=this.imgZoom;if(!t.scale){t.scale=1}var p=this.imgIndex(t.scale*m);if(p==this.imgEmWidth.length-1&&this.em*t.scale*m/this.imgEmWidth[p]>1.1){m=this.imgEmWidth[p]/(this.em*t.scale)}var q=this.imgEmWidth[p]/(this.em*(t.scale||1)*m);r[0]=s[0]*q;r[1]=s[1]*q;r[2]=s[2]*q;r[3]=s[3]*q;r[4]=s[4]*q;var k=this.imgDir+"/"+i.directory+"/"+this.imgSize[p];var l=h.toString(16).toUpperCase();while(l.length<4){l="0"+l}var j=k+"/"+l+".png";var o=r[5].img[p];var g={width:Math.floor(o[0]/m+0.5)+"px",height:Math.floor(o[1]/m+0.5)+"px"};if(o[2]){g.verticalAlign=Math.floor(-o[2]/m+0.5)+"px"}if(r[3]<0){g.marginLeft=this.Em(r[3]/1000)}if(r[4]!=r[2]){g.marginRight=this.Em((r[2]-r[4])/1000)}if(this.msieIE6){g.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.fileURL(j)+"', sizingMethod='scale')";j=this.directory+"/blank.gif"}this.addElement(t,"img",{src:a.fileURL(j),style:g});return""},defineImageData:function(i){for(var g in i){if(i.hasOwnProperty(g)){var h=c.FONTDATA.FONTS[g];if(h){g=i[g];for(var j in g){if(g.hasOwnProperty(j)&&h[j]){h[j][5]={img:g[j]}}}}}}},initImg:function(j){if(this.imgSizeForEm[this.em]){this.imgBaseIndex=this.imgSizeForEm[this.em]}for(var h=0,g=this.imgEmWidth.length-1;h<g;h++){if(this.em<=this.imgEmWidth[h]){break}}if(h&&this.imgEmWidth[h]-this.em>this.em-this.imgEmWidth[h-1]){h--}this.imgSizeForEm[this.em]=this.imgBaseIndex=h;this.imgZoom=this.imgBrowserZoom()},imgIndex:function(k){if(!k){return this.imgBaseIndex}if(!this.imgSizeForScale[this.em]){this.imgSizeForScale[this.em]={}}if(this.imgSizeForScale[this.em][k]){return this.imgSizeForScale[this.em][k]}var j=this.em*k;for(var h=0,g=this.imgEmWidth.length-1;h<g;h++){if(j<=this.imgEmWidth[h]){break}}if(h&&this.imgEmWidth[h]-j>j-this.imgEmWidth[h-1]){h--}this.imgSizeForScale[this.em][k]=h;return h},imgBrowserZoom:function(){return 1}});b.Browser.Select({Firefox:function(h){var g=c.addElement(document.body,"div",{style:{display:"none",visibility:"hidden",overflow:"scroll",position:"absolute",top:0,left:0,width:"200px",height:"200px",padding:0,border:0,margin:0}});var i=c.addElement(g,"div",{style:{position:"absolute",left:0,top:0,right:0,bottom:0,padding:0,border:0,margin:0}});c.Augment({imgSpaceBug:true,imgSpace:String.fromCharCode(160),imgZoomLevel:(h.isMac?{50:0.3,30:0.5,22:0.67,19:0.8,16:0.9,15:1,13:1.1,12:1.2,11:1.33,10:1.5,9:1.7,7:2,6:2.4,5:3,0:15}:{56:0.3,34:0.5,25:0.67,21:0.8,19:0.9,17:1,15:1.1,14:1.2,13:1.33,11:1.5,10:1.7,8:2,7:2.4,6:3,0:17}),imgZoomDiv:g,imgBrowserZoom:function(){var j=this.imgZoomLevel;g.style.display="";var k=(g.offsetWidth-i.offsetWidth);k=(j[k]?j[k]:j[0]/k);g.style.display="none";return k}})},Safari:function(g){c.Augment({imgBrowserZoom:function(){return 3}})},Chrome:function(g){c.Augment({imgHeightBug:true,imgBrowserZoom:function(){return 3}})},Opera:function(g){c.Augment({imgSpaceBug:true,imgSpace:String.fromCharCode(160)+String.fromCharCode(160),imgDoc:(document.compatMode=="BackCompat"?document.body:document.documentElement),imgBrowserZoom:function(){if(g.isMac){return 3}var h=this.imgDoc.clientHeight,i=Math.floor(15*h/window.innerHeight);if(this.imgDoc.clientWidth<this.imgDoc.scrollWidth-i){h+=i}return parseFloat((window.innerHeight/h).toFixed(1))}})}});var f=function(){var h=c.FONTDATA.FONTS.MathJax_Main[8212][5].img;c.imgEmWidth=[];for(var j=0,g=h.length;j<g;j++){c.imgEmWidth[j]=h[j][0]}};var e=c.imgDir+c.imgPacked;MathJax.Callback.Queue(["Require",a,e+"/imagedata.js"],f,["loadComplete",a,c.directory+"/imageFonts.js"])})})(MathJax.Hub,MathJax.OutputJax["HTML-CSS"],MathJax.Ajax);
|
||||
(function(b,c,a){var d="1.1.1";b.Register.LoadHook(c.fontDir+"/fontdata.js",function(){c.Augment({allowWebFonts:false,imgDir:c.webfontDir+"/png",imgPacked:(MathJax.isPacked?"":"/unpacked"),imgSize:["050","060","071","085",100,120,141,168,200,238,283,336,400,476],imgBaseIndex:4,imgSizeForEm:{},imgSizeForScale:{},imgZoom:1,handleImg:function(t,i,r,h,u){if(u.length){this.addText(t,u)}var s=r[5].orig;if(!s){s=r[5].orig=[r[0],r[1],r[2],r[3],r[4]]}var m=this.imgZoom;if(!t.scale){t.scale=1}var p=this.imgIndex(t.scale*m);if(p==this.imgEmWidth.length-1&&this.em*t.scale*m/this.imgEmWidth[p]>1.1){m=this.imgEmWidth[p]/(this.em*t.scale)}var q=this.imgEmWidth[p]/(this.em*(t.scale||1)*m);r[0]=s[0]*q;r[1]=s[1]*q;r[2]=s[2]*q;r[3]=s[3]*q;r[4]=s[4]*q;var k=this.imgDir+"/"+i.directory+"/"+this.imgSize[p];var l=h.toString(16).toUpperCase();while(l.length<4){l="0"+l}var j=k+"/"+l+".png";var o=r[5].img[p];var g={width:Math.floor(o[0]/m+0.5)+"px",height:Math.floor(o[1]/m+0.5)+"px"};if(o[2]){g.verticalAlign=Math.floor(-o[2]/m+0.5)+"px"}if(r[3]<0){g.marginLeft=this.Em(r[3]/1000)}if(r[4]!=r[2]){g.marginRight=this.Em((r[2]-r[4])/1000)}if(this.msieIE6){g.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.fileURL(j)+"', sizingMethod='scale')";j=this.directory+"/blank.gif"}this.addElement(t,"img",{src:a.fileURL(j),style:g,isMathJax:true});return""},defineImageData:function(i){for(var g in i){if(i.hasOwnProperty(g)){var h=c.FONTDATA.FONTS[g];if(h){g=i[g];for(var j in g){if(g.hasOwnProperty(j)&&h[j]){h[j][5]={img:g[j]}}}}}}},initImg:function(j){if(this.imgSizeForEm[this.em]){this.imgBaseIndex=this.imgSizeForEm[this.em]}for(var h=0,g=this.imgEmWidth.length-1;h<g;h++){if(this.em<=this.imgEmWidth[h]){break}}if(h&&this.imgEmWidth[h]-this.em>this.em-this.imgEmWidth[h-1]){h--}this.imgSizeForEm[this.em]=this.imgBaseIndex=h;this.imgZoom=this.imgBrowserZoom()},imgIndex:function(k){if(!k){return this.imgBaseIndex}if(!this.imgSizeForScale[this.em]){this.imgSizeForScale[this.em]={}}if(this.imgSizeForScale[this.em][k]){return this.imgSizeForScale[this.em][k]}var j=this.em*k;for(var h=0,g=this.imgEmWidth.length-1;h<g;h++){if(j<=this.imgEmWidth[h]){break}}if(h&&this.imgEmWidth[h]-j>j-this.imgEmWidth[h-1]){h--}this.imgSizeForScale[this.em][k]=h;return h},imgBrowserZoom:function(){return 1}});b.Browser.Select({Firefox:function(h){var g=c.addElement(document.body,"div",{style:{display:"none",visibility:"hidden",overflow:"scroll",position:"absolute",top:0,left:0,width:"200px",height:"200px",padding:0,border:0,margin:0}});var i=c.addElement(g,"div",{style:{position:"absolute",left:0,top:0,right:0,bottom:0,padding:0,border:0,margin:0}});c.Augment({imgSpaceBug:true,imgSpace:String.fromCharCode(160),imgZoomLevel:(h.isMac?{50:0.3,30:0.5,22:0.67,19:0.8,16:0.9,15:1,13:1.1,12:1.2,11:1.33,10:1.5,9:1.7,7:2,6:2.4,5:3,0:15}:{56:0.3,34:0.5,25:0.67,21:0.8,19:0.9,17:1,15:1.1,14:1.2,13:1.33,11:1.5,10:1.7,8:2,7:2.4,6:3,0:17}),imgZoomDiv:g,imgBrowserZoom:function(){var j=this.imgZoomLevel;g.style.display="";var k=(g.offsetWidth-i.offsetWidth);k=(j[k]?j[k]:j[0]/k);g.style.display="none";return k}})},Safari:function(g){c.Augment({imgBrowserZoom:function(){return 3}})},Chrome:function(g){c.Augment({imgHeightBug:true,imgBrowserZoom:function(){return 3}})},Opera:function(g){c.Augment({imgSpaceBug:true,imgSpace:String.fromCharCode(160)+String.fromCharCode(160),imgDoc:(document.compatMode=="BackCompat"?document.body:document.documentElement),imgBrowserZoom:function(){if(g.isMac){return 3}var h=this.imgDoc.clientHeight,i=Math.floor(15*h/window.innerHeight);if(this.imgDoc.clientWidth<this.imgDoc.scrollWidth-i){h+=i}return parseFloat((window.innerHeight/h).toFixed(1))}})}});var f=function(){var h=c.FONTDATA.FONTS.MathJax_Main[8212][5].img;c.imgEmWidth=[];for(var j=0,g=h.length;j<g;j++){c.imgEmWidth[j]=h[j][0]}};var e=c.imgDir+c.imgPacked;MathJax.Callback.Queue(["Require",a,e+"/imagedata.js"],f,["loadComplete",a,c.directory+"/imageFonts.js"])})})(MathJax.Hub,MathJax.OutputJax["HTML-CSS"],MathJax.Ajax);
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.OutputJax.NativeMML=MathJax.OutputJax({id:"NativeMML",version:"1.1.6",directory:MathJax.OutputJax.directory+"/NativeMML",extensionDir:MathJax.OutputJax.extensionDir+"/NativeMML",config:{scale:100,showMathMenu:true,showMathMenuMSIE:true,styles:{"DIV.MathJax_MathML":{"text-align":"center",margin:".75em 0px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.NativeMML.Register("jax/mml")}MathJax.OutputJax.NativeMML.loadComplete("config.js");
|
||||
MathJax.OutputJax.NativeMML=MathJax.OutputJax({id:"NativeMML",version:"1.1.9",directory:MathJax.OutputJax.directory+"/NativeMML",extensionDir:MathJax.OutputJax.extensionDir+"/NativeMML",config:{scale:100,styles:{"DIV.MathJax_MathML":{"text-align":"center",margin:".75em 0px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.NativeMML.Register("jax/mml")}MathJax.OutputJax.NativeMML.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@ if (!window.MathJax) {window.MathJax= {}}
|
|||
if (!MathJax.Hub) { // skip if already loaded
|
||||
|
||||
MathJax.version = "1.1a";
|
||||
MathJax.fileversion = "1.1.12";
|
||||
MathJax.fileversion = "1.1.13";
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
|
@ -989,15 +989,17 @@ MathJax.HTML = {
|
|||
match = keys[i].match(/([^:]+):(.*)/);
|
||||
var value = match[2].replace(/&&/g,'&');
|
||||
if (value === "true") {value = true} else if (value === "false") {value = false}
|
||||
else if (value.match(/^-?(\d+(\.\d+)?|\.\d+)$/)) {value = parseFloat(value)}
|
||||
else if (value.match(/^-?(\d+(\.\d+)?|\.\d+)$/)) {value = parseFloat(value)}
|
||||
obj[match[1]] = value;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
MathJax.Message = {
|
||||
|
@ -1189,17 +1191,21 @@ MathJax.Hub = {
|
|||
"v1.0-compatible": true, // set to false to prevent loading of default configuration file
|
||||
elements: [], // array of elements to process when none is given explicitly
|
||||
|
||||
showMathMenu: true, // attach math context menu to mathml?
|
||||
showMathMenuMSIE: true, // separtely determine if MSIE should have math menu
|
||||
// (since the code for that is a bit delicate)
|
||||
|
||||
preProcessors: [], // list of callbacks for preprocessing (initialized by extensions)
|
||||
inputJax: {}, // mime-type mapped to input jax (by registration)
|
||||
outputJax: {order:{}}, // mime-type mapped to output jax list (by registration)
|
||||
|
||||
menuSettings: {
|
||||
//format: "MathML", // the Show Source format (set in MathMenu.js)
|
||||
zoom: "None", // when to do MathZoom
|
||||
CTRL: false, // require CTRL for MathZoom?
|
||||
ALT: false, // require Alt or Option?
|
||||
CMD: false, // require CMD?
|
||||
Shift: false, // require Shift?
|
||||
discoverable: false, // make math menu discoverable on hover?
|
||||
zscale: "200%", // the scaling factor for MathZoom
|
||||
renderer: "", // set when Jax are loaded
|
||||
font: "Auto", // what font HTML-CSS should use
|
||||
|
@ -1364,8 +1370,12 @@ MathJax.Hub = {
|
|||
for (var i = 0, m = scripts.length; i < m; i++) {
|
||||
var script = scripts[i];
|
||||
if (script.type && this.config.inputJax[script.type.replace(/ *;(.|\n)*/,"")]) {
|
||||
if (script.MathJax && script.MathJax.state !== STATE.PENDING)
|
||||
{this.scriptAction[action](script)}
|
||||
if (script.MathJax) {
|
||||
if (script.MathJax.elementJax && script.MathJax.elementJax.hover) {
|
||||
MathJax.Extension.MathEvents.Hover.ClearHover(script.MathJax.elementJax);
|
||||
}
|
||||
if (script.MathJax.state !== STATE.PENDING) {this.scriptAction[action](script)}
|
||||
}
|
||||
if (!script.MathJax) {script.MathJax = {state: STATE.PENDING}}
|
||||
if (script.MathJax.state !== STATE.PROCESSED) {math.push(script)}
|
||||
}
|
||||
|
@ -1858,7 +1868,7 @@ MathJax.Hub.Startup = {
|
|||
}
|
||||
},{
|
||||
id: "InputJax",
|
||||
version: "1.1",
|
||||
version: "1.1.1",
|
||||
directory: JAX.directory+"/input",
|
||||
extensionDir: JAX.extensionDir
|
||||
});
|
||||
|
@ -1881,10 +1891,11 @@ MathJax.Hub.Startup = {
|
|||
Remove: function (jax) {}
|
||||
},{
|
||||
id: "OutputJax",
|
||||
version: "1.1",
|
||||
version: "1.1.1",
|
||||
directory: JAX.directory+"/output",
|
||||
extensionDir: JAX.extensionDir,
|
||||
fontDir: ROOT+(BASE.isPacked?"":"/..")+"/fonts"
|
||||
fontDir: ROOT+(BASE.isPacked?"":"/..")+"/fonts",
|
||||
imageDir: ROOT+(BASE.isPacked?"":"/..")+"/images"
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
|
@ -1916,6 +1927,7 @@ MathJax.Hub.Startup = {
|
|||
return HUB.Process(script,callback);
|
||||
},
|
||||
Remove: function () {
|
||||
if (this.hover) {this.hover.clear(this)}
|
||||
this.outputJax.Remove(this);
|
||||
HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish?
|
||||
this.Detach();
|
||||
|
@ -1955,7 +1967,7 @@ MathJax.Hub.Startup = {
|
|||
}
|
||||
},{
|
||||
id: "ElementJax",
|
||||
version: "1.1",
|
||||
version: "1.1.1",
|
||||
directory: JAX.directory+"/element",
|
||||
extensionDir: JAX.extensionDir,
|
||||
ID: 0, // jax counter (for IDs)
|
||||
|
@ -2061,6 +2073,8 @@ MathJax.Hub.Startup = {
|
|||
else if (v > 500) {browser.version = "3.0"}
|
||||
else if (v > 400) {browser.version = "2.0"}
|
||||
else if (v > 85) {browser.version = "1.0"}
|
||||
browser.isMobile = (navigator.appVersion.match(/Mobile/i) != null);
|
||||
browser.noContextMenu = browser.isMobile;
|
||||
},
|
||||
Firefox: function (browser) {
|
||||
if (browser.version === "0.0" && navigator.product === "Gecko" && navigator.productSub) {
|
||||
|
@ -2069,6 +2083,8 @@ MathJax.Hub.Startup = {
|
|||
else if (date >= "20080617") {browser.version = "3.0"}
|
||||
else if (date >= "20061024") {browser.version = "2.0"}
|
||||
}
|
||||
browser.isMobile = (navigator.appVersion.match(/Android/i) != null ||
|
||||
navigator.userAgent.match(/ Fennec\//) != null);
|
||||
},
|
||||
Opera: function (browser) {browser.version = opera.version()},
|
||||
MSIE: function (browser) {
|
||||
|
|
525
unpacked/extensions/MathEvents.js
Normal file
525
unpacked/extensions/MathEvents.js
Normal file
|
@ -0,0 +1,525 @@
|
|||
/*************************************************************
|
||||
*
|
||||
* MathJax/extensions/MathEvents.js
|
||||
*
|
||||
* Implements the event handlers needed by the output jax to perform
|
||||
* menu, hover, and other events.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2011 Design Science, Inc.
|
||||
*
|
||||
* 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 (HUB,HTML,AJAX,CALLBACK,OUTPUT,INPUT) {
|
||||
var VERSION = "1.1";
|
||||
|
||||
var EXTENSION = MathJax.Extension;
|
||||
var ME = EXTENSION.MathEvents = {version: VERSION};
|
||||
|
||||
var SETTINGS = HUB.config.menuSettings;
|
||||
|
||||
var CONFIG = {
|
||||
hover: 500, // time required to be considered a hover
|
||||
frame: {
|
||||
x: 3.5, y: 5, // frame padding and
|
||||
bwidth: 1, // frame border width (in pixels)
|
||||
bcolor: "#A6D", // frame border color
|
||||
hwidth: "15px", // haze width
|
||||
hcolor: "#83A" // haze color
|
||||
},
|
||||
button: {
|
||||
x: -4, y: -3, // menu button offsets
|
||||
wx: -2, // button offset for full-width equations
|
||||
src: AJAX.fileURL(OUTPUT.imageDir+"/MenuArrow-15.png") // button image
|
||||
},
|
||||
fadeinInc: .2, // increment for fade-in
|
||||
fadeoutInc: .05, // increment for fade-out
|
||||
fadeDelay: 50, // delay between fade-in or fade-out steps
|
||||
fadeoutStart: 400, // delay before fade-out after mouseout
|
||||
fadeoutDelay: 15*1000, // delay before automatic fade-out
|
||||
|
||||
styles: {
|
||||
".MathJax_Hover_Frame": {
|
||||
"border-radius": ".25em", // Opera 10.5 and IE9
|
||||
"-webkit-border-radius": ".25em", // Safari and Chrome
|
||||
"-moz-border-radius": ".25em", // Firefox
|
||||
"-khtml-border-radius": ".25em", // Konqueror
|
||||
|
||||
"box-shadow": "0px 0px 15px #83A", // Opera 10.5 and IE9
|
||||
"-webkit-box-shadow": "0px 0px 15px #83A", // Safari and Chrome
|
||||
"-moz-box-shadow": "0px 0px 15px #83A", // Forefox
|
||||
"-khtml-box-shadow": "0px 0px 15px #83A", // Konqueror
|
||||
|
||||
border: "1px solid #A6D ! important",
|
||||
display: "inline-block", position:"absolute"
|
||||
},
|
||||
|
||||
".MathJax_Hover_Arrow": {
|
||||
position:"absolute",
|
||||
width:"15px", height:"11px",
|
||||
cursor:"pointer"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Common event-handling code
|
||||
//
|
||||
var EVENT = ME.Event = {
|
||||
|
||||
LEFTBUTTON: 0, // the event.button value for left button
|
||||
RIGHTBUTTON: 2, // the event.button value for right button
|
||||
MENUKEY: "altKey", // the event value for alternate context menu
|
||||
|
||||
Mousedown: function (event) {return EVENT.Handler(event,"Mousedown",this)},
|
||||
Mouseup: function (event) {return EVENT.Handler(event,"Mouseup",this)},
|
||||
Mousemove: function (event) {return EVENT.Handler(event,"Mousemove",this)},
|
||||
Mouseover: function (event) {return EVENT.Handler(event,"Mouseover",this)},
|
||||
Mouseout: function (event) {return EVENT.Handler(event,"Mouseout",this)},
|
||||
Click: function (event) {return EVENT.Handler(event,"Click",this)},
|
||||
DblClick: function (event) {return EVENT.Handler(event,"DblClick",this)},
|
||||
Menu: function (event) {return EVENT.Handler(event,"ContextMenu",this)},
|
||||
|
||||
//
|
||||
// Call the output jax's event handler or the zoom handler
|
||||
//
|
||||
Handler: function (event,type,math) {
|
||||
if (AJAX.loadingMathMenu) {return False(event)}
|
||||
var jax = OUTPUT[math.jaxID];
|
||||
if (!event) {event = window.event}
|
||||
event.isContextMenu = (type === "ContextMenu");
|
||||
if (jax[type]) {return jax[type](event,math)}
|
||||
if (EXTENSION.MathZoom) {return EXTENSION.MathZoom.HandleEvent(event,type,math)}
|
||||
},
|
||||
|
||||
//
|
||||
// Try to cancel the event in every way we can
|
||||
//
|
||||
False: function (event) {
|
||||
if (!event) {event = window.event}
|
||||
if (event) {
|
||||
if (event.preventDefault) {event.preventDefault()}
|
||||
if (event.stopPropagation) {event.stopPropagation()}
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
//
|
||||
// Load the contextual menu code, if needed, and post the menu
|
||||
//
|
||||
ContextMenu: function (event,math,force) {
|
||||
//
|
||||
// Check if we are showing menus
|
||||
//
|
||||
var JAX = OUTPUT[math.jaxID], jax = JAX.getJaxFromMath(math);
|
||||
var show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu;
|
||||
if (!show || (SETTINGS.context !== "MathJax" && !force)) return;
|
||||
|
||||
//
|
||||
// Remove selections, remove hover fades
|
||||
//
|
||||
if (ME.msieEventBug) {event = window.event}
|
||||
EVENT.ClearSelection(); HOVER.ClearHoverTimer();
|
||||
if (jax.hover) {
|
||||
if (jax.hover.remove) {clearTimeout(jax.hover.remove); delete jax.hover.remove}
|
||||
jax.hover.nofade = true;
|
||||
}
|
||||
|
||||
//
|
||||
// If the menu code is loaded, post the menu
|
||||
// Otherwse lad the menu code and try again
|
||||
//
|
||||
var MENU = MathJax.Menu;
|
||||
if (MENU) {
|
||||
MENU.jax = jax;
|
||||
MENU.menu.Find("Show Math As").menu.items[1].name =
|
||||
(INPUT[jax.inputJax.id].sourceMenuTitle||"Original Form");
|
||||
return MENU.menu.Post(event);
|
||||
} else {
|
||||
if (!AJAX.loadingMathMenu) {
|
||||
AJAX.loadingMathMenu = true;
|
||||
var ev = {
|
||||
pageX:event.pageX, pageY:event.pageY,
|
||||
clientX:event.clientX, clientY:event.clientY
|
||||
};
|
||||
CALLBACK.Queue(
|
||||
AJAX.Require("[MathJax]/extensions/MathMenu.js"),
|
||||
function () {delete AJAX.loadingMathMenu; if (!MathJax.Menu) {MathJax.Menu = {}}},
|
||||
["ContextMenu",this,ev,math,force] // call this function again
|
||||
);
|
||||
}
|
||||
return EVENT.False(event);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// Mousedown handler for alternate means of accessing menu
|
||||
//
|
||||
AltContextMenu: function (event,math) {
|
||||
var JAX = OUTPUT[math.jaxID];
|
||||
var show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu;
|
||||
if (show) {
|
||||
if (SETTINGS.context === "MathJax") {
|
||||
if (!ME.noContextMenuBug || event.button !== EVENT.RIGHTBUTTON) return;
|
||||
} else {
|
||||
if (!event[EVENT.MENUKEY] || event.button !== EVENT.LEFTBUTTON) return;
|
||||
}
|
||||
return JAX.ContextMenu(event,math,true);
|
||||
}
|
||||
},
|
||||
|
||||
ClearSelection: function () {
|
||||
if (ME.safariContextMenuBug) {setTimeout("window.getSelection().empty()",0)}
|
||||
if (document.selection) {setTimeout("document.selection.empty()",0)}
|
||||
},
|
||||
|
||||
getBBox: function (span) {
|
||||
span.appendChild(ME.topImg);
|
||||
var h = ME.topImg.offsetTop, d = span.offsetHeight-h, w = span.offsetWidth;
|
||||
span.removeChild(ME.topImg);
|
||||
return {w:w, h:h, d:d};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// Handle hover "discoverability"
|
||||
//
|
||||
var HOVER = ME.Hover = {
|
||||
|
||||
//
|
||||
// Check if we are moving from a non-MathJax element to a MathJax one
|
||||
// and either start fading in again (if it is fading out) or start the
|
||||
// timer for the hover
|
||||
//
|
||||
Mouseover: function (event,math) {
|
||||
if (SETTINGS.discoverable) {
|
||||
var from = event.fromElement || event.relatedTarget,
|
||||
to = event.toElement || event.target;
|
||||
if (from && to && from.isMathJax != to.isMathJax) {
|
||||
var jax = this.getJaxFromMath(math);
|
||||
if (jax.hover) {HOVER.ReHover(jax)} else {HOVER.HoverTimer(jax,math)}
|
||||
return EVENT.False(event);
|
||||
}
|
||||
}
|
||||
},
|
||||
//
|
||||
// Check if we are moving from a MathJax element to a non-MathJax one
|
||||
// and either start fading out, or clear the timer if we haven't
|
||||
// hovered yet
|
||||
//
|
||||
Mouseout: function (event,math) {
|
||||
if (SETTINGS.discoverable) {
|
||||
var from = event.fromElement || event.relatedTarget,
|
||||
to = event.toElement || event.target;
|
||||
if (from && to && from.isMathJax != to.isMathJax) {
|
||||
var jax = this.getJaxFromMath(math);
|
||||
if (jax.hover) {HOVER.UnHover(jax)} else {HOVER.ClearHoverTimer()}
|
||||
return EVENT.False(event);
|
||||
}
|
||||
}
|
||||
},
|
||||
//
|
||||
// Restart hover timer if the mouse moves
|
||||
//
|
||||
Mousemove: function (event,math) {
|
||||
if (SETTINGS.discoverable) {
|
||||
var jax = this.getJaxFromMath(math); if (jax.hover) return;
|
||||
if (HOVER.lastX == event.clientX && HOVER.lastY == event.clientY) return;
|
||||
HOVER.lastX = event.clientX; HOVER.lastY = event.clientY;
|
||||
HOVER.HoverTimer(jax,math);
|
||||
return EVENT.False(event);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// Clear the old timer and start a new one
|
||||
//
|
||||
HoverTimer: function (jax,math) {
|
||||
this.ClearHoverTimer();
|
||||
this.hoverTimer = setTimeout(CALLBACK(["Hover",this,jax,math]),CONFIG.hover);
|
||||
},
|
||||
ClearHoverTimer: function () {
|
||||
if (this.hoverTimer) {clearTimeout(this.hoverTimer); delete this.hoverTimer}
|
||||
},
|
||||
|
||||
//
|
||||
// Handle putting up the hover frame
|
||||
//
|
||||
Hover: function (jax,math) {
|
||||
//
|
||||
// Check if Zoom handles the hover event
|
||||
//
|
||||
if (EXTENSION.MathZoom && EXTENSION.MathZoom.Hover({},math)) return;
|
||||
//
|
||||
// Get the hover data
|
||||
//
|
||||
var JAX = jax.outputJax,
|
||||
span = JAX.getHoverSpan(jax,math),
|
||||
bbox = JAX.getHoverBBox(jax,span,math),
|
||||
show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu;
|
||||
var dx = CONFIG.frame.x, dy = CONFIG.frame.y, dd = CONFIG.frame.bwidth; // frame size
|
||||
if (ME.msieBorderWidthBug) {dd = 0}
|
||||
jax.hover = {opacity:0, id:jax.inputID+"-Hover"};
|
||||
//
|
||||
// The frame and menu button
|
||||
//
|
||||
var frame = HTML.Element("span",{
|
||||
id:jax.hover.id, isMathJax: true,
|
||||
style:{display:"inline-block", width:0, height:0, position:"relative"}
|
||||
},[["span",{
|
||||
className:"MathJax_Hover_Frame", isMathJax: true,
|
||||
style:{
|
||||
display:"inline-block", position:"absolute",
|
||||
top:this.Px(-bbox.h-dy-dd-(bbox.y||0)), left:this.Px(-dx-dd+(bbox.x||0)),
|
||||
width:this.Px(bbox.w+2*dx), height:this.Px(bbox.h+bbox.d+2*dy),
|
||||
opacity:0, filter:"alpha(opacity=0)"
|
||||
}}
|
||||
]]
|
||||
);
|
||||
var button = HTML.Element("span",{
|
||||
isMathJax: true, id:jax.hover.id+"Menu",
|
||||
style:{display:"inline-block", "z-index": 1, width:0, height:0, position:"relative"}
|
||||
},[["img",{
|
||||
className: "MathJax_Hover_Arrow", isMathJax: true, math: math,
|
||||
src: CONFIG.button.src, onclick: this.HoverMenu, jax:JAX.id,
|
||||
style: {
|
||||
left:this.Px(bbox.w+dx+dd+(bbox.x||0)+CONFIG.button.x),
|
||||
top:this.Px(-bbox.h-dy-dd-(bbox.y||0)-CONFIG.button.y),
|
||||
opacity:0, filter:"alpha(opacity=0)"
|
||||
}
|
||||
}]]
|
||||
);
|
||||
if (bbox.width) {
|
||||
frame.style.width = button.style.width = bbox.width;
|
||||
frame.style.marginRight = button.style.marginRight = "-"+bbox.width;
|
||||
frame.firstChild.style.width = bbox.width;
|
||||
button.firstChild.style.left = "";
|
||||
button.firstChild.style.right = this.Px(CONFIG.button.wx);
|
||||
}
|
||||
//
|
||||
// Add the frame and button
|
||||
//
|
||||
span.parentNode.insertBefore(frame,span);
|
||||
if (show) {span.parentNode.insertBefore(button,span)}
|
||||
if (span.style) {span.style.position = "relative"} // so math is on top of hover frame
|
||||
//
|
||||
// Start the hover fade-in
|
||||
//
|
||||
this.ReHover(jax);
|
||||
},
|
||||
//
|
||||
// Restart the hover fade in and fade-out timers
|
||||
//
|
||||
ReHover: function (jax) {
|
||||
if (jax.hover.remove) {clearTimeout(jax.hover.remove)}
|
||||
jax.hover.remove = setTimeout(CALLBACK(["UnHover",this,jax]),CONFIG.fadeoutDelay);
|
||||
this.HoverFadeTimer(jax,CONFIG.fadeinInc);
|
||||
},
|
||||
//
|
||||
// Start the fade-out
|
||||
//
|
||||
UnHover: function (jax) {
|
||||
if (!jax.hover.nofade) {this.HoverFadeTimer(jax,-CONFIG.fadeoutInc,CONFIG.fadeoutStart)}
|
||||
},
|
||||
//
|
||||
// Handle the fade-in and fade-out
|
||||
//
|
||||
HoverFade: function (jax) {
|
||||
delete jax.hover.timer;
|
||||
jax.hover.opacity = Math.max(0,Math.min(1,jax.hover.opacity + jax.hover.inc));
|
||||
jax.hover.opacity = Math.floor(1000*jax.hover.opacity)/1000;
|
||||
var frame = document.getElementById(jax.hover.id),
|
||||
button = document.getElementById(jax.hover.id+"Menu");
|
||||
frame.firstChild.style.opacity = jax.hover.opacity;
|
||||
frame.firstChild.style.filter = "alpha(opacity="+Math.floor(100*jax.hover.opacity)+")";
|
||||
if (button) {
|
||||
button.firstChild.style.opacity = jax.hover.opacity;
|
||||
button.firstChild.style.filter = frame.style.filter;
|
||||
}
|
||||
if (jax.hover.opacity === 1) {return}
|
||||
if (jax.hover.opacity > 0) {this.HoverFadeTimer(jax,jax.hover.inc); return}
|
||||
frame.parentNode.removeChild(frame);
|
||||
if (button) {button.parentNode.removeChild(button)}
|
||||
if (jax.hover.remove) {clearTimeout(jax.hover.remove)}
|
||||
delete jax.hover;
|
||||
},
|
||||
//
|
||||
// Set the fade to in or out (via inc) and start the timer, if needed
|
||||
//
|
||||
HoverFadeTimer: function (jax,inc,delay) {
|
||||
jax.hover.inc = inc;
|
||||
if (!jax.hover.timer) {
|
||||
jax.hover.timer = setTimeout(CALLBACK(["HoverFade",this,jax]),(delay||CONFIG.fadeDelay));
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// Handle a click on the menu button
|
||||
//
|
||||
HoverMenu: function (event) {
|
||||
if (!event) {event = window.event}
|
||||
return OUTPUT[this.jax].ContextMenu(event,this.math,true);
|
||||
},
|
||||
|
||||
//
|
||||
// Clear all hover timers
|
||||
//
|
||||
ClearHover: function (jax) {
|
||||
if (jax.hover.remove) {clearTimeout(jax.hover.remove)}
|
||||
if (jax.hover.timer) {clearTimeout(jax.hover.timer)}
|
||||
HOVER.ClearHoverTimer();
|
||||
delete jax.hover;
|
||||
},
|
||||
|
||||
//
|
||||
// Make a measurement in pixels
|
||||
//
|
||||
Px: function (m) {
|
||||
if (Math.abs(m) < .006) {return "0px"}
|
||||
return m.toFixed(2).replace(/\.?0+$/,"") + "px";
|
||||
},
|
||||
|
||||
//
|
||||
// Preload images so they show up with the menu
|
||||
//
|
||||
getImages: function () {
|
||||
var menu = new Image();
|
||||
menu.src = CONFIG.button.src;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// Handle touch events.
|
||||
//
|
||||
// Use double-tap-and-hold as a replacement for context menu event.
|
||||
// Use double-tap as a replacement for double click.
|
||||
//
|
||||
var TOUCH = ME.Touch = {
|
||||
|
||||
last: 0, // time of last tap event
|
||||
delay: 500, // delay time for double-click
|
||||
|
||||
//
|
||||
// Check if this is a double-tap, and if so, start the timer
|
||||
// for the double-tap and hold (to trigger the contextual menu)
|
||||
//
|
||||
start: function (event) {
|
||||
var now = new Date().getTime();
|
||||
var dblTap = (now - TOUCH.last < TOUCH.delay);
|
||||
TOUCH.last = now;
|
||||
if (dblTap) {
|
||||
TOUCH.timeout = setTimeout(TOUCH.menu,TOUCH.delay,event,this);
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// Check if there is a timeout pending, i.e., we have a
|
||||
// double-tap and were waiting to see if it is held long
|
||||
// enough for the menu. Since we got the end before the
|
||||
// timeout, it is a double-click, not a double-tap-and-hold.
|
||||
// Prevent the default action and issue a double click.
|
||||
//
|
||||
end: function (event) {
|
||||
if (TOUCH.timeout) {
|
||||
clearTimeout(TOUCH.timeout);
|
||||
delete TOUCH.timeout; TOUCH.last = 0;
|
||||
event.preventDefault();
|
||||
return EVENT.Handler((event.touches[0]||event.touch),"DblClick",this);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// If the timeout passes without an end event, we issue
|
||||
// the contextual menu event.
|
||||
//
|
||||
menu: function (event,math) {
|
||||
delete TOUCH.timeout; TOUCH.last = 0;
|
||||
return EVENT.Handler((event.touches[0]||event.touch),"ContextMenu",math);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// Mobile screens are small, so use larger version of arrow
|
||||
//
|
||||
if (HUB.Browser.isMobile) {
|
||||
var arrow = CONFIG.styles[".MathJax_Hover_Arrow"];
|
||||
arrow.width = "25px"; arrow.height = "18px";
|
||||
CONFIG.button.x = -6;
|
||||
}
|
||||
|
||||
//
|
||||
// Set up browser-specific values
|
||||
//
|
||||
HUB.Browser.Select({
|
||||
MSIE: function (browser) {
|
||||
var mode = (document.documentMode || 0);
|
||||
var isIE8 = browser.versionAtLeast("8.0");
|
||||
ME.msieBorderWidthBug = (document.compatMode === "BackCompat"); // borders are inside offsetWidth/Height
|
||||
ME.msieEventBug = browser.isIE9; // must get event from window even though event is passed
|
||||
ME.msieAlignBug = (!isIE8 || mode < 8); // inline-block spans don't rest on baseline
|
||||
if (mode < 9) {EVENT.LEFTBUTTON = 1} // IE < 9 has wrong event.button values
|
||||
},
|
||||
Safari: function (browser) {
|
||||
ME.safariContextMenuBug = true; // selection can be started by contextmenu event
|
||||
},
|
||||
Opera: function (browser) {
|
||||
ME.operaPositionBug = true; // position is wrong unless border is used
|
||||
},
|
||||
Konqueror: function (browser) {
|
||||
ME.noContextMenuBug = true; // doesn't produce contextmenu event
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
// Used in measuring zoom and hover positions
|
||||
//
|
||||
ME.topImg = (ME.msieAlignBug ?
|
||||
HTML.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}) :
|
||||
HTML.Element("span",{style:{width:0,height:0,display:"inline-block"}})
|
||||
);
|
||||
if (1 || ME.operaPositionBug/* || ME.msieTopBug*/) {ME.topImg.style.border="1px solid"}
|
||||
|
||||
//
|
||||
// Get configuration from user
|
||||
//
|
||||
ME.config = CONFIG = HUB.CombineConfig("MathEvents",CONFIG);
|
||||
var SETFRAME = function () {
|
||||
var haze = CONFIG.styles[".MathJax_Hover_Frame"];
|
||||
haze.border = CONFIG.frame.bwidth+"px solid "+CONFIG.frame.bcolor+" ! important";
|
||||
haze["box-shadow"] = haze["-webkit-box-shadow"] =
|
||||
haze["-moz-box-shadow"] = haze["-khtml-box-shadow"] =
|
||||
"0px 0px "+CONFIG.frame.hwidth+" "+CONFIG.frame.hcolor;
|
||||
};
|
||||
|
||||
//
|
||||
// Queue the events needed for startup
|
||||
//
|
||||
CALLBACK.Queue(
|
||||
HUB.Register.StartupHook("End Config",{}), // wait until config is complete
|
||||
[SETFRAME],
|
||||
["getImages",HOVER],
|
||||
["Styles",AJAX,CONFIG.styles],
|
||||
["Post",HUB.Startup.signal,"MathEvents Ready"],
|
||||
["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"]
|
||||
);
|
||||
|
||||
})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,MathJax.OutputJax,MathJax.InputJax);
|
|
@ -23,8 +23,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function (HUB,HTML,AJAX) {
|
||||
var VERSION = "1.1.4";
|
||||
(function (HUB,HTML,AJAX,CALLBACK,OUTPUT) {
|
||||
var VERSION = "1.1.8";
|
||||
|
||||
MathJax.Extension.MathMenu = {version: VERSION};
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
|||
var CONFIG = HUB.CombineConfig("MathMenu",{
|
||||
delay: 150, // the delay for submenus
|
||||
helpURL: "http://www.mathjax.org/help/user/", // the URL for the "MathJax Help" menu
|
||||
closeImg: AJAX.fileURL(OUTPUT.imageDir+"/CloseX-31.png"), // image for close "X" for mobiles
|
||||
|
||||
showRenderer: true, // show the "Math Renderer" menu?
|
||||
showFontMenu: false, // show the "Font Preference" menu?
|
||||
|
@ -130,25 +131,22 @@
|
|||
".MathJax_MenuActive": {
|
||||
"background-color": (isPC ? "Highlight" : "#606872"),
|
||||
color: (isPC ? "HighlightText" : "white")
|
||||
},
|
||||
|
||||
".MathJax_Menu_Close": {
|
||||
position:"absolute",
|
||||
width: "31px", height: "31px",
|
||||
top:"-15px", left:"-15px"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*************************************************************/
|
||||
/*
|
||||
* Cancel event's default action (try everything we can)
|
||||
*/
|
||||
var FALSE = function (event) {
|
||||
if (!event) {event = window.event}
|
||||
if (event) {
|
||||
if (event.preventDefault) {event.preventDefault()}
|
||||
if (event.stopPropagation) {event.stopPropagation()}
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var FALSE, HOVER;
|
||||
HUB.Register.StartupHook("MathEvents Ready",function () {
|
||||
FALSE = MathJax.Extension.MathEvents.Event.False;
|
||||
HOVER = MathJax.Extension.MathEvents.Hover;
|
||||
});
|
||||
|
||||
/*************************************************************/
|
||||
/*
|
||||
* The main menu class
|
||||
|
@ -170,14 +168,24 @@
|
|||
if (!event) {event = window.event};
|
||||
var title = (!this.title ? null : [["div",{className: "MathJax_MenuTitle"},[this.title]]]);
|
||||
var div = document.getElementById("MathJax_MenuFrame");
|
||||
if (!div) {div = MENU.Background(this)}
|
||||
if (!div) {
|
||||
div = MENU.Background(this);
|
||||
delete ITEM.lastItem; delete ITEM.lastMenu;
|
||||
delete MENU.skipUp;
|
||||
}
|
||||
var menu = HTML.addElement(div,"div",{
|
||||
onmouseup: MENU.Mouseup, ondblclick: this.False,
|
||||
ondragstart: this.False, onselectstart: this.False, oncontextmenu: this.False,
|
||||
onmouseup: MENU.Mouseup, ondblclick: FALSE,
|
||||
ondragstart: FALSE, onselectstart: FALSE, oncontextmenu: FALSE,
|
||||
menuItem: this, className: "MathJax_Menu"
|
||||
},title);
|
||||
|
||||
|
||||
for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)}
|
||||
if (MENU.isMobile) {
|
||||
HTML.addElement(menu,"img",{
|
||||
className: "MathJax_Menu_Close", menu: parent, src: CONFIG.closeImg,
|
||||
ontouchstart: MENU.Close, ontouchend: FALSE, onmousedown: MENU.Close
|
||||
});
|
||||
}
|
||||
this.posted = true;
|
||||
|
||||
menu.style.width = (menu.offsetWidth+2) + "px";
|
||||
|
@ -189,15 +197,16 @@
|
|||
if (!parent) {
|
||||
if (x + menu.offsetWidth > document.body.offsetWidth - this.margin)
|
||||
{x = document.body.offsetWidth - menu.offsetWidth - this.margin}
|
||||
MENU.skipUp = true;
|
||||
if (MENU.isMobile) {x = Math.max(5,x-Math.floor(menu.offsetWidth/2)); y -= 20}
|
||||
MENU.skipUp = event.isContextMenu;
|
||||
} else {
|
||||
var side = "left", mw = parent.offsetWidth;
|
||||
x = parent.offsetWidth - 2; y = 0;
|
||||
x = (MENU.isMobile ? 30 : mw - 2); y = 0;
|
||||
while (parent && parent !== div) {
|
||||
x += parent.offsetLeft; y += parent.offsetTop;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
if (x + menu.offsetWidth > document.body.offsetWidth - this.margin)
|
||||
if (x + menu.offsetWidth > document.body.offsetWidth - this.margin && !MENU.isMobile)
|
||||
{side = "right"; x = Math.max(this.margin,x - mw - menu.offsetWidth + 6)}
|
||||
if (!isPC) {
|
||||
// in case these ever get implemented
|
||||
|
@ -211,7 +220,7 @@
|
|||
menu.style.left = x+"px"; menu.style.top = y+"px";
|
||||
|
||||
if (document.selection && document.selection.empty) {document.selection.empty()}
|
||||
return this.False(event);
|
||||
return FALSE(event);
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -223,24 +232,52 @@
|
|||
div.parentNode.removeChild(div);
|
||||
if (this.msieBackgroundBug) {detachEvent("onresize",MENU.Resize)}
|
||||
}
|
||||
},
|
||||
Mouseup: function (event,menu) {
|
||||
if (MENU.skipUp) {delete MENU.skipUp} else {this.Remove(event,menu)}
|
||||
if (MENU.jax.hover) {
|
||||
delete MENU.jax.hover.nofade;
|
||||
HOVER.UnHover(MENU.jax);
|
||||
}
|
||||
},
|
||||
|
||||
False: FALSE
|
||||
/*
|
||||
* Find a named item in a menu (or submenu).
|
||||
* A lsit of names means descend into submenus.
|
||||
*/
|
||||
Find: function (name) {
|
||||
var names = [].slice.call(arguments,1);
|
||||
for (var i = 0, m = this.items.length; i < m; i++) {
|
||||
if (this.items[i].name === name) {
|
||||
if (names.length) {
|
||||
if (!this.items[i].menu) {return null}
|
||||
return this.items[i].menu.Find.apply(this.items[i].menu,names);
|
||||
}
|
||||
return this.items[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
},{
|
||||
|
||||
config: CONFIG,
|
||||
|
||||
div: null, // the DOM elements for the menu and submenus
|
||||
|
||||
Remove: function (event) {MENU.Event(event,this,"Remove")},
|
||||
Mouseover: function (event) {MENU.Event(event,this,"Mouseover")},
|
||||
Mouseout: function (event) {MENU.Event(event,this,"Mouseout")},
|
||||
Mousedown: function (event) {MENU.Event(event,this,"Mousedown")},
|
||||
Mouseup: function (event) {MENU.Event(event,this,"Mouseup")},
|
||||
Mousemove: function (event) {MENU.Event(event,this,"Mousemove")},
|
||||
Event: function (event,menu,type) {
|
||||
Close: function (event)
|
||||
{return MENU.Event(event,this.menu||this.parentNode,(this.menu?"Touchend":"Remove"))},
|
||||
Remove: function (event) {return MENU.Event(event,this,"Remove")},
|
||||
Mouseover: function (event) {return MENU.Event(event,this,"Mouseover")},
|
||||
Mouseout: function (event) {return MENU.Event(event,this,"Mouseout")},
|
||||
Mousedown: function (event) {return MENU.Event(event,this,"Mousedown")},
|
||||
Mouseup: function (event) {return MENU.Event(event,this,"Mouseup")},
|
||||
Touchstart: function (event) {return MENU.Event(event,this,"Touchstart")},
|
||||
Touchend: function (event) {return MENU.Event(event,this,"Touchend")},
|
||||
Event: function (event,menu,type,force) {
|
||||
if (MENU.skipMouseover && type === "Mouseover" && !force) {return FALSE(event)}
|
||||
if (MENU.skipUp) {
|
||||
if (type.match(/Mouseup|Touchend/)) {delete MENU.skipUp; return FALSE(event)}
|
||||
if (type === "Touchstart" ||
|
||||
(type === "Mousedown" && !MENU.skipMousedown)) {delete MENU.skipUp}
|
||||
}
|
||||
if (!event) {event = window.event}
|
||||
var item = menu.menuItem;
|
||||
if (item && item[type]) {return item[type](event,menu)}
|
||||
|
@ -285,7 +322,14 @@
|
|||
},
|
||||
|
||||
saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)},
|
||||
getCookie: function () {this.cookie = HTML.Cookie.Get("menu")}
|
||||
getCookie: function () {this.cookie = HTML.Cookie.Get("menu")},
|
||||
|
||||
//
|
||||
// Preload images so they show up with the menu
|
||||
//
|
||||
getImages: function () {
|
||||
if (MENU.isMobile) {var close = new Image(); close.src = CONFIG.closeImg}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@ -300,8 +344,9 @@
|
|||
if (!this.hidden) {
|
||||
var def = {
|
||||
onmouseover: MENU.Mouseover, onmouseout: MENU.Mouseout,
|
||||
onmouseup: MENU.Mouseup, onmousedown: this.False,
|
||||
ondragstart: this.False, onselectstart: this.False, onselectend: this.False,
|
||||
onmouseup: MENU.Mouseup, onmousedown: MENU.Mousedown,
|
||||
ondragstart: FALSE, onselectstart: FALSE, onselectend: FALSE,
|
||||
ontouchstart: MENU.Touchstart, ontouchend: MENU.Touchend,
|
||||
className: "MathJax_MenuItem", menuItem: this
|
||||
};
|
||||
if (this.disabled) {def.className += " MathJax_MenuDisabled"}
|
||||
|
@ -324,7 +369,7 @@
|
|||
menus[m].parentNode.removeChild(menus[m]);
|
||||
m--;
|
||||
}
|
||||
if (this.Timer) {this.Timer(event,menu)}
|
||||
if (this.Timer && !MENU.isMobile) {this.Timer(event,menu)}
|
||||
}
|
||||
},
|
||||
Mouseout: function (event,menu) {
|
||||
|
@ -332,7 +377,20 @@
|
|||
if (this.timer) {clearTimeout(this.timer); delete this.timer}
|
||||
},
|
||||
Mouseup: function (event,menu) {return this.Remove(event,menu)},
|
||||
|
||||
|
||||
Touchstart: function (event,menu) {return this.TouchEvent(event,menu,"Mousedown")},
|
||||
Touchend: function (event,menu) {return this.TouchEvent(event,menu,"Mouseup")},
|
||||
TouchEvent: function (event,menu,type) {
|
||||
if (this !== ITEM.lastItem) {
|
||||
if (ITEM.lastMenu) {MENU.Event(event,ITEM.lastMenu,"Mouseout")}
|
||||
MENU.Event(event,menu,"Mouseover",true);
|
||||
ITEM.lastItem = this; ITEM.lastMenu = menu;
|
||||
}
|
||||
if (this.nativeTouch) {return null}
|
||||
MENU.Event(event,menu,type);
|
||||
return false;
|
||||
},
|
||||
|
||||
Remove: function (event,menu) {
|
||||
menu = menu.parentNode.menuItem;
|
||||
return menu.Remove(event,menu);
|
||||
|
@ -341,8 +399,7 @@
|
|||
Activate: function (menu) {this.Deactivate(menu); menu.className += " MathJax_MenuActive"},
|
||||
Deactivate: function (menu) {menu.className = menu.className.replace(/ MathJax_MenuActive/,"")},
|
||||
|
||||
With: function (def) {if (def) {HUB.Insert(this,def)}; return this},
|
||||
False: FALSE
|
||||
With: function (def) {if (def) {HUB.Insert(this,def)}; return this}
|
||||
});
|
||||
|
||||
/*************************************************************/
|
||||
|
@ -356,10 +413,11 @@
|
|||
this.name = name; this.action = action;
|
||||
this.With(def);
|
||||
},
|
||||
|
||||
Label: function (def,menu) {return [this.name]},
|
||||
Mouseup: function (event,menu) {
|
||||
if (!this.disabled) {this.Remove(event,menu); this.action.call(this,event)}
|
||||
return this.False(event);
|
||||
if (!this.disabled) {this.Remove(event,menu); this.action.call(this,event);}
|
||||
return FALSE(event);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -377,13 +435,19 @@
|
|||
this.menu = MENU.apply(MENU,[].slice.call(arguments,i));
|
||||
},
|
||||
Label: function (def,menu) {
|
||||
def.onmousemove = MENU.Mousemove; this.menu.posted = false;
|
||||
this.menu.posted = false;
|
||||
return [this.name+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]];
|
||||
},
|
||||
Timer: function (event,menu) {
|
||||
if (this.timer) {clearTimeout(this.timer)}
|
||||
event = {clientX: event.clientX, clientY: event.clientY}; // MSIE can't pass the event below
|
||||
this.timer = setTimeout(MathJax.Callback(["Mouseup",this,event,menu]),CONFIG.delay);
|
||||
this.timer = setTimeout(CALLBACK(["Mouseup",this,event,menu]),CONFIG.delay);
|
||||
},
|
||||
Touchend: function (event,menu) {
|
||||
var forceout = this.menu.posted;
|
||||
var result = this.SUPER(arguments).Touchend.apply(this,arguments);
|
||||
if (forceout) {this.Deactivate(menu); delete ITEM.lastItem; delete ITEM.lastMenu}
|
||||
return result;
|
||||
},
|
||||
Mouseup: function (event,menu) {
|
||||
if (!this.disabled) {
|
||||
|
@ -402,7 +466,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
return this.False(event);
|
||||
return FALSE(event);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -437,7 +501,7 @@
|
|||
if (this.action) {this.action.call(MENU)}
|
||||
}
|
||||
this.Remove(event,menu);
|
||||
return this.False(event);
|
||||
return FALSE(event);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -465,7 +529,7 @@
|
|||
if (this.action) {this.action.call(MENU)}
|
||||
}
|
||||
this.Remove(event,menu);
|
||||
return this.False(event);
|
||||
return FALSE(event);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -501,7 +565,7 @@
|
|||
* Handle the ABOUT box
|
||||
*/
|
||||
MENU.About = function () {
|
||||
var HTMLCSS = MathJax.OutputJax["HTML-CSS"] || {fontInUse: ""};
|
||||
var HTMLCSS = OUTPUT["HTML-CSS"] || {fontInUse: ""};
|
||||
var local = (HTMLCSS.webFonts ? "" : "local "), web = (HTMLCSS.webFonts ? " web" : "");
|
||||
var font = (HTMLCSS.imgFonts ? "Image" : local+HTMLCSS.fontInUse+web) + " fonts";
|
||||
var jax = ["MathJax.js v"+MathJax.fileversion,["br"]];
|
||||
|
@ -516,7 +580,7 @@
|
|||
(HTMLCSS.webFonts ? " \u2014 "+HTMLCSS.allowWebFonts+" fonts" : "")
|
||||
]]);
|
||||
MENU.About.div = MENU.Background(MENU.About);
|
||||
var about = MathJax.HTML.addElement(MENU.About.div,"div",{
|
||||
var about = HTML.addElement(MENU.About.div,"div",{
|
||||
id: "MathJax_About", onclick: MENU.About.Remove
|
||||
},[
|
||||
["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],
|
||||
|
@ -542,10 +606,13 @@
|
|||
if (MENU.About.div) {document.body.removeChild(MENU.About.div); delete MENU.About.div}
|
||||
};
|
||||
MENU.About.GetJax = function (jax,JAX,type,noTypeCheck) {
|
||||
var info = [];
|
||||
for (var id in JAX) {if (JAX.hasOwnProperty(id) && JAX[id]) {
|
||||
if ((noTypeCheck && JAX[id].version) || (JAX[id].isa && JAX[id].isa(JAX)))
|
||||
{jax.push((JAX[id].id||id)+" "+type+" v"+JAX[id].version,["br"])}
|
||||
{info.push((JAX[id].id||id)+" "+type+" v"+JAX[id].version)}
|
||||
}}
|
||||
info.sort();
|
||||
for (var i = 0, m = info.length; i < m; i++) {jax.push(info[i],["br"])}
|
||||
return jax;
|
||||
};
|
||||
|
||||
|
@ -564,21 +631,24 @@
|
|||
if (!event) {event = window.event}
|
||||
var EVENT = {screenX:event.screenX, screenY:event.screenY};
|
||||
if (!MENU.jax) return;
|
||||
if (CONFIG.settings.format === "MathML") {
|
||||
if (this.format === "MathML") {
|
||||
var MML = MathJax.ElementJax.mml;
|
||||
if (MML && typeof(MML.mbase.prototype.toMathML) !== "undefined") {
|
||||
// toMathML() can call MathJax.Hub.RestartAfter, so trap errors and check
|
||||
try {MENU.ShowSource.Text(MENU.jax.root.toMathML(),event)} catch (err) {
|
||||
if (!err.restart) {throw err}
|
||||
MathJax.Callback.After([this,arguments.callee,EVENT]);
|
||||
CALLBACK.After([this,MENU.ShowSource,EVENT]);
|
||||
}
|
||||
} else if (!AJAX.loadingToMathML) {
|
||||
AJAX.loadingToMathML = true;
|
||||
MENU.ShowSource.Window(event); // WeBKit needs to open window on click event
|
||||
MathJax.Callback.Queue(
|
||||
CALLBACK.Queue(
|
||||
AJAX.Require("[MathJax]/extensions/toMathML.js"),
|
||||
function () {delete AJAX.loadingToMathML},
|
||||
[this,arguments.callee,EVENT] // call this function again
|
||||
function () {
|
||||
delete AJAX.loadingToMathML;
|
||||
if (!MML.mbase.prototype.toMathML) {MML.mbase.prototype.toMathML = function () {}}
|
||||
},
|
||||
[this,MENU.ShowSource,EVENT] // call this function again
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -599,19 +669,29 @@
|
|||
var w = MENU.ShowSource.Window(event);
|
||||
text = text.replace(/^\s*/,"").replace(/\s*$/,"");
|
||||
text = text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
w.document.open();
|
||||
w.document.write("<html><head><title>MathJax Equation Source</title></head><body style='font-size:85%'>");
|
||||
w.document.write("<table><tr><td><pre>"+text+"</pre></td></tr></table>");
|
||||
w.document.write("</body></html>"); w.document.close();
|
||||
var table = w.document.body.firstChild;
|
||||
var H = (w.outerHeight-w.innerHeight)||30, W = (w.outerWidth-w.innerWidth)||30;
|
||||
W = Math.min(Math.floor(.5*screen.width),table.offsetWidth+W+25);
|
||||
H = Math.min(Math.floor(.5*screen.height),table.offsetHeight+H+25);
|
||||
w.resizeTo(W,H);
|
||||
if (event && event.screenX != null) {
|
||||
var x = Math.max(0,Math.min(event.screenX-Math.floor(W/2), screen.width-W-20)),
|
||||
y = Math.max(0,Math.min(event.screenY-Math.floor(H/2), screen.height-H-20));
|
||||
w.moveTo(x,y);
|
||||
if (MENU.isMobile) {
|
||||
w.document.open();
|
||||
w.document.write("<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>MathJax Equation Source</title></head><body style='font-size:85%'>");
|
||||
w.document.write("<pre>"+text+"</pre>");
|
||||
w.document.write("<hr><input type='button' value='Close' onclick='window.close()' />");
|
||||
w.document.write("</body></html>");
|
||||
w.document.close();
|
||||
} else {
|
||||
w.document.open();
|
||||
w.document.write("<html><head><title>MathJax Equation Source</title></head><body style='font-size:85%'>");
|
||||
w.document.write("<table><tr><td><pre>"+text+"</pre></td></tr></table>");
|
||||
w.document.write("</body></html>");
|
||||
w.document.close();
|
||||
var table = w.document.body.firstChild;
|
||||
var H = (w.outerHeight-w.innerHeight)||30, W = (w.outerWidth-w.innerWidth)||30;
|
||||
W = Math.min(Math.floor(.5*screen.width),table.offsetWidth+W+25);
|
||||
H = Math.min(Math.floor(.5*screen.height),table.offsetHeight+H+25);
|
||||
w.resizeTo(W,H);
|
||||
if (event && event.screenX != null) {
|
||||
var x = Math.max(0,Math.min(event.screenX-Math.floor(W/2), screen.width-W-20)),
|
||||
y = Math.max(0,Math.min(event.screenY-Math.floor(H/2), screen.height-H-20));
|
||||
w.moveTo(x,y);
|
||||
}
|
||||
}
|
||||
delete MENU.ShowSource.w;
|
||||
};
|
||||
|
@ -620,7 +700,7 @@
|
|||
* Handle rescaling all the math
|
||||
*/
|
||||
MENU.Scale = function () {
|
||||
var HTMLCSS = MathJax.OutputJax["HTML-CSS"], nMML = MathJax.OutputJax.NativeMML;
|
||||
var HTMLCSS = OUTPUT["HTML-CSS"], nMML = OUTPUT.NativeMML;
|
||||
var SCALE = (HTMLCSS ? HTMLCSS.config.scale : nMML.config.scale);
|
||||
var scale = prompt("Scale all mathematics (compared to surrounding text) by",SCALE+"%");
|
||||
if (scale) {
|
||||
|
@ -651,11 +731,11 @@
|
|||
MENU.Renderer = function () {
|
||||
var jax = HUB.config.outputJax["jax/mml"];
|
||||
if (jax[0] !== CONFIG.settings.renderer) {
|
||||
MathJax.Callback.Queue(
|
||||
CALLBACK.Queue(
|
||||
["Require",AJAX,"[MathJax]/jax/output/"+CONFIG.settings.renderer+"/config.js"],
|
||||
["Post",HUB.Startup.signal,CONFIG.settings.renderer+" output selected"],
|
||||
[function () {
|
||||
var JAX = MathJax.OutputJax[CONFIG.settings.renderer];
|
||||
var JAX = OUTPUT[CONFIG.settings.renderer];
|
||||
for (var i = 0, m = jax.length; i < m; i++)
|
||||
{if (jax[i] === JAX) {jax.splice(i,1); break}}
|
||||
jax.unshift(JAX);
|
||||
|
@ -669,7 +749,7 @@
|
|||
* Handle setting the HTMLCSS fonts
|
||||
*/
|
||||
MENU.Font = function () {
|
||||
var HTMLCSS = MathJax.OutputJax["HTML-CSS"]; if (!HTMLCSS) return;
|
||||
var HTMLCSS = OUTPUT["HTML-CSS"]; if (!HTMLCSS) return;
|
||||
document.location.reload();
|
||||
};
|
||||
|
||||
|
@ -689,8 +769,14 @@
|
|||
delete CONFIG.styles["#MathJax_About"].filter;
|
||||
delete CONFIG.styles[".MathJax_Menu"].filter;
|
||||
}
|
||||
},
|
||||
Firefox: function (browser) {
|
||||
MENU.skipMouseover = browser.isMobile && browser.versionAtLeast("6.0");
|
||||
MENU.skipMousedown = browser.isMobile;
|
||||
}
|
||||
});
|
||||
MENU.isMobile = HUB.Browser.isMobile;
|
||||
MENU.noContextMenu = HUB.Browser.noContextMenu;
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
|
@ -702,8 +788,6 @@
|
|||
* it wasn't set in the cookie.
|
||||
*/
|
||||
CONFIG.settings = HUB.config.menuSettings;
|
||||
if (!CONFIG.settings.format)
|
||||
{CONFIG.settings.format = (MathJax.InputJax.TeX ? "Original" : "MathML")}
|
||||
if (typeof(CONFIG.settings.showRenderer) !== "undefined") {CONFIG.showRenderer = CONFIG.settings.showRenderer}
|
||||
if (typeof(CONFIG.settings.showFontMenu) !== "undefined") {CONFIG.showFontMenu = CONFIG.settings.showFontMenu}
|
||||
if (typeof(CONFIG.settings.showContext) !== "undefined") {CONFIG.showContext = CONFIG.settings.showContext}
|
||||
|
@ -713,13 +797,12 @@
|
|||
* The main menu
|
||||
*/
|
||||
MENU.menu = MENU(
|
||||
ITEM.COMMAND("Show Source",MENU.ShowSource),
|
||||
ITEM.SUBMENU("Format",
|
||||
ITEM.RADIO("MathML", "format"),
|
||||
ITEM.RADIO("Original", "format", {value: "Original"})
|
||||
ITEM.SUBMENU("Show Math As",
|
||||
ITEM.COMMAND("MathML Code", MENU.ShowSource, {nativeTouch: true, format: "MathML"}),
|
||||
ITEM.COMMAND("Original Form", MENU.ShowSource, {nativeTouch: true})
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.SUBMENU("Settings",
|
||||
ITEM.SUBMENU("Math Settings",
|
||||
ITEM.SUBMENU("Zoom Trigger",
|
||||
ITEM.RADIO("Hover", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("Click", "zoom", {action: MENU.Zoom}),
|
||||
|
@ -761,7 +844,9 @@
|
|||
ITEM.RADIO("MathJax", "context"),
|
||||
ITEM.RADIO("Browser", "context")
|
||||
),
|
||||
ITEM.COMMAND("Scale All Math ...",MENU.Scale)
|
||||
ITEM.COMMAND("Scale All Math ...",MENU.Scale),
|
||||
ITEM.RULE().With({hidden: true}),
|
||||
ITEM.CHECKBOX("Highlight on Hover", "discoverable", {hidden: true})
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.COMMAND("About MathJax",MENU.About),
|
||||
|
@ -772,23 +857,39 @@
|
|||
|
||||
MENU.showRenderer = function (show) {
|
||||
MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie();
|
||||
MENU.menu.items[3].menu.item[3].hidden = !show;
|
||||
MENU.menu.Find("Math Settings","Math Renderer").hidden = !show;
|
||||
};
|
||||
MENU.showFontMenu = function (show) {
|
||||
MENU.cookie.showFontMenu = CONFIG.showFontMenu = show; MENU.saveCookie();
|
||||
MENU.menu.items[3].menu.items[4].hidden = !show
|
||||
MENU.menu.Find("Math Settings","Font Preference").hidden = !show;
|
||||
};
|
||||
MENU.showContext = function (show) {
|
||||
MENU.cookie.showContext = CONFIG.showContext = show; MENU.saveCookie();
|
||||
MENU.menu.items[3].menu.items[5].hidden = !show
|
||||
MENU.menu.Find("Math Settings","Contextual Menu").hidden = !show;
|
||||
};
|
||||
|
||||
if (MENU.isMobile) {
|
||||
(function () {
|
||||
var settings = CONFIG.settings;
|
||||
var trigger = MENU.menu.Find("Math Settings","Zoom Trigger").menu;
|
||||
trigger.items[0].disabled = trigger.items[1].disabled = true;
|
||||
if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"}
|
||||
trigger.items = trigger.items.slice(0,4);
|
||||
|
||||
if (navigator.appVersion.match(/[ (]Android[) ]/)) {
|
||||
MENU.ITEM.SUBMENU.Augment({marker: "\u00BB"});
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
MathJax.Callback.Queue(
|
||||
CALLBACK.Queue(
|
||||
HUB.Register.StartupHook("End Config",{}), // wait until config is complete
|
||||
["getImages",MENU],
|
||||
["Styles",AJAX,CONFIG.styles],
|
||||
["Post",HUB.Startup.signal,"MathMenu Ready"],
|
||||
["loadComplete",AJAX,"[MathJax]/extensions/MathMenu.js"]
|
||||
);
|
||||
|
||||
})(MathJax.Hub,MathJax.HTML,MathJax.Ajax);
|
||||
})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.CallBack,MathJax.OutputJax);
|
||||
|
|
|
@ -23,11 +23,9 @@
|
|||
*/
|
||||
|
||||
(function (HUB,HTML,AJAX,HTMLCSS,nMML) {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.3";
|
||||
|
||||
var CONFIG = HUB.CombineConfig("MathZoom",{
|
||||
delay: 400, // mouse must be still this long (milliseconds)
|
||||
|
||||
styles: {
|
||||
//
|
||||
// The styles for the MathZoom display box
|
||||
|
@ -53,40 +51,39 @@
|
|||
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=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=0)"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*************************************************************/
|
||||
/*
|
||||
* Cancel event's default action (try everything we can)
|
||||
*/
|
||||
var FALSE = function (event) {
|
||||
if (!event) {event = window.event}
|
||||
if (event) {
|
||||
if (event.preventDefault) {event.preventDefault()}
|
||||
if (event.stopPropagation) {event.stopPropagation()}
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var FALSE, HOVER, EVENT;
|
||||
MathJax.Hub.Register.StartupHook("MathEvents Ready",function () {
|
||||
EVENT = MathJax.Extension.MathEvents.Event;
|
||||
FALSE = MathJax.Extension.MathEvents.Event.False;
|
||||
HOVER = MathJax.Extension.MathEvents.Hover;
|
||||
});
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
var ZOOM = MathJax.Extension.MathZoom = {
|
||||
version: VERSION,
|
||||
settings: HUB.config.menuSettings,
|
||||
scrollSize: 18, // width of scrool bars
|
||||
|
||||
//
|
||||
// Used to override HTMLCSS or nMML method of the same name
|
||||
// Process events passed from output jax
|
||||
//
|
||||
HandleEvent: function (event,type,math) {
|
||||
if (!event) {event = window.event}
|
||||
if (ZOOM.settings.CTRL && !event.ctrlKey) return true;
|
||||
if (ZOOM.settings.ALT && !event.altKey) return true;
|
||||
if (ZOOM.settings.CMD && !event.metaKey) return true;
|
||||
if (ZOOM.settings.Shift && !event.shiftKey) return true;
|
||||
if (!ZOOM[type]) return true;
|
||||
return ZOOM[type](event,math);
|
||||
},
|
||||
|
||||
|
@ -94,63 +91,40 @@
|
|||
// Zoom on click
|
||||
//
|
||||
Click: function (event,math) {
|
||||
if (this.settings.zoom === "Click") {return this.Zoom(math,event)}
|
||||
if (this.settings.zoom === "Click") {return this.Zoom(event,math)}
|
||||
},
|
||||
|
||||
//
|
||||
// Zoom on double click
|
||||
//
|
||||
DblClick: function (event,math) {
|
||||
if (this.settings.zoom === "Double-Click") {return this.Zoom(math,event)}
|
||||
if (this.settings.zoom === "Double-Click") {return this.Zoom(event,math)}
|
||||
},
|
||||
|
||||
//
|
||||
// Zoom on hover
|
||||
// Zoom on hover (called by UI.Hover)
|
||||
//
|
||||
Mouseover: function (event,math) {
|
||||
if (this.settings.zoom === "Hover") {
|
||||
ZOOM.oldMouseOver = math.onmouseover;
|
||||
math.onmouseover = null;
|
||||
math.onmousemove = this.Mousemove;
|
||||
math.onmouseout = this.Mouseout;
|
||||
return ZOOM.Timer(event,math);
|
||||
}
|
||||
},
|
||||
Mouseout: function (event) {
|
||||
this.onmouseover = ZOOM.oldMouseOver; delete ZOOM.oldMouseOver;
|
||||
this.onmousemove = this.onmouseout = null;
|
||||
ZOOM.ClearTimer();
|
||||
return FALSE(event);
|
||||
},
|
||||
Mousemove: function (event) {
|
||||
return ZOOM.Timer(event||window.event,this);
|
||||
},
|
||||
Timer: function (event,math) {
|
||||
this.ClearTimer();
|
||||
this.timer = setTimeout(MathJax.Callback(["Zoom",this,math,{}]),CONFIG.delay);
|
||||
return FALSE(event);
|
||||
},
|
||||
ClearTimer: function () {
|
||||
if (this.timer) {clearTimeout(this.timer); delete this.timer}
|
||||
Hover: function (event,math) {
|
||||
if (this.settings.zoom === "Hover") {this.Zoom(event,math); return true}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
//
|
||||
// Handle the actual zooming
|
||||
//
|
||||
Zoom: function (math,event) {
|
||||
this.ClearTimer(); this.Remove();
|
||||
|
||||
Zoom: function (event,math) {
|
||||
//
|
||||
// Find the jax and its type
|
||||
// Remove any other zoom and clear timers
|
||||
//
|
||||
var parent = math.parentNode;
|
||||
if (parent.className === "MathJax_MathContainer") {parent = parent.parentNode}
|
||||
if (parent.parentNode.className === "MathJax_MathContainer") {parent = parent.parentNode.parentNode}
|
||||
var script = (String(parent.className).match(/^MathJax_(MathML|Display)$/) ? parent : math).nextSibling;
|
||||
var jax = HUB.getJaxFor(script), root = jax.root;
|
||||
var JAX = (HTMLCSS && jax.outputJax.isa(HTMLCSS.constructor) ? "HTMLCSS" :
|
||||
(nMML && jax.outputJax.isa(nMML.constructor) ? "MathML" : null));
|
||||
if (!JAX) return; // FIXME: report an error?
|
||||
this.Remove(); HOVER.ClearHoverTimer(); EVENT.ClearSelection();
|
||||
|
||||
//
|
||||
// Find the jax
|
||||
//
|
||||
var JAX = MathJax.OutputJax[math.jaxID];
|
||||
var jax = JAX.getJaxFromMath(math), root = jax.root;
|
||||
if (jax.hover) {HOVER.UnHover(jax)}
|
||||
|
||||
//
|
||||
// Create the DOM elements for the zoom box
|
||||
|
@ -164,48 +138,57 @@
|
|||
},[
|
||||
["span",{id:"MathJax_ZoomOverlay", onmousedown:this.Remove}],
|
||||
["span",{
|
||||
id:"MathJax_Zoom", onclick: this.Remove,
|
||||
id:"MathJax_Zoom", onclick:this.Remove,
|
||||
style:{
|
||||
visibility:"hidden", fontSize:this.settings.zscale,
|
||||
"max-width":Mw+"px", "max-height":Mh+"px"
|
||||
}
|
||||
},[["span"]]]
|
||||
]
|
||||
},[["span",{style:{display:"inline-block", "white-space":"nowrap"}}]]
|
||||
]]
|
||||
);
|
||||
var zoom = div.lastChild, span = zoom.firstChild, overlay = div.firstChild;
|
||||
math.parentNode.insertBefore(div,math);
|
||||
if (span.addEventListener) {span.addEventListener("mousedown",this.Remove,true)}
|
||||
|
||||
if (this.msieTrapEventBug) {
|
||||
var trap = HTML.Element("span",{id:"MathJax_ZoomEventTrap", onmousedown:this.Remove});
|
||||
div.insertBefore(trap,zoom);
|
||||
}
|
||||
|
||||
//
|
||||
// Display the zoomed math
|
||||
//
|
||||
if (this.msieZIndexBug) {
|
||||
// MSIE doesn't do z-index properly, so move the div to the document.body,
|
||||
// and use an empty span as a tracker for the usual position
|
||||
var tracker = HTML.Element("img",{
|
||||
src:"about:blank", id:"MathJax_ZoomTracker",
|
||||
// and use an image as a tracker for the usual position
|
||||
var tracker = HTML.addElement(document.body,"img",{
|
||||
src:"about:blank", id:"MathJax_ZoomTracker", width:0, height:0,
|
||||
style:{width:0, height:0, position:"relative"}
|
||||
});
|
||||
document.body.appendChild(div);
|
||||
div.style.position = "absolute";
|
||||
div.style.position = "relative";
|
||||
div.style.zIndex = CONFIG.styles["#MathJax_ZoomOverlay"]["z-index"];
|
||||
div = tracker;
|
||||
}
|
||||
var bbox = (this["Zoom"+JAX])(root,span,math);
|
||||
|
||||
var bbox = JAX.Zoom(root,span,math,Mw,Mh);
|
||||
|
||||
//
|
||||
// Fix up size and position for browsers with bugs (IE)
|
||||
//
|
||||
if (this.msiePositionBug) {
|
||||
if (this.msieIE8Bug) {
|
||||
// IE8 gets height completely wrong
|
||||
span.style.position = "absolute"; zoom.style.height = span.offsetHeight; span.style.position = "";
|
||||
if (zoom.offsetHeight <= Mh && zoom.offsetWidth <= Mw) {zoom.style.overflow = "visible"}
|
||||
}
|
||||
if (this.msieWidthBug) {zoom.style.width = Math.min(Mw,bbox.w)}
|
||||
else if (bbox.w > Mw) {zoom.style.width = Mw}
|
||||
if (zoom.offsetHeight > Mh) {zoom.style.Height = Mh+"px"} // IE doesn't do max-height?
|
||||
if (math.nextSibling) {math.parentNode.insertBefore(div,math.nextSibling)}
|
||||
else {parent.appendChild(div)} // needs to be after to be above?
|
||||
} else if (this.operaPositionBug) {
|
||||
zoom.style.width = Math.min(Mw,span.offsetWidth)+"px"; // gets width as 0?
|
||||
if (this.msieSizeBug)
|
||||
{zoom.style.height = bbox.zH+"px"; zoom.style.width = bbox.zW+"px"} // IE8 gets the dimensions completely wrong
|
||||
if (zoom.offsetHeight > Mh) {zoom.style.height = Mh+"px"; zoom.style.width = (bbox.zW+this.scrollSize)+"px"} // IE doesn't do max-height?
|
||||
if (zoom.offsetWidth > Mw) {zoom.style.width = Mw+"px"; zoom.style.height = (bbox.zH+this.scrollSize)+"px"}
|
||||
}
|
||||
if (this.operaPositionBug) {zoom.style.width = Math.min(Mw,bbox.zW)+"px"} // Opera gets width as 0?
|
||||
if (zoom.offsetWidth < Mw && zoom.offsetHeight < Mh) {zoom.style.overflow = "visible"}
|
||||
this.Position(zoom,bbox);
|
||||
if (this.msieTrapEventBug) {
|
||||
trap.style.height = zoom.clientHeight+"px"; trap.style.width = zoom.clientWidth+"px";
|
||||
trap.style.left = (parseFloat(zoom.style.left)+zoom.clientLeft)+"px";
|
||||
trap.style.top = (parseFloat(zoom.style.top)+zoom.clientTop)+"px";
|
||||
}
|
||||
this.Position(zoom,bbox,(JAX === "MathML" && parent.nodeName.toLowerCase() === "div"));
|
||||
zoom.style.visibility = "";
|
||||
|
||||
//
|
||||
|
@ -216,53 +199,19 @@
|
|||
else if (window.attachEvent) {attachEvent("onresize",this.Resize)}
|
||||
else {this.onresize = window.onresize; window.onresize = this.Resize}
|
||||
|
||||
|
||||
//
|
||||
// Canel further actions
|
||||
//
|
||||
return FALSE(event);
|
||||
},
|
||||
|
||||
//
|
||||
// Handle the jax-specific output
|
||||
//
|
||||
ZoomHTMLCSS: function (root,span,math) {
|
||||
span.className = "MathJax";
|
||||
HTMLCSS.idPostfix = "-zoom";
|
||||
HTMLCSS.getScales(span,span);
|
||||
root.toHTML(span,span);
|
||||
var bbox = root.HTMLspanElement().bbox;
|
||||
HTMLCSS.idPostfix = "";
|
||||
if (bbox.width && bbox.width !== "100%") {
|
||||
// Handle full-width displayed equations
|
||||
// FIXME: this is a hack for now
|
||||
var Mw = Math.floor(.85*document.body.clientWidth);
|
||||
span.style.width = Mw+"px"; span.style.display="inline-block";
|
||||
var id = (root.id||"MathJax-Span-"+root.spanID)+"-zoom";
|
||||
var child = document.getElementById(id).firstChild;
|
||||
while (child && child.style.width !== bbox.width) {child = child.nextSibling}
|
||||
if (child) {child.style.width = "100%"}
|
||||
}
|
||||
span.appendChild(this.topImg); var top = this.topImg.offsetTop; span.removeChild(this.topImg);
|
||||
var W = (this.msieWidthBug ? HTMLCSS.getW(math)*HTMLCSS.em : math.offsetWidth);
|
||||
return {w:bbox.w*HTMLCSS.em, Y:-top, W:W};
|
||||
},
|
||||
ZoomMathML: function (root,span,math) {
|
||||
root.toNativeMML(span,span); var top;
|
||||
span.appendChild(this.topImg); top = this.topImg.offsetTop; span.removeChild(this.topImg);
|
||||
var W = (this.ffMMLwidthBug ? math.parentNode : math).offsetWidth;
|
||||
return {w:span.offsetWidth, Y:-top, W:W}
|
||||
},
|
||||
|
||||
//
|
||||
// Set the position of the zoom box and overlay
|
||||
//
|
||||
Position: function (zoom,bbox,MMLdisplay) {
|
||||
var XY = this.Resize(), x = XY.x, y = XY.y, W = bbox.W;
|
||||
if (this.msiePositionBug) {W = -W}
|
||||
if (MMLdisplay && this.ffMMLcenterBug) {W = 0}
|
||||
Position: function (zoom,bbox) {
|
||||
var XY = this.Resize(), x = XY.x, y = XY.y, W = bbox.mW;
|
||||
var dx = -Math.floor((zoom.offsetWidth-W)/2), dy = bbox.Y;
|
||||
zoom.style.left = Math.max(dx,20-x)+"px"; zoom.style.top = Math.max(dy,20-y)+"px";
|
||||
zoom.style.left = Math.max(dx,10-x)+"px"; zoom.style.top = Math.max(dy,10-y)+"px";
|
||||
},
|
||||
|
||||
//
|
||||
|
@ -271,15 +220,13 @@
|
|||
Resize: function (event) {
|
||||
if (ZOOM.onresize) {ZOOM.onresize(event)}
|
||||
var x = 0, y = 0,
|
||||
div = document.getElementById("MathJax_ZoomFrame"),
|
||||
div = document.getElementById("MathJax_ZoomFrame"), obj = div,
|
||||
overlay = document.getElementById("MathJax_ZoomOverlay");
|
||||
var obj = (ZOOM.msieZIndexBug ? document.getElementById("MathJax_ZoomTracker") : div);
|
||||
if (ZOOM.operaPositionBug) {div.style.border = "1px solid"} // to get vertical position right
|
||||
if (obj.offsetParent) {
|
||||
do {x += obj.offsetLeft; y += obj.offsetTop} while (obj = obj.offsetParent);
|
||||
}
|
||||
if (ZOOM.operaPositionBug) {div.style.border = ""}
|
||||
if (ZOOM.msieZIndexBug) {div.style.left = x+"px"; div.style.top = y+"px"}
|
||||
overlay.style.left = (-x)+"px"; overlay.style.top = (-y)+"px";
|
||||
if (ZOOM.msiePositionBug) {setTimeout(ZOOM.SetWH,0)} else {ZOOM.SetWH()}
|
||||
return {x:x, y:y};
|
||||
|
@ -306,9 +253,9 @@
|
|||
var overlay = HTML.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(overlay);
|
||||
id: "MathJax_OperaDiv"
|
||||
});
|
||||
document.body.removeChild(overlay);
|
||||
}
|
||||
if (window.removeEventListener) {removeEventListener("resize",ZOOM.Resize,false)}
|
||||
else if (window.detachEvent) {detachEvent("onresize",ZOOM.Resize)}
|
||||
|
@ -319,88 +266,39 @@
|
|||
|
||||
};
|
||||
|
||||
//
|
||||
// Hook into the HTML-CSS and NativeMML event handling
|
||||
//
|
||||
HUB.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
||||
HTMLCSS.Augment({HandleEvent: ZOOM.HandleEvent});
|
||||
});
|
||||
HUB.Register.StartupHook("NativeMML Jax Ready", function () {
|
||||
nMML = MathJax.OutputJax.NativeMML;
|
||||
nMML.Augment({
|
||||
HandleEvent: ZOOM.HandleEvent,
|
||||
MSIEmouseup: function (event,math,span) {
|
||||
if (this.trapUp) {delete this.trapUp; return true}
|
||||
if (this.MSIEzoomKeys(event)) {return true}
|
||||
return false;
|
||||
},
|
||||
MSIEclick: function (event,math,span) {
|
||||
if (this.trapClick) {delete this.trapClick; return true}
|
||||
if (!this.MSIEzoomKeys(event)) return false;
|
||||
if (!this.settings.zoom.match(/Click/)) return false;
|
||||
return (ZOOM.Click(event,math) === false);
|
||||
},
|
||||
MSIEdblclick: function (event,math,span) {
|
||||
if (!this.MSIEzoomKeys(event)) return false;
|
||||
return (ZOOM.DblClick(event,math) === false);
|
||||
},
|
||||
MSIEmouseover: function (event,math,span) {
|
||||
if (this.settings.zoom !== "Hover") {return false}
|
||||
ZOOM.Timer(event,math); return true;
|
||||
},
|
||||
MSIEmouseout: function (event,math,span) {
|
||||
if (this.settings.zoom !== "Hover") {return false}
|
||||
ZOOM.ClearTimer(); return true;
|
||||
},
|
||||
MSIEmousemove: function (event,math,span) {
|
||||
if (this.settings.zoom !== "Hover") {return false}
|
||||
ZOOM.Timer(event,math); return true;
|
||||
},
|
||||
MSIEzoomKeys: function (event) {
|
||||
if (this.settings.CTRL && !event.ctrlKey) return false;
|
||||
if (this.settings.CMD && !event.metaKey) return false;
|
||||
if (this.settings.ALT && !event.altKey) return false;
|
||||
if (this.settings.Shift && !event.shiftKey) return false;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
HUB.Browser.Select({
|
||||
MSIE: function (browser) {
|
||||
var quirks = (document.compatMode === "BackCompat");
|
||||
var isIE8 = browser.versionAtLeast("8.0") && document.documentMode > 7;
|
||||
ZOOM.msiePositionBug = true;
|
||||
ZOOM.msieWidthBug = !quirks;
|
||||
ZOOM.msieIE8Bug = isIE8;
|
||||
ZOOM.msieZIndexBug = !isIE8;
|
||||
ZOOM.msieInlineBlockAlignBug = (!isIE8 || quirks);
|
||||
if (document.documentMode >= 9) {delete CONFIG.styles["#MathJax_Zoom"].filter}
|
||||
var mode = (document.documentMode || 0);
|
||||
var isIE9 = (mode >= 9);
|
||||
ZOOM.msiePositionBug = !isIE9;
|
||||
ZOOM.msieSizeBug = browser.versionAtLeast("7.0") &&
|
||||
(!document.documentMode || mode === 7 || mode === 8);
|
||||
ZOOM.msieZIndexBug = (mode <= 7);
|
||||
ZOOM.msieInlineBlockAlignBug = (mode <= 7);
|
||||
ZOOM.msieTrapEventBug = !window.addEventListener;
|
||||
if (document.compatMode === "BackCompat") {ZOOM.scrollSize = 52} // don't know why this is so far off
|
||||
if (isIE9) {delete CONFIG.styles["#MathJax_Zoom"].filter}
|
||||
},
|
||||
|
||||
Opera: function (browser) {
|
||||
ZOOM.operaPositionBug = true;
|
||||
ZOOM.operaRefreshBug = true;
|
||||
},
|
||||
|
||||
Firefox: function (browser) {
|
||||
ZOOM.ffMMLwidthBug = true;
|
||||
ZOOM.ffMMLcenterBug = true;
|
||||
}
|
||||
});
|
||||
|
||||
ZOOM.topImg = (ZOOM.msieInlineBlockAlignBug ?
|
||||
HTML.Element("img",{style:{width:0,height:0},src:"about:blank"}) :
|
||||
HTML.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}) :
|
||||
HTML.Element("span",{style:{width:0,height:0,display:"inline-block"}})
|
||||
);
|
||||
if (ZOOM.operaPositionBug) {ZOOM.topImg.style.border="1px solid"}
|
||||
if (ZOOM.operaPositionBug || ZOOM.msieTopBug) {ZOOM.topImg.style.border="1px solid"}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
MathJax.Callback.Queue(
|
||||
["StartupHook",MathJax.Hub.Register,"Begin Styles",{}],
|
||||
["Styles",AJAX,CONFIG.styles],
|
||||
["Post",HUB.Startup.signal,"MathZoom Ready"],
|
||||
["loadComplete",AJAX,"[MathJax]/extensions/MathZoom.js"]
|
||||
|
|
|
@ -156,7 +156,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
var text = this.data[0].data[0].data.join("").split(/\n/);
|
||||
for (var i = 0, m = text.length; i < m; i++) {
|
||||
HTMLCSS.addText(span,text[i]);
|
||||
if (i !== m-1) {HTMLCSS.addElement(span,"br")}
|
||||
if (i !== m-1) {HTMLCSS.addElement(span,"br",{isMathJax:true})}
|
||||
}
|
||||
var HD = HTMLCSS.getHD(span.parentNode), W = HTMLCSS.getW(span.parentNode);
|
||||
if (m > 1) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.InputJax.MathML = MathJax.InputJax({
|
||||
id: "MathML",
|
||||
version: "1.1.7",
|
||||
version: "1.1.8",
|
||||
directory: MathJax.InputJax.directory + "/MathML",
|
||||
extensionDir: MathJax.InputJax.extensionDir + "/MathML",
|
||||
entityDir: MathJax.InputJax.directory + "/MathML/entities",
|
||||
|
|
|
@ -135,6 +135,8 @@
|
|||
/************************************************************************/
|
||||
|
||||
MATHML.Augment({
|
||||
sourceMenuTitle: "Original MathML",
|
||||
|
||||
Translate: function (script) {
|
||||
if (!this.ParseXML) {this.ParseXML = this.createParser()}
|
||||
var mml, math;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.InputJax.TeX = MathJax.InputJax({
|
||||
id: "TeX",
|
||||
version: "1.1.8",
|
||||
version: "1.1.9",
|
||||
directory: MathJax.InputJax.directory + "/TeX",
|
||||
extensionDir: MathJax.InputJax.extensionDir + "/TeX",
|
||||
|
||||
|
|
|
@ -1760,6 +1760,8 @@
|
|||
MAXBUFFER: 5*1024 // maximum size of TeX string to process
|
||||
},
|
||||
|
||||
sourceMenuTitle: "TeX Commands",
|
||||
|
||||
Translate: function (script) {
|
||||
var mml, math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
|
||||
if (MathJax.Hub.Browser.isKonqueror)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||
var VERSION = "1.1.2";
|
||||
var VERSION = "1.1.4";
|
||||
var MML = MathJax.ElementJax.mml,
|
||||
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
||||
|
||||
|
@ -50,7 +50,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
else if (HW != null) {HTMLCSS.Remeasured(selected.HTMLstretchH(span,HW),span)}
|
||||
if (HTMLCSS.msieHitBoxBug) {
|
||||
// margin-left doesn't work on inline-block elements in IE, so put it in a SPAN
|
||||
var box = HTMLCSS.addElement(span,"span");
|
||||
var box = HTMLCSS.addElement(span,"span",{isMathJax:true});
|
||||
frame = HTMLCSS.createFrame(box,span.bbox.h,span.bbox.d,span.bbox.w,0,"none");
|
||||
span.insertBefore(box,span.firstChild); // move below the content
|
||||
box.style.marginRight = HTMLCSS.Em(-span.bbox.w);
|
||||
|
@ -110,13 +110,13 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
this.selection++;
|
||||
if (this.selection > this.data.length) {this.selection = 1}
|
||||
var math = this; while (math.type !== "math") {math = math.inherit}
|
||||
MathJax.Hub.getJaxFor(math.inputID).Update();
|
||||
if (!event) {event = window.event}
|
||||
if (event.preventDefault) {event.preventDefault()}
|
||||
if (event.stopPropagation) {event.stopPropagation()}
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
return false;
|
||||
var jax = MathJax.Hub.getJaxFor(math.inputID), hover = !!jax.hover;
|
||||
jax.Update();
|
||||
if (hover) {
|
||||
var span = document.getElementById(jax.inputID+"-Span");
|
||||
MathJax.Extension.MathEvents.Hover.Hover(jax,span);
|
||||
}
|
||||
return MathJax.Extension.MathEvents.Event.False(event);
|
||||
},
|
||||
|
||||
//
|
||||
|
|
|
@ -230,7 +230,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
return svg;
|
||||
},
|
||||
HTMLsvgElement: function (svg,type,def) {
|
||||
var obj = document.createElementNS(SVGNS,type);
|
||||
var obj = document.createElementNS(SVGNS,type); obj.isMathJax = true;
|
||||
if (def) {for (var id in def) {if (def.hasOwnProperty(id)) {obj.setAttributeNS(null,id,def[id].toString())}}}
|
||||
svg.appendChild(obj);
|
||||
return obj;
|
||||
|
@ -242,7 +242,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
return vml;
|
||||
},
|
||||
HTMLvmlElement: function (vml,type,def) {
|
||||
var obj = HTMLCSS.addElement(vml,vmlns+":"+type);
|
||||
var obj = HTMLCSS.addElement(vml,vmlns+":"+type,{isMathJax:true});
|
||||
obj.style.position = "absolute"; obj.style.left = obj.style.top = 0;
|
||||
MathJax.Hub.Insert(obj,def); // IE8 needs to do this after obj is added to the page
|
||||
if (!def.fillcolor) {obj.fillcolor = "none"}
|
||||
|
|
|
@ -62,7 +62,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
span.bbox = err.HTMLspanElement().bbox;
|
||||
} else {
|
||||
var mu = this.HTMLgetMu(span);
|
||||
img = HTMLCSS.addElement(span,"img",{src:values.src, alt:values.alt, title:values.alt});
|
||||
img = HTMLCSS.addElement(span,"img",{isMathJax:true, src:values.src, alt:values.alt, title:values.alt});
|
||||
if (values.width) {
|
||||
if (String(values.width).match(/^\s*-?\d+\s*$/)) {values.width += "px"}
|
||||
img.style.width = HTMLCSS.Em(HTMLCSS.length2em(values.width,mu,this.img.img.width/HTMLCSS.em));
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({
|
||||
id: "HTML-CSS",
|
||||
version: "1.1.12",
|
||||
version: "1.1.13",
|
||||
directory: MathJax.OutputJax.directory + "/HTML-CSS",
|
||||
extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS",
|
||||
autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload",
|
||||
|
@ -39,8 +39,6 @@ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({
|
|||
imageFont: "TeX",
|
||||
undefinedFamily: "STIXGeneral,'Arial Unicode MS',serif",
|
||||
|
||||
showMathMenu: true,
|
||||
|
||||
styles: {
|
||||
".MathJax_Display": {
|
||||
"text-align": "center",
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
(function (HUB,HTMLCSS,AJAX) {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
HUB.Register.LoadHook(HTMLCSS.fontDir + "/fontdata.js",function () {
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
"AlphaImageLoader(src='"+AJAX.fileURL(file)+"', sizingMethod='scale')";
|
||||
file = this.directory+"/blank.gif"
|
||||
}
|
||||
this.addElement(span,"img",{src:AJAX.fileURL(file), style:style});
|
||||
this.addElement(span,"img",{src:AJAX.fileURL(file), style:style, isMathJax:true});
|
||||
return "";
|
||||
},
|
||||
|
||||
|
|
|
@ -83,9 +83,9 @@
|
|||
return false;
|
||||
},
|
||||
|
||||
styleChar: String.fromCharCode(0xEFFD), // width encodes style
|
||||
versionChar: String.fromCharCode(0xEFFE), // width encodes version
|
||||
compChar: String.fromCharCode(0xEFFF), // "standard" width to compare to
|
||||
styleChar: "\uEFFD", // width encodes style
|
||||
versionChar: "\uEFFE", // width encodes version
|
||||
compChar: "\uEFFF", // "standard" width to compare to
|
||||
|
||||
testStyleChar: function (font,size) {
|
||||
var n = 3 + (font.weight ? 2 : 0) + (font.style ? 4 : 0);
|
||||
|
@ -182,7 +182,9 @@
|
|||
return def;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var EVENT, TOUCH, HOVER; // filled in later
|
||||
|
||||
HTMLCSS.Augment({
|
||||
config: {
|
||||
styles: {
|
||||
|
@ -230,7 +232,7 @@
|
|||
},
|
||||
|
||||
".MathJax nobr": {
|
||||
"white-space": "nowrap"
|
||||
"white-space": "nowrap ! important"
|
||||
},
|
||||
|
||||
".MathJax img": {
|
||||
|
@ -245,7 +247,7 @@
|
|||
".MathJax .MathJax_HitBox": {
|
||||
cursor: "text"
|
||||
},
|
||||
|
||||
|
||||
"#MathJax_Tooltip": {
|
||||
position: "absolute", left: 0, top: 0,
|
||||
width: "auto", height: "auto",
|
||||
|
@ -259,9 +261,6 @@
|
|||
},
|
||||
settings: HUB.config.menuSettings,
|
||||
|
||||
LEFTBUTTON: (HUB.Browser.isMSIE ? 1 : 0), // the event.button value for left button
|
||||
MENUKEY: "altKey", // the event value for alternate context menu
|
||||
|
||||
Font: null, // created by Config() below
|
||||
|
||||
Config: function () {
|
||||
|
@ -301,9 +300,20 @@
|
|||
}
|
||||
HUB.Startup.signal.Post("HTML-CSS Jax - no valid font");
|
||||
}
|
||||
this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js");
|
||||
},
|
||||
|
||||
Startup: function () {
|
||||
// Set up event handling
|
||||
EVENT = MathJax.Extension.MathEvents.Event;
|
||||
TOUCH = MathJax.Extension.MathEvents.Touch;
|
||||
HOVER = MathJax.Extension.MathEvents.Hover;
|
||||
this.ContextMenu = EVENT.ContextMenu;
|
||||
this.Mousedown = EVENT.AltContextMenu;
|
||||
this.Mouseover = HOVER.Mouseover;
|
||||
this.Mouseout = HOVER.Mouseout;
|
||||
this.Mousemove = HOVER.Mousemove;
|
||||
|
||||
// Set up default fonts
|
||||
var family = [], fonts = this.FONTDATA.VARIANT.normal.fonts;
|
||||
if (!(fonts instanceof Array)) {fonts = [fonts]}
|
||||
|
@ -381,11 +391,17 @@
|
|||
var prev = script.previousSibling;
|
||||
if (prev && String(prev.className).match(/^MathJax(_MathML|_Display)?$/))
|
||||
{prev.parentNode.removeChild(prev)}
|
||||
var math = script.MathJax.elementJax.root, span, div, frame;
|
||||
var jax = script.MathJax.elementJax, math = jax.root, span, div, frame;
|
||||
span = div = frame = this.Element("span",{
|
||||
className:"MathJax", oncontextmenu:this.ContextMenu, onmousedown: this.Mousedown,
|
||||
onmouseover:this.Mouseover, onclick:this.Click, ondblclick:this.DblClick
|
||||
className:"MathJax", isMathJax:true, jaxID:this.id, id:jax.inputID+"-Span",
|
||||
oncontextmenu:EVENT.Menu, onmousedown: EVENT.Mousedown,
|
||||
onmouseover:EVENT.Mouseover, onmouseout: EVENT.Mouseout, onmousemove: EVENT.Mousemove,
|
||||
onclick:EVENT.Click, ondblclick:EVENT.DblClick
|
||||
});
|
||||
if (MathJax.Hub.Browser.noContextMenu) {
|
||||
span.ontouchstart = TOUCH.start;
|
||||
span.ontouchend = TOUCH.end;
|
||||
}
|
||||
var blockMode = (math.Get("display") === "block");
|
||||
if (blockMode) {
|
||||
div = frame = this.Element("div",{className:"MathJax_Display", style:{width:"100%", position:"relative"}});
|
||||
|
@ -400,6 +416,7 @@
|
|||
script.parentNode.insertBefore(frame,script); var isHidden;
|
||||
try {this.getScales(span); isHidden = (this.em === 0 || String(this.em) === "NaN")} catch (err) {isHidden = true}
|
||||
if (isHidden) {this.hiddenDiv.appendChild(frame); this.getScales(span)}
|
||||
jax.em = this.em; jax.outerEm = this.outerEm; jax.scale = this.scale;
|
||||
this.initImg(span);
|
||||
this.initHTML(math,span);
|
||||
math.setTeXclass();
|
||||
|
@ -411,57 +428,45 @@
|
|||
if (this.useProcessingFrame) frame.parentNode.replaceChild(div,frame);
|
||||
},
|
||||
|
||||
/*
|
||||
* Autoload the MathMenu code, when needed
|
||||
*/
|
||||
ContextMenu: function (event,force) {
|
||||
if (HTMLCSS.config.showMathMenu && (HTMLCSS.settings.context === "MathJax" || force)) {
|
||||
if (HTMLCSS.safariContextMenuBug) {setTimeout('window.getSelection().empty()',0)}
|
||||
if (!event || HTMLCSS.msieEventBug) {event = window.event}
|
||||
var MENU = MathJax.Menu;
|
||||
if (MENU) {
|
||||
var math = (this.parentNode.className === "MathJax_Display" ? this.parentNode : this)
|
||||
MENU.jax = HUB.getJaxFor(math.nextSibling);
|
||||
MENU.menu.items[1].menu.items[1].name =
|
||||
(MENU.jax.inputJax.id === "MathML" ? "Original" : MENU.jax.inputJax.id);
|
||||
return MENU.menu.Post(event);
|
||||
} else {
|
||||
if (!AJAX.loadingMathMenu) {
|
||||
AJAX.loadingMathMenu = true;
|
||||
var EVENT = {pageX:event.pageX, pageY:event.pageY, clientX:event.clientX, clientY:event.clientY};
|
||||
MathJax.Callback.Queue(
|
||||
AJAX.Require("[MathJax]/extensions/MathMenu.js"),
|
||||
function () {delete AJAX.loadingMathMenu},
|
||||
[this,arguments.callee,EVENT,force] // call this function again
|
||||
);
|
||||
}
|
||||
if (!event) {event = window.event}
|
||||
if (event.preventDefault) {event.preventDefault()}
|
||||
if (event.stopPropagation) {event.stopPropagation()}
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
getJaxFromMath: function (math) {
|
||||
if (math.parentNode.className === "MathJax_Display") {math = math.parentNode}
|
||||
return HUB.getJaxFor(math.nextSibling);
|
||||
},
|
||||
Mousedown: function (event) {
|
||||
if (HTMLCSS.config.showMathMenu) {
|
||||
if (!event) {event = window.event}
|
||||
if (HTMLCSS.settings.context === "MathJax") {
|
||||
if (!HTMLCSS.noContextMenuBug || event.button !== 2) return
|
||||
} else {
|
||||
if (!event[HTMLCSS.MENUKEY] || event.button !== HTMLCSS.LEFTBUTTON) return
|
||||
}
|
||||
return HTMLCSS.ContextMenu.call(this,event,true);
|
||||
}
|
||||
getHoverSpan: function (jax) {return jax.root.HTMLspanElement()},
|
||||
getHoverBBox: function (jax,span) {
|
||||
var bbox = span.bbox, em = jax.outerEm;
|
||||
var BBOX = {w:bbox.w*em, h:bbox.h*em, d:bbox.d*em};
|
||||
if (bbox.width) {BBOX.width = bbox.width}
|
||||
return BBOX;
|
||||
},
|
||||
|
||||
Zoom: function (root,span,math,Mw,Mh) {
|
||||
//
|
||||
// Re-render at larger size
|
||||
//
|
||||
span.className = "MathJax"; this.getScales(span,span);
|
||||
this.idPostfix = "-zoom"; root.toHTML(span,span); this.idPostfix = "";
|
||||
var width = root.HTMLspanElement().bbox.width;
|
||||
if (width) {
|
||||
// Handle full-width displayed equations
|
||||
// FIXME: this is a hack for now
|
||||
span.style.width = Math.floor(Mw-1.5*HTMLCSS.em)+"px"; span.style.display="inline-block";
|
||||
var id = (root.id||"MathJax-Span-"+root.spanID)+"-zoom";
|
||||
var child = document.getElementById(id).firstChild;
|
||||
while (child && child.style.width !== width) {child = child.nextSibling}
|
||||
if (child) {child.style.width = "100%"}
|
||||
}
|
||||
//
|
||||
// Get height and width of zoomed math and original math
|
||||
//
|
||||
span.style.position = math.style.position = "absolute";
|
||||
var zW = span.offsetWidth, zH = span.offsetHeight,
|
||||
mH = math.offsetHeight, mW = math.offsetWidth;
|
||||
if (mW === 0) {mW = math.parentNode.offsetWidth}; // IE7 gets mW == 0?
|
||||
span.style.position = math.style.position = "";
|
||||
//
|
||||
return {Y:-EVENT.getBBox(span).h, mW:mW, mH:mH, zW:zW, zH:zH};
|
||||
},
|
||||
/*
|
||||
* Used for zooming, when that is enabled by the MathMenu
|
||||
*/
|
||||
Mouseover: function (event) {HTMLCSS.HandleEvent(event,"Mouseover",this)},
|
||||
Click: function (event) {HTMLCSS.HandleEvent(event,"Click",this)},
|
||||
DblClick: function (event) {HTMLCSS.HandleEvent(event,"DblClick",this)},
|
||||
HandleEvent: function (event,type,math) {},
|
||||
|
||||
initImg: function (span) {},
|
||||
initHTML: function (math,span) {},
|
||||
|
@ -599,6 +604,7 @@
|
|||
|
||||
createStrut: function (span,h,before) {
|
||||
var strut = this.Element("span",{
|
||||
isMathJax: true,
|
||||
style:{display:"inline-block", overflow:"hidden", height:h+"px",
|
||||
width:"1px", marginRight:"-1px"}
|
||||
});
|
||||
|
@ -607,13 +613,14 @@
|
|||
},
|
||||
createBlank: function (span,w,before) {
|
||||
var blank = this.Element("span",{
|
||||
isMathJax: true,
|
||||
style: {display:"inline-block", overflow:"hidden", height:"1px", width:this.Em(w)}
|
||||
});
|
||||
if (before) {span.insertBefore(blank,span.firstChild)} else {span.appendChild(blank)}
|
||||
return blank;
|
||||
},
|
||||
createShift: function (span,w,before) {
|
||||
var space = this.Element("span",{style:{marginLeft:this.Em(w)}});
|
||||
var space = this.Element("span",{style:{marginLeft:this.Em(w)}, isMathJax:true});
|
||||
if (before) {span.insertBefore(space,span.firstChild)} else {span.appendChild(space)}
|
||||
return space;
|
||||
},
|
||||
|
@ -627,7 +634,7 @@
|
|||
};
|
||||
span.style.height = H; span.style.verticalAlign = D;
|
||||
} else {
|
||||
span = this.addElement(span,"span",{style: {height:H, verticalAlign:D}});
|
||||
span = this.addElement(span,"span",{style: {height:H, verticalAlign:D}, isMathJax:true});
|
||||
}
|
||||
if (w >= 0) {
|
||||
span.style.width = this.Em(w);
|
||||
|
@ -655,7 +662,7 @@
|
|||
var rule = this.addElement(span,"span",{
|
||||
style: {borderLeft: color, display: "inline-block", overflow:"hidden",
|
||||
width:0, height:H, verticalAlign:D},
|
||||
bbox: {h:h, d:d, w:w, rw:w, lw:0}, noAdjust: true
|
||||
bbox: {h:h, d:d, w:w, rw:w, lw:0}, noAdjust: true, isMathJax: true
|
||||
});
|
||||
if (w > 0 && rule.offsetWidth == 0) {rule.style.width = this.Em(w)}
|
||||
if (span.isBox || span.className == "mspace") {span.bbox = rule.bbox}
|
||||
|
@ -667,7 +674,7 @@
|
|||
var B = this.Em(t)+" "+style;
|
||||
var frame = this.addElement(span,"span",{
|
||||
style: {border: B, display:"inline-block", overflow:"hidden", width:W, height:H},
|
||||
bbox: {h:h, d:d, w:w, rw:w, lw:0}, noAdjust: true
|
||||
bbox: {h:h, d:d, w:w, rw:w, lw:0}, noAdjust: true, isMathJax: true
|
||||
});
|
||||
if (D) {frame.style.verticalAlign = D}
|
||||
return frame;
|
||||
|
@ -678,7 +685,7 @@
|
|||
var relativeW = String(w).match(/%$/);
|
||||
var W = (!relativeW && w != null ? w : 0);
|
||||
span = this.addElement(span,"span",{
|
||||
noAdjust: true,
|
||||
noAdjust: true, isMathJax: true,
|
||||
style: {display:"inline-block", position:"relative",
|
||||
width:(relativeW ? "100%" : this.Em(W)), height:0}
|
||||
});
|
||||
|
@ -692,7 +699,7 @@
|
|||
return span;
|
||||
},
|
||||
createBox: function (span,w) {
|
||||
var box = this.addElement(span,"span",{style:{position:"absolute"}, isBox: true});
|
||||
var box = this.addElement(span,"span",{style:{position:"absolute"}, isBox: true, isMathJax:true});
|
||||
if (w != null) {box.style.width = w}
|
||||
return box;
|
||||
},
|
||||
|
@ -701,6 +708,7 @@
|
|||
return span.appendChild(box);
|
||||
},
|
||||
placeBox: function (span,x,y,noclip) {
|
||||
span.isMathJax = true;
|
||||
var parent = span.parentNode, bbox = span.bbox, BBOX = parent.bbox;
|
||||
if (this.msiePlaceBoxBug) {this.addText(span,this.NBSP)}
|
||||
if (this.imgSpaceBug) {this.addText(span,this.imgSpace)}
|
||||
|
@ -708,9 +716,14 @@
|
|||
var HH = span.offsetHeight/this.em + 1, dx = 0;
|
||||
if (span.noAdjust) {HH -= 1} else {
|
||||
if (this.msieInlineBlockAlignBug) {
|
||||
this.addElement(span,"img",{className:"MathJax_strut",border:0,src:"about:blank",style:{width:0,height:this.Em(HH)}});
|
||||
this.addElement(span,"img",{
|
||||
className:"MathJax_strut", border:0, src:"about:blank", isMathJax:true,
|
||||
style:{width:0,height:this.Em(HH)}
|
||||
});
|
||||
} else {
|
||||
this.addElement(span,"span",{style:{display:"inline-block",width:0,height:this.Em(HH)}});
|
||||
this.addElement(span,"span",{
|
||||
isMathJax: true, style:{display:"inline-block",width:0,height:this.Em(HH)}
|
||||
});
|
||||
}
|
||||
}
|
||||
span.style.top = this.Em(-y-HH);
|
||||
|
@ -892,6 +905,7 @@
|
|||
this.setStackWidth(stack,span.bbox.w);
|
||||
},
|
||||
createChar: function (span,data,scale,font) {
|
||||
span.isMathJax = true;
|
||||
var SPAN = span, text = "", variant = {fonts: [data[1]], noRemap:true};
|
||||
if (font && font === MML.VARIANT.BOLD) {variant.fonts = [data[1]+"-bold",data[1]]}
|
||||
if (typeof(data[1]) !== "string") {variant = data[1]}
|
||||
|
@ -899,7 +913,9 @@
|
|||
for (var i = 0, m = data[0].length; i < m; i++) {text += String.fromCharCode(data[0][i])}
|
||||
} else {text = String.fromCharCode(data[0])}
|
||||
if (scale !== 1) {
|
||||
SPAN = this.addElement(span,"span",{style:{fontSize: this.Percent(scale)}, scale:scale});
|
||||
SPAN = this.addElement(span,"span",{
|
||||
style:{fontSize: this.Percent(scale)}, scale:scale, isMathJax: true
|
||||
});
|
||||
this.handleVariant(SPAN,variant,text);
|
||||
span.bbox = SPAN.bbox;
|
||||
} else {this.handleVariant(span,variant,text)}
|
||||
|
@ -979,7 +995,7 @@
|
|||
if (newtext.length) {this.addText(SPAN,newtext); newtext = ""}
|
||||
SPAN = span; SPANV = spanv;
|
||||
if (variant !== SPANV)
|
||||
{if (SPANV) {SPAN = this.addElement(span,"span")} else {spanv = variant}}
|
||||
{if (SPANV) {SPAN = this.addElement(span,"span",{isMathJax:true})} else {spanv = variant}}
|
||||
this.handleFont(SPAN,font,SPAN !== span);
|
||||
SPANV = variant;
|
||||
}
|
||||
|
@ -1287,15 +1303,15 @@
|
|||
return SPAN;
|
||||
}
|
||||
}
|
||||
if (this.href) {span = HTMLCSS.addElement(span,"a",{href:this.href})}
|
||||
span = HTMLCSS.addElement(span,"span",{className: this.type});
|
||||
if (this.href) {span = HTMLCSS.addElement(span,"a",{href:this.href, isMathJax:true})}
|
||||
span = HTMLCSS.addElement(span,"span",{className: this.type, isMathJax:true});
|
||||
if (HTMLCSS.imgHeightBug) {span.style.display = "inline-block"}
|
||||
if (this["class"] != null) {span.className += " "+this["class"]}
|
||||
if (this.style) {
|
||||
span.style.cssText = this.style;
|
||||
if (span.style.fontSize) {this.mathsize = span.style.fontSize; span.style.fontSize = ""}
|
||||
}
|
||||
this.spanID = HTMLCSS.GetID();
|
||||
if (!this.spanID) {this.spanID = HTMLCSS.GetID()}
|
||||
span.id = (this.id || "MathJax-Span-"+this.spanID) + HTMLCSS.idPostfix;
|
||||
span.bbox = {w:0, h:0, d:0, lw:0, lr:0};
|
||||
if (this.href) {span.parentNode.bbox = span.bbox}
|
||||
|
@ -1339,6 +1355,7 @@
|
|||
var H = span.bbox.h + span.bbox.d, D = -span.bbox.d;
|
||||
if (W > 0) {W += 2*dd; lW -= dd}; if (H > 0) {H += 2*dd; D -= dd}; rW = -W-lW;
|
||||
var frame = HTMLCSS.Element("span",{id:"MathJax-Color-"+this.spanID+HTMLCSS.idPostfix,
|
||||
isMathJax: true,
|
||||
style:{display:"inline-block", backgroundColor:values.mathbackground,
|
||||
width: HTMLCSS.Em(W), height:HTMLCSS.Em(H), verticalAlign: HTMLCSS.Em(D),
|
||||
marginLeft: HTMLCSS.Em(lW), marginRight: HTMLCSS.Em(rW)}
|
||||
|
@ -1347,7 +1364,7 @@
|
|||
frame.style.position = "relative"; frame.style.width = frame.style.height = 0;
|
||||
frame.style.verticalAlign = frame.style.marginLeft = frame.style.marginRight = "";
|
||||
HTMLCSS.placeBox(HTMLCSS.addElement(frame,"span",{
|
||||
noAdjust: true,
|
||||
noAdjust: true, isMathJax: true,
|
||||
style: {display:"inline-block", position:"absolute", overflow:"hidden",
|
||||
width: HTMLCSS.Em(W), height: HTMLCSS.Em(H),
|
||||
background: values.mathbackground}
|
||||
|
@ -2081,7 +2098,7 @@
|
|||
MML.math.Augment({
|
||||
toHTML: function (span,node) {
|
||||
var alttext = this.Get("alttext"); if (alttext) {node.setAttribute("aria-label",alttext)}
|
||||
var nobr = HTMLCSS.addElement(span,"nobr");
|
||||
var nobr = HTMLCSS.addElement(span,"nobr",{isMathJax: true});
|
||||
span = this.HTMLcreateSpan(nobr);
|
||||
var stack = HTMLCSS.createStack(span), box = HTMLCSS.createBox(stack), math;
|
||||
// Move font-size from outer span to stack to avoid line separation
|
||||
|
@ -2131,7 +2148,8 @@
|
|||
}
|
||||
}
|
||||
return span;
|
||||
}
|
||||
},
|
||||
HTMLspanElement: MML.mbase.prototype.HTMLspanElement
|
||||
});
|
||||
|
||||
MML.TeXAtom.Augment({
|
||||
|
@ -2169,6 +2187,7 @@
|
|||
});
|
||||
|
||||
HUB.Register.StartupHook("End Config",function () {
|
||||
|
||||
//
|
||||
// Handle browser-specific setup
|
||||
//
|
||||
|
@ -2186,7 +2205,6 @@
|
|||
HTMLCSS.Augment({
|
||||
getMarginScale: HTMLCSS.getMSIEmarginScale,
|
||||
PaddingWidthBug: true,
|
||||
msieEventBug: browser.isIE9,
|
||||
msieAccentBug: true,
|
||||
msieColorBug: true,
|
||||
msieColorPositionBug: true, // needs position:relative to put color behind text
|
||||
|
@ -2229,7 +2247,6 @@
|
|||
Safari: function (browser) {
|
||||
var v3p0 = browser.versionAtLeast("3.0");
|
||||
var v3p1 = browser.versionAtLeast("3.1");
|
||||
browser.isMobile = (navigator.appVersion.match(/Mobile/i) != null);
|
||||
var android = (navigator.appVersion.match(/ Android (\d+)\.(\d+)/));
|
||||
var forceImages = (v3p1 && browser.isMobile && (
|
||||
(navigator.platform.match(/iPad|iPod|iPhone/) && !browser.versionAtLeast("5.0")) ||
|
||||
|
@ -2248,7 +2265,6 @@
|
|||
rfuzz: .011,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
safariContextMenuBug: true,
|
||||
safariNegativeSpaceBug: true,
|
||||
safariVerticalAlignBug: !v3p1,
|
||||
safariTextNodeBug: !v3p0,
|
||||
|
@ -2303,8 +2319,7 @@
|
|||
|
||||
Konqueror: function (browser) {
|
||||
HTMLCSS.Augment({
|
||||
konquerorVerticalAlignBug: true,
|
||||
noContextMenuBug: true
|
||||
konquerorVerticalAlignBug: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,15 +24,13 @@
|
|||
|
||||
MathJax.OutputJax.NativeMML = MathJax.OutputJax({
|
||||
id: "NativeMML",
|
||||
version: "1.1.6",
|
||||
version: "1.1.9",
|
||||
directory: MathJax.OutputJax.directory + "/NativeMML",
|
||||
extensionDir: MathJax.OutputJax.extensionDir + "/NativeMML",
|
||||
|
||||
config: {
|
||||
scale: 100, // scaling factor for all math
|
||||
showMathMenu: true, // attach math context menu to mathml?
|
||||
showMathMenuMSIE: true, // separtely determine if MSIE should have math menu
|
||||
// (since the code for that is a bit delicate)
|
||||
|
||||
styles: {
|
||||
"DIV.MathJax_MathML": {
|
||||
"text-align": "center",
|
||||
|
|
|
@ -22,21 +22,33 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function (nMML,HUB,AJAX) {
|
||||
(function (nMML,HUB,AJAX,HTML) {
|
||||
var MML, isMSIE = HUB.Browser.isMSIE;
|
||||
|
||||
var EVENT, TOUCH, HOVER, ZOOM; // filled in later
|
||||
|
||||
HUB.Register.StartupHook("MathZoom Ready",function () {ZOOM = MathJax.Extension.MathZoom});
|
||||
|
||||
nMML.Augment({
|
||||
LEFTBUTTON: (isMSIE ? 1 : 0), // the event.button value for left button
|
||||
MENUKEY: "altKey", // the event value for alternate context menu
|
||||
noContextMenuBug: HUB.Browser.isKonequeror,
|
||||
msieQuirks: (isMSIE && !(document.compatMode === "BackCompat")),
|
||||
msieEventBug: HUB.Browser.isIE9,
|
||||
|
||||
//
|
||||
// User can configure styles
|
||||
//
|
||||
config: {styles: {}}, settings: HUB.config.menuSettings,
|
||||
Startup: function () {return MathJax.Ajax.Styles(this.config.styles)},
|
||||
config: {styles: {}},
|
||||
settings: HUB.config.menuSettings,
|
||||
|
||||
Startup: function () {
|
||||
// Set up event handling
|
||||
EVENT = MathJax.Extension.MathEvents.Event;
|
||||
TOUCH = MathJax.Extension.MathEvents.Touch;
|
||||
HOVER = MathJax.Extension.MathEvents.Hover;
|
||||
this.ContextMenu = EVENT.ContextMenu;
|
||||
this.Mousedown = EVENT.AltContextMenu;
|
||||
this.Mouseover = HOVER.Mouseover;
|
||||
this.Mouseout = HOVER.Mouseout;
|
||||
this.Mousemove = HOVER.Mousemove;
|
||||
// Set up styles
|
||||
return AJAX.Styles(this.config.styles);
|
||||
},
|
||||
Config: function () {
|
||||
this.SUPER(arguments).Config.call(this);
|
||||
if (this.settings.scale) {this.config.scale = this.settings.scale}
|
||||
|
@ -52,13 +64,14 @@
|
|||
"div.MathJax_MathContainer > span": {"text-align": align+"!important"}
|
||||
});
|
||||
}
|
||||
this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js");
|
||||
},
|
||||
//
|
||||
// Set up MathPlayer for IE on the first time through.
|
||||
//
|
||||
InitializeMML: function () {
|
||||
this.initialized = true;
|
||||
if (MathJax.Hub.Browser.isMSIE) {
|
||||
if (HUB.Browser.isMSIE) {
|
||||
try {
|
||||
//
|
||||
// Insert data needed to use MathPlayer for MathML output
|
||||
|
@ -97,25 +110,35 @@
|
|||
{prev.parentNode.removeChild(prev)}
|
||||
var math = script.MathJax.elementJax.root;
|
||||
var type = (math.Get("display") === "block" ? "div" : "span");
|
||||
var span = document.createElement(type), container = span;
|
||||
span.className = "MathJax_MathML"; span.style.fontSize = this.config.scale+"%";
|
||||
if (isMSIE && this.config.showMathMenuMSIE) {
|
||||
container = MathJax.HTML.addElement(span,"span",{
|
||||
className:"MathJax_MathContainer",
|
||||
style:{display:"inline-block",position:"relative"}
|
||||
});
|
||||
}
|
||||
math.toNativeMML(container);
|
||||
var span = HTML.Element(type,{
|
||||
className: "MathJax_MathML", style: {"font-size": this.config.scale+"%"}
|
||||
},[["span",{
|
||||
className:"MathJax_MathContainer", isMathJax: true, jaxID:this.id,
|
||||
style:{position:"relative", display:"inline-block", "white-space":"nowrap"}
|
||||
}, [["span",{isMathJax:true, style:{display:"inline-block"}}]] // for Firefox hover and zoom
|
||||
]]), container = span.firstChild;
|
||||
math.toNativeMML(container.firstChild);
|
||||
script.parentNode.insertBefore(span,script);
|
||||
if (isMSIE) {
|
||||
if (this.config.showMathMenuMSIE) {this.MSIEoverlay(span)}
|
||||
if (container.addEventListener) {
|
||||
container.addEventListener("contextmenu",EVENT.Menu,true);
|
||||
container.addEventListener("mouseover",EVENT.Mouseover,true);
|
||||
container.addEventListener("mouseout",EVENT.Mouseout,true);
|
||||
container.addEventListener("mousedown",EVENT.Mousedown,true);
|
||||
container.addEventListener("mouseup",EVENT.False,true);
|
||||
container.addEventListener("click",EVENT.Click,true);
|
||||
container.addEventListener("dblclick",EVENT.DblClick,true);
|
||||
} else {
|
||||
var config = (this.config.showMathMenuMSIE != null ? this : HUB).config;
|
||||
if (config.showMathMenuMSIE) {this.MSIEoverlay(container)}
|
||||
}
|
||||
} else {
|
||||
math = span.firstChild;
|
||||
math.oncontextmenu = this.ContextMenu;
|
||||
math.onmouseover = this.Mouseover;
|
||||
math.onmousedown = this.Mousedown;
|
||||
math.onclick = this.Click;
|
||||
math.ondblclick = this.DblClick;
|
||||
container.oncontextmenu = EVENT.Menu;
|
||||
container.onmouseover = EVENT.Mouseover;
|
||||
container.onmouseout = EVENT.Mouseout;
|
||||
container.onmousedown = EVENT.Mousedown;
|
||||
container.onclick = EVENT.Click;
|
||||
container.ondblclick = EVENT.DblClick;
|
||||
}
|
||||
},
|
||||
//
|
||||
|
@ -139,109 +162,56 @@
|
|||
//
|
||||
MSIEoverlay: function (span) {
|
||||
var math = span.firstChild;
|
||||
span.style.position = "absolute"; // so we can measure height/depth
|
||||
var HD = span.scrollHeight, W = span.offsetWidth;
|
||||
var tmp = MathJax.HTML.addElement(span,"img",{src:"about:blank",style:{width:0,height:HD+"px"}});
|
||||
var D = span.scrollHeight - HD; span.removeChild(tmp);
|
||||
span.style.position = ""; // back to normal
|
||||
var top, left, isDisplay = (span.parentNode.nodeName.toLowerCase() === "div");
|
||||
if (isDisplay && this.quirks) {top = -HD; left = Math.floor(-W/2)} else {top = D-HD, left = -W}
|
||||
MathJax.HTML.addElement(span,"span",{
|
||||
if (math.nodeName.toLowerCase() === "span") {math = math.firstChild}
|
||||
var bbox = this.getHoverBBox(null,math,{});
|
||||
HTML.addElement(span,"span",{
|
||||
style:{display:"inline-block", width:0, height:0, position:"relative"}
|
||||
},[["span",{
|
||||
style:{display:"inline-block", position:"absolute", left:left+"px", top:top+"px",
|
||||
width:math.offsetWidth+"px", height:HD+"px", cursor:"pointer",
|
||||
"background-color":"white", filter:"alpha(opacity=0)"},
|
||||
onmousedown: this.MSIEevent, oncontextmenu: this.MSIEevent, onclick: this.MSIEevent,
|
||||
/*onmouseup: this.MSIEevent,*/ onmousemove: this.MSIEevent, ondblclick: this.MSIEevent,
|
||||
onmouseover: this.MSIEevent, onmouseout: this.MSIEevent
|
||||
},[["span",{isMathJax: true, className: "MathJax_MathPlayer_Overlay",
|
||||
style:{
|
||||
display:"inline-block", position:"absolute",
|
||||
left:HOVER.Px(-bbox.w), top:HOVER.Px(-bbox.h-(bbox.y||0)-1),
|
||||
width:HOVER.Px(bbox.w), height:HOVER.Px(bbox.h+bbox.d), cursor:"pointer",
|
||||
"background-color":"white", filter:"alpha(opacity=0)"
|
||||
}
|
||||
}]]);
|
||||
HUB.Insert(span,{
|
||||
msieMath: math,
|
||||
onmousedown: this.MSIEevent, oncontextmenu: this.MSIEevent, onclick: this.MSIEevent,
|
||||
onmouseup: this.MSIEevent, onmousemove: this.MSIEevent, ondblclick: this.MSIEevent,
|
||||
onmouseover: this.MSIEevent, onmouseout: this.MSIEevent
|
||||
});
|
||||
},
|
||||
MSIEmath: function (span) {
|
||||
// display="block" seems to produce an extra span, so need extra firstChild
|
||||
var math = span.parentNode.previousSibling.firstChild;
|
||||
return (math.nodeName.toLowerCase() === "span" ? math.firstChild : math);
|
||||
MSIEevents: {
|
||||
mousedown:"Mousedown", contextmenu:"ContextMenu", click:"Click",
|
||||
mouseup:"Mouseup", mousemove:"Mousemove", dblclick: "DblClick",
|
||||
mouseover:"Mouseover", mouseout:"Mouseout"
|
||||
},
|
||||
MSIEevent: function () {
|
||||
var math = nMML.MSIEmath(this);
|
||||
var event = window.event;
|
||||
var action = nMML["MSIE"+event.type];
|
||||
if (action && action.call(nMML,event,math,this)) {return false}
|
||||
math.fireEvent("on"+event.type,event);
|
||||
return false;
|
||||
},
|
||||
MSIEmousedown: function (event,math,span) {
|
||||
if (event[this.MENUKEY] && event.button === this.LEFTBUTTON && this.settings.context !== "MathJax") {
|
||||
this.trapUp = this.trapClick = true;
|
||||
this.ContextMenu.call(span,event,true);
|
||||
return true;
|
||||
var type = nMML.MSIEevents[event.type];
|
||||
if (nMML[type] && nMML[type](event,this) === false) {return false}
|
||||
if (ZOOM && ZOOM.HandleEvent(event,type,this) === false) {return false}
|
||||
if (event.srcElement.className === "MathJax_MathPlayer_Overlay" && this.msieMath.fireEvent) {
|
||||
// for now, ignore all other events. This will disable MathPlayer's zoom
|
||||
// feature, but also its <maction> support.
|
||||
if (type === "ContextMenu") {this.msieMath.fireEvent("on"+event.type,event)}
|
||||
}
|
||||
if (this.MSIEzoomKeys && this.MSIEzoomKeys(event)) {this.trapUp = true; return true}
|
||||
return false;
|
||||
return EVENT.False(event);
|
||||
},
|
||||
MSIEcontextmenu: function (event,math,span) {
|
||||
if (this.settings.context === "MathJax") {
|
||||
this.trapUp = this.trapClick = true;
|
||||
this.ContextMenu.call(span,event,true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// Other event handlers are in MathZoom.js
|
||||
|
||||
//
|
||||
// Autoload the MathMenu code, when needed
|
||||
//
|
||||
ContextMenu: function (event,force) {
|
||||
if (nMML.config.showMathMenu && (nMML.settings.context === "MathJax" || force)) {
|
||||
if (nMML.safariContextMenuBug) {setTimeout('window.getSelection().empty()',0)}
|
||||
if (!event || nMML.msieEventBug) {event = window.event}
|
||||
var MENU = MathJax.Menu;
|
||||
if (MENU) {
|
||||
if (document.selection) {setTimeout("document.selection.empty()",0)}
|
||||
var script = (isMSIE ? this.parentNode.parentNode.nextSibling : this.parentNode.nextSibling);
|
||||
MENU.jax = HUB.getJaxFor(script);
|
||||
MENU.menu.items[1].menu.items[1].name =
|
||||
(MENU.jax.inputJax.id === "MathML" ? "Original" : MENU.jax.inputJax.id);
|
||||
delete nMML.trapClick; delete nMML.trapUp;
|
||||
return MENU.menu.Post(event);
|
||||
} else {
|
||||
if (!AJAX.loadingMathMenu) {
|
||||
AJAX.loadingMathMenu = true;
|
||||
var EVENT = {pageX:event.pageX, pageY:event.pageY, clientX:event.clientX, clientY:event.clientY};
|
||||
MathJax.Callback.Queue(
|
||||
AJAX.Require("[MathJax]/extensions/MathMenu.js"),
|
||||
function () {delete AJAX.loadingMathMenu},
|
||||
[this,arguments.callee,EVENT,force] // call this function again
|
||||
);
|
||||
}
|
||||
if (!event) {event = window.event}
|
||||
if (event.preventDefault) {event.preventDefault()}
|
||||
if (event.stopPropagation) {event.stopPropagation()}
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
getJaxFromMath: function (math) {return HUB.getJaxFor(math.parentNode.nextSibling)},
|
||||
getHoverSpan: function (jax,math) {return math.firstChild},
|
||||
getHoverBBox: function (jax,span,math) {return EVENT.getBBox(span.parentNode)},
|
||||
|
||||
Zoom: function (root,span,math,Mw,Mh) {
|
||||
root.toNativeMML(span,span);
|
||||
if (this.msieIE8HeightBug) {span.style.position = "absolute"}
|
||||
var mW = math.offsetWidth || math.scrollWidth,
|
||||
mH = math.offsetHeight || math.scrollHeight;
|
||||
var zW = span.offsetWidth, zH = span.offsetHeight;
|
||||
if (this.msieIE8HeightBug) {span.style.position = ""}
|
||||
return {Y:-EVENT.getBBox(span.parentNode).h, mW:mW, mH:mH, zW:zW, zH:zH}
|
||||
},
|
||||
Mousedown: function (event) {
|
||||
if (nMML.config.showMathMenu) {
|
||||
if (!event) {event = window.event}
|
||||
if (nMML.settings.context === "MathJax") {
|
||||
if (!nMML.noContextMenuBug || event.button !== 2) return
|
||||
} else {
|
||||
if (!event[nMML.MENUKEY] || event.button !== nMML.LEFTBUTTON) return
|
||||
}
|
||||
return nMML.ContextMenu.call(this,event,true);
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Used for zooming, when that is enabled by the MathMenu
|
||||
*/
|
||||
Mouseover: function (event) {nMML.HandleEvent(event,"Mouseover",this)},
|
||||
Click: function (event) {nMML.HandleEvent(event,"Click",this)},
|
||||
DblClick: function (event) {nMML.HandleEvent(event,"DblClick",this)},
|
||||
HandleEvent: function (event,type,math) {},
|
||||
|
||||
NAMEDSPACE: {
|
||||
negativeveryverythinmathspace: "-.0556em",
|
||||
|
@ -307,11 +277,12 @@
|
|||
//
|
||||
// Create a MathML element
|
||||
//
|
||||
NativeMMLelement: (
|
||||
isMSIE ?
|
||||
function (type) {return document.createElement("mjx:"+type)} :
|
||||
function (type) {return document.createElementNS(nMML.MMLnamespace,type)}
|
||||
)
|
||||
NativeMMLelement: function (type) {
|
||||
var math = (isMSIE ? document.createElement("mjx:"+type) :
|
||||
document.createElementNS(nMML.MMLnamespace,type));
|
||||
math.isMathJax = true;
|
||||
return math;
|
||||
}
|
||||
});
|
||||
|
||||
MML.mrow.Augment({
|
||||
|
@ -366,7 +337,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
if (MathJax.Hub.Browser.isFirefox) {
|
||||
if (HUB.Browser.isFirefox) {
|
||||
MML.mtable.Augment({
|
||||
toNativeMML: function (parent) {
|
||||
//
|
||||
|
@ -504,10 +475,25 @@
|
|||
//
|
||||
setTimeout(MathJax.Callback(["loadComplete",nMML,"jax.js"]),0);
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// Determine browser characteristics
|
||||
//
|
||||
HUB.Browser.Select({
|
||||
MSIE: function (browser) {
|
||||
var mode = (document.documentMode || 0);
|
||||
nMML.msieIE8HeightBug = (mode === 8);
|
||||
},
|
||||
Opera: function (browser) {
|
||||
nMML.operaPositionBug = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
HUB.Register.StartupHook("End Cookie",function () {
|
||||
if (HUB.config.menuSettings.zoom !== "None")
|
||||
{AJAX.Require("[MathJax]/extensions/MathZoom.js")}
|
||||
});
|
||||
|
||||
})(MathJax.OutputJax.NativeMML, MathJax.Hub, MathJax.Ajax);
|
||||
})(MathJax.OutputJax.NativeMML, MathJax.Hub, MathJax.Ajax, MathJax.HTML);
|
||||
|
|
Loading…
Reference in New Issue
Block a user