You are here

function mathjax_init in MathJax: LaTeX for Drupal 6

Same name and namespace in other branches
  1. 7 mathjax.module \mathjax_init()

Implements hook_init().

File

./mathjax.module, line 21
MathJax module.

Code

function mathjax_init() {

  // Load Mathjax only on specified nodes.
  if (mathjax_active() && variable_get('mathjax_enabled', TRUE) && !drupal_match_path('filter/tips', $_GET['q'])) {
    drupal_add_js(drupal_get_path('module', 'mathjax') . '/mathjax.js');

    // Pass variables to mathjax.js
    $mathjax_path = variable_get('mathjax_use_cdn', TRUE) ? 'cdn' : base_path() . 'sites/all/libraries/mathjax' . '/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
    drupal_add_js(array(
      'mathjax' => array(
        'path' => $mathjax_path,
      ),
    ), 'setting');
  }
}