math-print.js
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(function() {
var font = (window.opener.urlParams['math-font'] != null) ?
decodeURIComponent(window.opener.urlParams['math-font']) : 'TeX';
window.MathJax = {
showMathMenu: false,
messageStyle: 'none',
AuthorInit: function () {
MathJax.Hub.Config({
jax: ['input/TeX', 'input/MathML', 'input/AsciiMath'].concat(
[(window.opener.urlParams['math-output'] == 'html') ?
'output/HTML-CSS' : 'output/SVG']),
extensions: ['tex2jax.js', 'mml2jax.js', 'asciimath2jax.js', 'Safe.js'],
TeX: {
extensions:['AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js']
},
'HTML-CSS': {
availableFonts: [font],
imageFont: null
},
SVG: {
font: font,
useFontCache: false
},
tex2jax: {
ignoreClass: 'geDisableMathJax'
},
asciimath2jax: {
ignoreClass: 'geDisableMathJax'
}
});
}
};
var s = document.createElement('script');
s.setAttribute('type', 'text/javascript');
s.setAttribute('src', window.opener.DRAW_MATH_URL + '/MathJax.js');
// Waits for the Math to be rendered and then calls window.print
if (window.IMMEDIATE_PRINT)
{
var r = false;
s.onload = s.onreadystatechange = function()
{
if (!r && (!this.readyState || this.readyState == 'complete'))
{
MathJax.Hub.Queue(function ()
{
window.print();
});
}
};
}
var t = document.getElementsByTagName('script')[0];
if (t != null)
{
t.parentNode.insertBefore(s, t);
}
})();