You are here

function textsize_jq_cookie in Text Size 5

Note: By default the "jQuery Cookie Plugin" is required. Download the plugin from http://plugins.jquery.com/project/Cookie in the modul textsize.

1 call to textsize_jq_cookie()
textsize_init in ./textsize.module
Implement hook_init().

File

./textsize.module, line 364
Display a text size changer on the page for a better web accessibility.

Code

function textsize_jq_cookie() {
  if (!function_exists("drupal_get_path")) {
    function drupal_get_path($type, $name) {
      return dirname(drupal_get_filename($type, $name));
    }
  }
  if (function_exists('drupal_add_js')) {
    $textsize_jquery_cookie = drupal_get_path('module', 'textsize') . '/jquery.cookie.js';
    $jquery_cookie_plugin_link = l(t('jQuery Cookie plugin'), 'http://plugins.jquery.com/project/Cookie');
    if (!file_exists($textsize_jquery_cookie)) {
      drupal_set_message(t('The Text Size module require the !jquery_cookie_plugin_link.', array(
        '!jquery_cookie_plugin_link' => $jquery_cookie_plugin_link,
      )) . ' ' . t('Place the plugin (%jquery_cookie_js) in the module directory "%textsize_directory".', array(
        '%jquery_cookie_js' => 'jquery.cookie.js',
        '%textsize_directory' => drupal_get_path('module', 'textsize'),
      )), 'error');
    }
    elseif (file_exists($textsize_jquery_cookie)) {
      drupal_add_js(drupal_get_path('module', 'textsize') . '/jquery.cookie.js');
    }
  }
}