You are here

function ais_js_alter in Adaptive Image Styles (ais) 7

Implements hook_js_alter(). Loads the Adaptive javascript as early as possible

File

./ais.module, line 15
Adaptive Image Styles Module

Code

function ais_js_alter(&$javascript) {
  $ais = variable_get("ais_adaptive_styles", array());
  usort($ais, "_ais_cmp_styles");
  $javascript[] = array(
    'browsers' => array(),
    'type' => 'inline',
    'every_page' => 1,
    'group' => 0,
    'weight' => 0,
    'scope' => 'header',
    'cache' => 1,
    'defer' => NULL,
    'preprocess' => 1,
    'version' => NULL,
    'data' => "Drupal.settings.ais = " . drupal_json_encode($ais) . ";\nDrupal.settings.ais_method = \"" . variable_get("ais_adaptive_styles_method", 'both-max') . "\";",
  );
  $javascript['ais/assets/js/ais.js'] = array(
    'browsers' => array(),
    'weight' => 1,
    'type' => 'file',
    'group' => 0,
    'every_page' => 1,
    'scope' => 'header',
    'cache' => 1,
    'defer' => NULL,
    'preprocess' => 1,
    'version' => NULL,
    'data' => drupal_get_path('module', 'ais') . '/assets/js/ais.js',
  );
}