You are here

function tableofcontents_init in Table of Contents 6.3

Same name and namespace in other branches
  1. 6.2 tableofcontents.module \tableofcontents_init()
  2. 7 tableofcontents.module \tableofcontents_init()

Implementation of hook_init()

We load the JS/CSS files here so we can cache the filter results.

File

./tableofcontents.module, line 33
This is a filter module to generate a collapsible jquery enabled mediawiki style table of contents based on <h[1-6]> tags. Transforms header tags into named anchors.

Code

function tableofcontents_init() {

  // we probably should not do that on non-node pages!
  // (how do you determine that?)
  $path = drupal_get_path('module', 'tableofcontents');
  drupal_add_js($path . '/jquery.scrollTo-min.js');
  drupal_add_js($path . '/jquery.localscroll-min.js');
  drupal_add_js($path . '/tableofcontents.js');
  drupal_add_css($path . '/tableofcontents.css');
}