lib/main.js
function StartQueue() {
  data = callback = originalData = null;       //  clear existing equation, if any
  errors = sErrors; sErrors = [];              //  clear any errors
  if (!queue.length) return;    //  return if nothing to do

  serverState = STATE.BUSY;
  var result = {}, $$ = window.Array;

  //
  //  Get the math data and callback
  // and set the content with the proper script type
  //
  var item = queue.shift();
  data = item[0]; callback = item[1]; originalData = item[2];
  content.innerHTML = "";
  MathJax.HTML.addElement(content,"script",{type: "math/"+TYPES[data.format]},[data.math]);
  html.setAttribute("xmlns:"+data.xmlns,"http://www.w3.org/1998/Math/MathML");

  //
  //  Set the SVG and TeX parameters
  //  according to the requested data
  //
  var CHTML = MathJax.OutputJax.CommonHTML,
      SVG = MathJax.OutputJax.SVG,
      TEX = MathJax.InputJax.TeX,
      HUB = MathJax.Hub;

  SVG.defaultEx = CHTML.defaultEx = data.ex;
  SVG.defaultWidth = CHTMLdefaultWidth = data.width * data.ex;
  SVG.config.linebreaks.automatic = CHTML.config.linebreaks.automatic = data.linebreaks;
  SVG.config.linebreaks.width = CHTML.config.linebreaks.width = data.width * data.ex;
  SVG.config.useFontCache = data.useFontCache;
  SVG.config.useGlobalCache = data.useGlobalCache;
  TEX.config.equationNumbers.autoNumber = data.equationNumbers;

  //
  // Set the state from data.state or clear it
  //
  GetState(data.state);

  //
  // Get the renderer to use
  //
  var renderer = (
      (data.html || data.htmlNode || data.css) ? "CommonHTML" :
          (data.svg || data.svgNode) ? "SVG" : "None"
  );

  //
  //  Set up a timeout timer to restart MathJax if it runs too long,
  //  Then push the Typeset call, the MathML, speech, and SVG calls,
  //  and our TypesetDone routine
  //
  timer = setTimeout(RestartMathJax,data.timeout);
  HUB.Queue(
    $$(SetRenderer,renderer),
    $$("Process",HUB),
    $$(TypesetDone,result),
    $$(GetSpeech,result),
    $$(GetMML,result),
    $$(GetHTML,result),
    $$(RerenderSVG,result),
    $$(GetSVG,result),
    $$(ReturnResult,result)
  );
}
function StartQueue() {
  data = callback = originalData = null;       //  clear existing equation, if any
  errors = sErrors; sErrors = [];              //  clear any errors
  if (!queue.length) return;    //  return if nothing to do

  serverState = STATE.BUSY;
  var result = {}, $$ = window.Array;

  //
  //  Get the math data and callback
  // and set the content with the proper script type
  //
  var item = queue.shift();
  data = item[0]; callback = item[1]; originalData = item[2];
  content.innerHTML = "";
  MathJax.HTML.addElement(content,"script",{type: "math/"+TYPES[data.format]},[data.math]);
  html.setAttribute("xmlns:"+data.xmlns,"http://www.w3.org/1998/Math/MathML");

  //
  //  Set the SVG and TeX parameters
  //  according to the requested data
  //
  var CHTML = MathJax.OutputJax.CommonHTML,
      SVG = MathJax.OutputJax.SVG,
      TEX = MathJax.InputJax.TeX,
      HUB = MathJax.Hub;

  SVG.defaultEx = CHTML.defaultEx = data.ex;
  SVG.defaultWidth = CHTMLdefaultWidth = data.width * data.ex;
  SVG.config.linebreaks.automatic = CHTML.config.linebreaks.automatic = data.linebreaks;
  SVG.config.linebreaks.width = CHTML.config.linebreaks.width = data.width * data.ex;
  SVG.config.useFontCache = data.useFontCache;
  SVG.config.useGlobalCache = data.useGlobalCache;
  TEX.config.equationNumbers.autoNumber = data.equationNumbers;

  //
  // Set the state from data.state or clear it
  //
  GetState(data.state);

  //
  // Get the renderer to use
  //
  var renderer = (
      (data.html || data.htmlNode || data.css) ? "CommonHTML" :
          (data.svg || data.svgNode) ? "SVG" : "None"
  );

  //
  //  Set up a timeout timer to restart MathJax if it runs too long,
  //  Then push the Typeset call, the MathML, speech, and SVG calls,
  //  and our TypesetDone routine
  //
  timer = setTimeout(RestartMathJax,data.timeout);
  HUB.Queue(
    $$(SetRenderer,renderer),
    $$("Process",HUB),
    $$(TypesetDone,result),
    $$(GetSpeech,result),
    $$(GetMML,result),
    $$(GetHTML,result),
    $$(RerenderSVG,result),
    $$(GetSVG,result),
    $$(ReturnResult,result)
  );
}
function StartQueue ( ) { data = callback = originalData = null ; //  clear existing equation, if any errors = sErrors ; sErrors = [ ] ; //  clear any errors if ( ! queue . length ) return ; //  return if nothing to do serverState = STATE . BUSY ; var result = { } , $$ = window . Array ; // //  Get the math data and callback // and set the content with the proper script type // var item = queue . shift ( ) ; data = item [ 0 ] ; callback = item [ 1 ] ; originalData = item [ 2 ] ; content . innerHTML = "" ; MathJax . HTML . addElement ( content , "script" , { type : "math/" + TYPES [ data . format ] } , [ data . math ] ) ; html . setAttribute ( "xmlns:" + data . xmlns , "http://www.w3.org/1998/Math/MathML" ) ; // //  Set the SVG and TeX parameters //  according to the requested data // var CHTML = MathJax . OutputJax . CommonHTML , SVG = MathJax . OutputJax . SVG , TEX = MathJax . InputJax . TeX , HUB = MathJax . Hub ; SVG . defaultEx = CHTML . defaultEx = data . ex ; SVG . defaultWidth = CHTMLdefaultWidth = data . width * data . ex ; SVG . config . linebreaks . automatic = CHTML . config . linebreaks . automatic = data . linebreaks ; SVG . config . linebreaks . width = CHTML . config . linebreaks . width = data . width * data . ex ; SVG . config . useFontCache = data . useFontCache ; SVG . config . useGlobalCache = data . useGlobalCache ; TEX . config . equationNumbers . autoNumber = data . equationNumbers ; // // Set the state from data.state or clear it // GetState ( data . state ) ; // // Get the renderer to use // var renderer = ( ( data . html || data . htmlNode || data . css ) ? "CommonHTML" : ( data . svg || data . svgNode ) ? "SVG" : "None" ) ; // //  Set up a timeout timer to restart MathJax if it runs too long, //  Then push the Typeset call, the MathML, speech, and SVG calls, //  and our TypesetDone routine // timer = setTimeout ( RestartMathJax , data . timeout ) ; HUB . Queue ( $$ ( SetRenderer , renderer ) , $$ ( "Process" , HUB ) , $$ ( TypesetDone , result ) , $$ ( GetSpeech , result ) , $$ ( GetMML , result ) , $$ ( GetHTML , result ) , $$ ( RerenderSVG , result ) , $$ ( GetSVG , result ) , $$ ( ReturnResult , result ) ) ; }
Start typesetting the queued expressions
Start typesetting the queued expressions