You are here

function speedboxes_init in Speedboxes - Fast checkbox handling 7

Implements hook_init().

File

./speedboxes.module, line 15
Drupal Module: Speedboxes.

Code

function speedboxes_init() {
  $allowed_paths = array(
    'admin/people/permissions',
    'admin/config/group/permissions/node/group',
  );
  if (!in_array($_GET['q'], $allowed_paths)) {
    return;
  }
  drupal_load('module', 'user');
  if (user_access('use speedboxes')) {
    $path = drupal_get_path('module', 'speedboxes');
    drupal_add_js($path . '/speedboxes-0.1b.js');
    drupal_add_js('
      var speedboxes  = {
        config          : {
          localization    : {
            check_all       : "' . t('Check all') . '",
            uncheck_all     : "' . t('Uncheck all') . '",
            reverse         : "' . t('Check reverse') . '"
          }
        }
      };
    ', 'inline');
    drupal_add_css($path . '/speedboxes-0.1b.css');
  }
}