You are here

function jstools_add_js in Javascript Tools 5

Same name and namespace in other branches
  1. 6 jstools.module \jstools_add_js()

Add a JavaScript file to the output.

The first time this function is invoked per page request, it adds jstools files to the output. Other jstools scripts depend on the methods and css in them.

7 calls to jstools_add_js()
activeedit_footer in activeedit/activeedit.module
Implementation of hook_footer().
activemenu_load in activemenu/activemenu.module
Load needed files.
activesearch_load in activesearch/activesearch.module
Load/set the required files and javascript for activesearch.
ajaxsubmit_load in ajaxsubmit/ajaxsubmit.module
Load needed files.
collapsiblock_load in collapsiblock/collapsiblock.module
Load needed files.

... See full list

File

./jstools.module, line 28
Provide common methods used by jstools package modules.

Code

function jstools_add_js($files) {
  static $core_sent;
  if (!$core_sent) {
    $path = drupal_get_path('module', 'jstools');
    drupal_add_js($path . '/jstools.js');
    drupal_add_js(array(
      'jstools' => array(
        'cleanurls' => (bool) variable_get('clean_url', '0'),
        'basePath' => base_path(),
      ),
    ), 'setting');
    $core_sent = TRUE;
  }
  if (is_array($files)) {
    foreach ($files as $file) {
      drupal_add_js($file);
    }
  }
  else {
    drupal_add_js($files);
  }
}