function jstools_add_js in Javascript Tools 6
Same name and namespace in other branches
- 5 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.
File
- ./
jstools.module, line 15 - 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);
}
}