You are here

function sharebar_init in ShareBar 7.2

Same name and namespace in other branches
  1. 6 sharebar.module \sharebar_init()
  2. 7 sharebar.module \sharebar_init()

Implements hook_init().

File

./sharebar.module, line 92
Various module information.

Code

function sharebar_init() {

  // Do not enable sharebar styles and js on admin pages.
  if (arg(0) != 'admin') {
    if (variable_get('sharebar_bar_onblock', TRUE)) {
      drupal_add_css(drupal_get_path('module', 'sharebar') . '/css/sharebar.css');
      drupal_add_js(drupal_get_path('module', 'sharebar') . '/js/sharebar.js');

      // If horizontal is true then display it.
      if (variable_get('sharebar_bar_horizontal', TRUE)) {
        $hori = 'TRUE';
        $width = variable_get('sharebar_bar_width', 1000);
        $swidth = variable_get('sharebar_bar_swidth', 75);
        $position = variable_get('sharebar_bar_position', 'none');
        $leftoffset = variable_get('sharebar_bar_leftoffset', 10);
        $rightoffset = variable_get('sharebar_bar_rightoffset', 10);
        $sharebarx = variable_get('sharebar_bar_idhorizontal', 'sharebarx');
        drupal_add_js('jQuery(document).ready(function($) { $(\'' . $sharebarx . '\').sharebar({horizontal:\'' . $hori . '\',swidth:\'' . $swidth . '\',minwidth:' . $width . ',position:\'' . $position . '\',leftOffset:' . $leftoffset . ',rightOffset:' . $rightoffset . '}); });', 'inline');
      }
    }
  }
}