Guest User

Untitled

a guest
Jun 12th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     a.ShowSource = function (t) {
  2.         if (!t) {
  3.             t = window.event
  4.         }
  5.         var s = {
  6.             screenX: t.screenX,
  7.             screenY: t.screenY
  8.         };
  9.         if (!a.jax) {
  10.             return
  11.         }
  12.         if (this.format === "MathML") {
  13.             var q = MathJax.ElementJax.mml;
  14.             if (q && typeof(q.mbase.prototype.toMathML) !== "undefined") {
  15.                 try {
  16.                     a.ShowSource.Text(a.jax.root.toMathML(), t)
  17.                 } catch (r) {
  18.                     if (!r.restart) {
  19.                         throw r
  20.                     }
  21.                     f.After([this, a.ShowSource, s])
  22.                 }
  23.             } else {
  24.                 if (!k.loadingToMathML) {
  25.                     k.loadingToMathML = true;
  26.                     a.ShowSource.Window(t);
  27.                     f.Queue(k.Require("[MathJax]/extensions/toMathML.js"), function () {
  28.                         delete k.loadingToMathML;
  29.                         if (!q.mbase.prototype.toMathML) {
  30.                             q.mbase.prototype.toMathML = function () {}
  31.                         }
  32.                     }, [this, a.ShowSource, s]);
  33.                     return
  34.                 }
  35.             }
  36.         } else {
  37.             if (a.jax.originalText == null) {
  38.                 alert("No original form available");
  39.                 return
  40.             }
  41.             a.ShowSource.Text(a.jax.originalText, t)
  42.         }
  43.     };
  44.     a.ShowSource.Window = function (r) {
  45.         if (!a.ShowSource.w) {
  46.             var s = [],
  47.                 q = o.windowSettings;
  48.             for (var t in q) {
  49.                 if (q.hasOwnProperty(t)) {
  50.                     s.push(t + "=" + q[t])
  51.                 }
  52.             }
  53.             a.ShowSource.w = window.open("", "_blank", s.join(","))
  54.         }
  55.         return a.ShowSource.w
  56.     };
  57.     a.ShowSource.Text = function (z, v) {
  58.         var s = a.ShowSource.Window(v);
  59.         z = z.replace(/^\s*/, "").replace(/\s*$/, "");
  60.         z = z.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  61.         if (a.isMobile) {
  62.             s.document.open();
  63.             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%'>");
  64.             s.document.write("<pre>" + z + "</pre>");
  65.             s.document.write("<hr><input type='button' value='Close' onclick='window.close()' />");
  66.             s.document.write("</body></html>");
  67.             s.document.close()
  68.         } else {
  69.             s.document.open();
  70.             s.document.write("<html><head><title>MathJax Equation Source</title></head><body style='font-size:85%'>");
  71.             s.document.write("<table><tr><td><pre>" + z + "</pre></td></tr></table>");
  72.             s.document.write("</body></html>");
  73.             s.document.close();
  74.             var u = s.document.body.firstChild;
  75.             var t = (s.outerHeight - s.innerHeight) || 30,
  76.                 r = (s.outerWidth - s.innerWidth) || 30;
  77.             r = Math.min(Math.floor(0.5 * screen.width), u.offsetWidth + r + 25);
  78.             t = Math.min(Math.floor(0.5 * screen.height), u.offsetHeight + t + 25);
  79.             s.resizeTo(r, t);
  80.             if (v && v.screenX != null) {
  81.                 var q = Math.max(0, Math.min(v.screenX - Math.floor(r / 2), screen.width - r - 20)),
  82.                     A = Math.max(0, Math.min(v.screenY - Math.floor(t / 2), screen.height - t - 20));
  83.                 s.moveTo(q, A)
  84.             }
  85.         }
  86.         delete a.ShowSource.w
  87.     };
Advertisement
Add Comment
Please, Sign In to add comment