You are here

function pagestyle_print_js_css in Page Style 5

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

Print Javascript and CSS in the head.

Return value

Link to the jquery.pagestyle.js and pagestyle.css.

1 call to pagestyle_print_js_css()
pagestyle_init in ./pagestyle.module
Implement hook_init().

File

./pagestyle.module, line 327
Display a style changer on the page and in the browser menue for a better web accessibility.

Code

function pagestyle_print_js_css() {
  $pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'js');
  $pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
  $pagestyle_path = drupal_get_path('module', 'pagestyle');
  $pagestyle_current = pagestyle_get_current($value = 'int');
  $pagestyle_javascript = variable_get('pagestyle_javascript', 1);
  $pagestyle = array(
    'black_white' => t('Black') . '/' . t('White'),
    'white_black' => t('White') . '/' . t('Black'),
    'yellow_blue' => t('Yellow') . '/' . t('Blue'),
    'standard' => t('Standard'),
  );
  if ($pagestyle_javascript == 1) {
    drupal_add_js('  var pagestyleCookieExpires = ' . $pagestyle_cookie_expires . ';
  var pagestyleCookieDomain = "' . $pagestyle_cookie_domain . '";
  var pagestylePath = "' . $pagestyle_path . '";
  var pagestyleCurrent = "' . $pagestyle_current . '";
  var pagestyle = new Array();
  pagestyle["black_white"] = "' . $pagestyle['black_white'] . '";
  pagestyle["white_black"] = "' . $pagestyle['white_black'] . '";
  pagestyle["yellow_blue"] = "' . $pagestyle['yellow_blue'] . '";
  pagestyle["standard"] = "' . $pagestyle['standard'] . '";
  var pagestyleCurrentText = "' . t("Current Style") . '";', 'inline');
    drupal_add_js(drupal_get_path('module', 'pagestyle') . '/jquery.pagestyle.js');
  }
  if (function_exists('drupal_add_css')) {
    if (file_exists(path_to_theme() . '/pagestyle.css')) {
      drupal_add_css(path_to_theme() . '/pagestyle.css');
    }
    elseif (file_exists(drupal_get_path('module', 'pagestyle') . '/pagestyle.css')) {
      drupal_add_css(drupal_get_path('module', 'pagestyle') . '/pagestyle.css');
    }
  }
}