code: function waitForJavaScript() {
    if (window.MathJax) {
      // Amazon EC2: fix TeX font detection
      MathJax.Hub.Register.StartupHook('HTML-CSS Jax Startup', function () {
        var htmlCss = MathJax.OutputJax['HTML-CSS'];
        htmlCss.Font.checkWebFont = function (check, font, callback) {
          if (check.time(callback)) {
            return;
          }
          if (check.total === 0) {
            htmlCss.Font.testFont(font);
            setTimeout(check, 200);
          } else {
            callback(check.STATUS.OK);
          }
        };
      });
      MathJax.Hub.Queue(function () {
        window.status = 'done';
      });
    } else {
      setTimeout(function () {
        window.status = 'done';
      }, 2000);
    }
  }
docs: /* eslint-disable no-var, prefer-arrow-callback, func-names