You are here

function jq_maphilight_init in jQuery Map Hilight 7

Same name and namespace in other branches
  1. 6 jq_maphilight.module \jq_maphilight_init()

Implements hook_init().

Add the jquery maphilight plugin code to all pages

File

./jq_maphilight.module, line 27
Configurable javascript based image map highlighting using the jquery maphilight plugin.

Code

function jq_maphilight_init() {
  if (_jq_maphilight_available() !== FALSE && variable_get('jq_maphilight_every_page', TRUE)) {
    if (module_exists('jquery_plugin')) {
      drupal_add_library('jquery_plugin', 'metadata');
    }
    drupal_add_library('jq_maphilight', 'jquery.maphilight');
    $settings = array(
      'jq_maphilight' => array(
        'fill' => variable_get('jq_maphilight_fill', 'true'),
        'fillColor' => variable_get('jq_maphilight_fillcolor', '000000'),
        'fillOpacity' => variable_get('jq_maphilight_fillopacity', 2) / 10,
        'stroke' => variable_get('jq_maphilight_stroke', 'true'),
        'strokeColor' => variable_get('jq_maphilight_strokecolor', 'ff0000'),
        'strokeOpacity' => variable_get('jq_maphilight_strokeopacity', 10) / 10,
        'strokeWidth' => variable_get('jq_maphilight_strokewidth', 2),
        'fade' => variable_get('jq_maphilight_fade', 'true'),
        'alwaysOn' => variable_get('jq_maphilight_alwayson', 'false'),
        'neverOn' => variable_get('jq_maphilight_neveron', 'false'),
        'groupBy' => variable_get('jq_maphilight_groupby', 'false'),
        'allMapsEnabled' => variable_get('jq_maphilight_all_maps_enabled', 'true'),
      ),
    );
    drupal_add_js($settings, 'setting');
    drupal_add_js(drupal_get_path('module', 'jq_maphilight') . '/jq_maphilight.js');
  }
}