Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a.ShowSource = function (t) {
- if (!t) {
- t = window.event
- }
- var s = {
- screenX: t.screenX,
- screenY: t.screenY
- };
- if (!a.jax) {
- return
- }
- if (this.format === "MathML") {
- var q = MathJax.ElementJax.mml;
- if (q && typeof(q.mbase.prototype.toMathML) !== "undefined") {
- try {
- a.ShowSource.Text(a.jax.root.toMathML(), t)
- } catch (r) {
- if (!r.restart) {
- throw r
- }
- f.After([this, a.ShowSource, s])
- }
- } else {
- if (!k.loadingToMathML) {
- k.loadingToMathML = true;
- a.ShowSource.Window(t);
- f.Queue(k.Require("[MathJax]/extensions/toMathML.js"), function () {
- delete k.loadingToMathML;
- if (!q.mbase.prototype.toMathML) {
- q.mbase.prototype.toMathML = function () {}
- }
- }, [this, a.ShowSource, s]);
- return
- }
- }
- } else {
- if (a.jax.originalText == null) {
- alert("No original form available");
- return
- }
- a.ShowSource.Text(a.jax.originalText, t)
- }
- };
- a.ShowSource.Window = function (r) {
- if (!a.ShowSource.w) {
- var s = [],
- q = o.windowSettings;
- for (var t in q) {
- if (q.hasOwnProperty(t)) {
- s.push(t + "=" + q[t])
- }
- }
- a.ShowSource.w = window.open("", "_blank", s.join(","))
- }
- return a.ShowSource.w
- };
- a.ShowSource.Text = function (z, v) {
- var s = a.ShowSource.Window(v);
- z = z.replace(/^\s*/, "").replace(/\s*$/, "");
- z = z.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
- if (a.isMobile) {
- s.document.open();
- s.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%'>");
- s.document.write("<pre>" + z + "</pre>");
- s.document.write("<hr><input type='button' value='Close' onclick='window.close()' />");
- s.document.write("</body></html>");
- s.document.close()
- } else {
- s.document.open();
- s.document.write("<html><head><title>MathJax Equation Source</title></head><body style='font-size:85%'>");
- s.document.write("<table><tr><td><pre>" + z + "</pre></td></tr></table>");
- s.document.write("</body></html>");
- s.document.close();
- var u = s.document.body.firstChild;
- var t = (s.outerHeight - s.innerHeight) || 30,
- r = (s.outerWidth - s.innerWidth) || 30;
- r = Math.min(Math.floor(0.5 * screen.width), u.offsetWidth + r + 25);
- t = Math.min(Math.floor(0.5 * screen.height), u.offsetHeight + t + 25);
- s.resizeTo(r, t);
- if (v && v.screenX != null) {
- var q = Math.max(0, Math.min(v.screenX - Math.floor(r / 2), screen.width - r - 20)),
- A = Math.max(0, Math.min(v.screenY - Math.floor(t / 2), screen.height - t - 20));
- s.moveTo(q, A)
- }
- }
- delete a.ShowSource.w
- };
Advertisement
Add Comment
Please, Sign In to add comment