forked from asciidoctor/asciidoctor-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves asciidoctor#100, Update MathJax to 2.6.x
- Loading branch information
1 parent
e1a75a0
commit 390c457
Showing
901 changed files
with
99,602 additions
and
4,066 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* /MathJax/config/MMLorHTML.js | ||
* | ||
* Copyright (c) 2009-2015 The MathJax Consortium | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
(function(c,g){var f="2.6.0";var a=MathJax.Hub.CombineConfig("MMLorHTML",{prefer:{MSIE:"MML",Firefox:"HTML",Opera:"HTML",Chrome:"HTML",Safari:"HTML",other:"HTML"}});var e={Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4};var b=(g.version==="0.0"||g.versionAtLeast(e[g]||0));var d=(g.isFirefox&&g.versionAtLeast("1.5"))||(g.isMSIE&&g.hasMathPlayer)||(g.isSafari&&g.versionAtLeast("5.0"))||(g.isOpera&&g.versionAtLeast("9.52"));c.Register.StartupHook("End Config",function(){var h=(a.prefer&&typeof(a.prefer)==="object"?a.prefer[MathJax.Hub.Browser]||a.prefer.other||"HTML":a.prefer);if(b||d){if(d&&(h==="MML"||!b)){if(MathJax.OutputJax.NativeMML){MathJax.OutputJax.NativeMML.Register("jax/mml")}else{c.config.jax.unshift("output/NativeMML")}c.Startup.signal.Post("NativeMML output selected")}else{if(MathJax.OutputJax["HTML-CSS"]){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}else{c.config.jax.unshift("output/HTML-CSS")}c.Startup.signal.Post("HTML-CSS output selected")}}else{c.PreProcess.disabled=true;c.prepareScripts.disabled=true;MathJax.Message.Set(["MathJaxNotSupported","Your browser does not support MathJax"],null,4000);c.Startup.signal.Post("MathJax not supported")}})})(MathJax.Hub,MathJax.Hub.Browser);MathJax.Ajax.loadComplete("[MathJax]/config/MMLorHTML.js"); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ | ||
/* vim: set ts=2 et sw=2 tw=80: */ | ||
|
||
/************************************************************* | ||
* | ||
* MathJax/extensions/AssistiveMML.js | ||
* | ||
* Implements an extension that inserts hidden MathML into the | ||
* page for screen readers or other asistive technology. | ||
* | ||
* --------------------------------------------------------------------- | ||
* | ||
* Copyright (c) 2015 The MathJax Consortium | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
(function (AJAX,CALLBACK,HUB,HTML) { | ||
var SETTINGS = HUB.config.menuSettings; | ||
|
||
var AssistiveMML = MathJax.Extension["AssistiveMML"] = { | ||
version: "2.6.0", | ||
|
||
config: { | ||
disabled: false, | ||
styles: { | ||
".MJX_Assistive_MathML": { | ||
position:"absolute!important", | ||
top: 0, left: 0, | ||
clip: (HUB.Browser.isMSIE && (document.documentMode||0) < 8 ? | ||
"rect(1px 1px 1px 1px)" : "rect(1px, 1px, 1px, 1px)"), | ||
padding: "1px 0 0 0!important", | ||
border: "0!important", | ||
height: "1px!important", | ||
width: "1px!important", | ||
overflow: "hidden!important", | ||
display:"block!important" | ||
}, | ||
".MJX_Assistive_MathML.MJX_Assistive_MathML_Block": { | ||
width: "100%!important" | ||
} | ||
} | ||
}, | ||
|
||
Config: function () { | ||
if (!this.config.disabled && SETTINGS.assistiveMML == null) | ||
HUB.Config({menuSettings:{assistiveMML:true}}); | ||
AJAX.Styles(this.config.styles); | ||
HUB.Register.MessageHook("End Math",function (msg) { | ||
if (SETTINGS.assistiveMML) return AssistiveMML.AddAssistiveMathML(msg[1]) | ||
}); | ||
}, | ||
|
||
// | ||
// This sets up a state object that lists the jax and index into the jax, | ||
// and a dummy callback that is used to synchronizing with MathJax. | ||
// It will be called when the jax are all processed, and that will | ||
// let the MathJax queue continue (it will block until then). | ||
// | ||
AddAssistiveMathML: function (node) { | ||
var state = { | ||
jax: HUB.getAllJax(node), i: 0, | ||
callback: MathJax.Callback({}) | ||
}; | ||
this.HandleMML(state); | ||
return state.callback; | ||
}, | ||
|
||
// | ||
// This removes the data-mathml attribute and the assistive MathML from | ||
// all the jax. | ||
// | ||
RemoveAssistiveMathML: function (node) { | ||
var jax = HUB.getAllJax(node), frame; | ||
for (var i = 0, m = jax.length; i < m; i++) { | ||
frame = document.getElementById(jax[i].inputID+"-Frame"); | ||
if (frame && frame.getAttribute("data-mathml")) { | ||
frame.removeAttribute("data-mathml"); | ||
if (frame.lastChild && frame.lastChild.className.match(/MJX_Assistive_MathML/)) | ||
frame.removeChild(frame.lastChild); | ||
} | ||
} | ||
}, | ||
|
||
// | ||
// For each jax in the state, look up the frame. | ||
// If the jax doesn't use NativeMML and hasn't already been handled: | ||
// Get the MathML for the jax, taking resets into account. | ||
// Add a data-mathml attribute to the frame, and | ||
// Create a span that is not visible on screen and put the MathML in it, | ||
// and add it to the frame. | ||
// When all the jax are processed, call the callback. | ||
// | ||
HandleMML: function (state) { | ||
var m = state.jax.length, jax, mml, frame, span; | ||
while (state.i < m) { | ||
jax = state.jax[state.i]; | ||
frame = document.getElementById(jax.inputID+"-Frame"); | ||
if (jax.outputJax !== "NativeMML" && frame && !frame.getAttribute("data-mathml")) { | ||
try { | ||
mml = jax.root.toMathML("").replace(/\n */g,"").replace(/<!--.*?-->/g,""); | ||
} catch (err) { | ||
if (!err.restart) throw err; // an actual error | ||
return MathJax.Callback.After(["HandleMML",this,state],err.restart); | ||
} | ||
frame.setAttribute("data-mathml",mml); | ||
span = HTML.addElement(frame,"span",{ | ||
isMathJax: true, | ||
className: "MJX_Assistive_MathML" | ||
+ (jax.root.Get("display") === "block" ? " MJX_Assistive_MathML_Block" : "") | ||
}); | ||
span.innerHTML = mml; | ||
frame.style.position = "relative"; | ||
frame.setAttribute("role","presentation"); | ||
frame.firstChild.setAttribute("aria-hidden","true"); | ||
span.setAttribute("role","presentation"); | ||
} | ||
state.i++; | ||
} | ||
state.callback(); | ||
} | ||
|
||
}; | ||
|
||
HUB.Startup.signal.Post("AssistiveMML Ready"); | ||
|
||
})(MathJax.Ajax,MathJax.Callback,MathJax.Hub,MathJax.HTML); | ||
|
||
// | ||
// Make sure the toMathML extension is loaded before we signal | ||
// the load complete for this extension. Then wait for the end | ||
// of the user configuration before configuring this extension. | ||
// | ||
MathJax.Callback.Queue( | ||
["Require",MathJax.Ajax,"[MathJax]/extensions/toMathML.js"], | ||
["loadComplete",MathJax.Ajax,"[MathJax]/extensions/AssistiveMML.js"], | ||
function () { | ||
MathJax.Hub.Register.StartupHook("End Config",["Config",MathJax.Extension.AssistiveMML]); | ||
} | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ | ||
/* vim: set ts=2 et sw=2 tw=80: */ | ||
|
||
/************************************************************* | ||
* | ||
* MathJax/extensions/CHTML-preview.js | ||
* | ||
* Backward compatibility with old CHTML-preview extension. | ||
* | ||
* --------------------------------------------------------------------- | ||
* | ||
* Copyright (c) 2014-2015 The MathJax Consortium | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
MathJax.Callback.Queue( | ||
["Require",MathJax.Ajax,"[MathJax]/extensions/fast-preview.js"], | ||
["loadComplete",MathJax.Ajax,"[MathJax]/extensions/CHTML-preview.js"] | ||
); |
Oops, something went wrong.