mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 19:57:46 -04:00
Add some MathJax checks and AMSmath support
Former-commit-id: 0aa283e8a81ccef805a5291ce542fadcd046cf5b [formerly 8035fadee8e63ab5cc921bbdc36305b0f10bffd8] Former-commit-id: a9c67045928e431a5b849de4c68ce589c8069564
This commit is contained in:
parent
3a2b534399
commit
f8917dec6d
@ -21,6 +21,6 @@
|
||||
<WindowsPhoneEmulatorID>F0AB49D8-754C-4531-A635-E6B4395FD39A;Mobile Emulator 10.0.15063.0 QHD 5.2 inch 3GB</WindowsPhoneEmulatorID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebuggerFlavor>AppHostDeviceDebugger</DebuggerFlavor>
|
||||
<DebuggerFlavor>AppHostLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -32,7 +32,7 @@
|
||||
<AppXManifest Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\bin\Release\AppxManifest.xml">
|
||||
<PackagePath>AppxManifest.xml</PackagePath>
|
||||
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
|
||||
<Modified>2017-08-07T05:59:43.248</Modified>
|
||||
<Modified>2017-08-07T07:17:46.496</Modified>
|
||||
</AppXManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -531,7 +531,7 @@
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\app.js">
|
||||
<PackagePath>www\js\app.js</PackagePath>
|
||||
<Modified>2017-08-07T05:50:10.176</Modified>
|
||||
<Modified>2017-08-07T06:45:19.435</Modified>
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\init.js">
|
||||
<PackagePath>www\js\init.js</PackagePath>
|
||||
@ -603,7 +603,7 @@
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\MathJax\config\config.js">
|
||||
<PackagePath>www\js\MathJax\config\config.js</PackagePath>
|
||||
<Modified>2017-08-05T18:18:34.635</Modified>
|
||||
<Modified>2017-08-07T07:17:27.329</Modified>
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\MathJax\extensions\a11y\accessibility-menu.js">
|
||||
<PackagePath>www\js\MathJax\extensions\a11y\accessibility-menu.js</PackagePath>
|
||||
@ -1456,7 +1456,7 @@
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\bin\Release\ReverseMap\resources.pri">
|
||||
<PackagePath>resources.pri</PackagePath>
|
||||
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
|
||||
<Modified>2017-08-07T05:58:16.299</Modified>
|
||||
<Modified>2017-08-07T06:40:52.194</Modified>
|
||||
</AppxPackagedFile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
11
bin/Release/AppX/www/js/MathJax/config/config.js
vendored
11
bin/Release/AppX/www/js/MathJax/config/config.js
vendored
@ -1,6 +1,9 @@
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js"],
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
TeX: {
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js"]
|
||||
},
|
||||
"HTML-CSS": {
|
||||
availableFonts: ["TeX"],
|
||||
imageFont: null
|
||||
@ -10,10 +13,4 @@ MathJax.Hub.Config({
|
||||
showFontMenu: false,
|
||||
showLocale: false
|
||||
}
|
||||
});
|
||||
function Typeset(element) {
|
||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, element]);
|
||||
}
|
||||
function Configured() {
|
||||
MathJax.Hub.Configured();
|
||||
}
|
||||
});
|
@ -1320,25 +1320,27 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
|
||||
//TESTING
|
||||
if (countImages <= maxVisibleSliceSize + prefetchSliceSize) { console.timeEnd("Time to Document Ready"); }
|
||||
|
||||
//Use the MathJax method of typesetting formulae if user has requested this
|
||||
if (params['useMathJax']) {
|
||||
var counter = 0;
|
||||
$(svgSlice).each(function () {
|
||||
var node = this;
|
||||
if (/mwe-math-fallback-image/i.test(node.className) && node.alt) {
|
||||
var text = node.alt;
|
||||
var script = document.createElement("script");
|
||||
script.type = "math/tex";
|
||||
script.text = text;
|
||||
$(this).replaceWith(script);
|
||||
console.log("Typesetting image #" + countImages + "...");
|
||||
countImages++;
|
||||
svgSlice.splice(counter, 1);
|
||||
} else {
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
window.frames[0].MathJax.Hub.Queue(["Typeset", window.frames[0].MathJax.Hub]);
|
||||
if (svgSlice.length) {
|
||||
//Use the MathJax method of typesetting formulae if user has requested this
|
||||
if (params['useMathJax'] && window.frames[0].MathJax) {
|
||||
var counter = 0;
|
||||
$(svgSlice).each(function () {
|
||||
var node = this;
|
||||
if (/mwe-math-fallback-image/i.test(node.className) && node.alt) {
|
||||
var text = node.alt;
|
||||
var script = document.createElement("script");
|
||||
script.type = "math/tex";
|
||||
script.text = text;
|
||||
$(this).replaceWith(script);
|
||||
console.log("Typesetting image #" + countImages + "...");
|
||||
countImages++;
|
||||
svgSlice.splice(counter, 1);
|
||||
} else {
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
window.frames[0].MathJax.Hub.Queue(["Typeset", window.frames[0].MathJax.Hub]);
|
||||
}
|
||||
}
|
||||
//If there are any SVGs left which were not dealt with by MathJax, process fallback images
|
||||
if (svgSlice.length) {
|
||||
|
11
www/js/MathJax/config/config.js
vendored
11
www/js/MathJax/config/config.js
vendored
@ -1,6 +1,9 @@
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js"],
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
TeX: {
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js"]
|
||||
},
|
||||
"HTML-CSS": {
|
||||
availableFonts: ["TeX"],
|
||||
imageFont: null
|
||||
@ -10,10 +13,4 @@ MathJax.Hub.Config({
|
||||
showFontMenu: false,
|
||||
showLocale: false
|
||||
}
|
||||
});
|
||||
function Typeset(element) {
|
||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, element]);
|
||||
}
|
||||
function Configured() {
|
||||
MathJax.Hub.Configured();
|
||||
}
|
||||
});
|
@ -1322,7 +1322,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
|
||||
|
||||
if (svgSlice.length) {
|
||||
//Use the MathJax method of typesetting formulae if user has requested this
|
||||
if (params['useMathJax']) {
|
||||
if (params['useMathJax'] && window.frames[0].MathJax) {
|
||||
var counter = 0;
|
||||
$(svgSlice).each(function () {
|
||||
var node = this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user