You are here

function adaptive_image_init in Adaptive Image 7

Implements hook_init().

File

./adaptive_image.module, line 15
Adaptive Image - Adaptive images for Drupal

Code

function adaptive_image_init() {

  // According to the documentation of hook_init() it should not be used to
  // load JS or CSS. The CSS case has been moved to the info file. But the JS is
  // here by intention, as we want it inline to prevent wait time while loading
  // the script
  // No need for drupal behaviours, jquery compatibility wrapper nor ready event
  $js = "document.cookie = 'adaptive_image=' + Math.max(screen.width, screen.height) + '; path=/';";
  drupal_add_js($js, array(
    'type' => 'inline',
    'scope' => 'header',
    'group' => JS_LIBRARY,
    'every_page' => TRUE,
    'weight' => -500,
  ));
}