function labjs_init in LABjs 7
Implements hook_init().
File
- ./
labjs.module, line 13 - LABjs module
Code
function labjs_init() {
// Loads our loader first
// Normally we use JS_LIBRARY, but Google Analytics module uses JS_LIBRARY-1,
// then we use JS_LIBRARY-10. We should look for a more proper approach.
drupal_add_js(labjs_get_path(), array(
'group' => JS_LIBRARY - 10,
'weight' => -50,
'every_page' => 1,
'preprocess' => FALSE,
'inline' => TRUE,
));
if (module_exists('advagg')) {
// Add in LAB.js init function.
drupal_add_js(LABJS_EXCLUDE . "\n" . 'var $L = $LAB.setGlobalDefaults({AlwaysPreserveOrder:true});', array(
'group' => JS_LIBRARY - 10,
'weight' => -49,
'every_page' => 1,
'type' => 'inline',
'movable' => FALSE,
));
// Makes Google Analytics work.
drupal_add_js(LABJS_EXCLUDE . "\n" . '$L = $L.wait(function() {Drupal.scriptsready=true;jQuery(document).trigger("scripts-ready");});', array(
'group' => JS_THEME + 101,
'weight' => 20,
'every_page' => 1,
'type' => 'inline',
'scope' => 'footer',
'movable' => FALSE,
));
}
}