function a11y_apply_a11y in Accessibility toolkit 7
Callback to load the right js / css needed for supported plugins.
1 call to a11y_apply_a11y()
- a11y_a11y_block in ./
a11y.module - Renders the default a11y block.
File
- ./
a11y.module, line 411 - A11y accessibiliy toolkit module to help people.
Code
function a11y_apply_a11y() {
drupal_add_library('system', 'jquery.cookie');
drupal_add_js(drupal_get_path('module', 'a11y') . '/a11y.js', array(
'type' => 'file',
'scope' => 'footer',
'weight' => -1000,
));
// pass variables to js
$js_variables = array(
'a11y' => array(
'path' => base_path() . drupal_get_path('module', 'a11y') . '/',
'domain' => variable_get('a11y_domain', ''),
'factor' => 1,
),
);
$plugin_path = drupal_get_path('module', 'a11y') . '/plugins/';
$plugin_js_opts = array(
'type' => 'file',
'scope' => 'footer',
'weight' => 1000,
);
$sim_path = drupal_get_path('module', 'a11y') . '/simulations/';
if (variable_get('a11y_opendyslexic', 1)) {
$js_variables['a11y']['opendyslexic'] = 1;
drupal_add_js($plugin_path . 'opendyslexic/opendyslexic.js', $plugin_js_opts);
}
if (variable_get('a11y_contrast', 1)) {
$js_variables['a11y']['contrast'] = 1;
drupal_add_js($plugin_path . 'contrast/contrast.js', $plugin_js_opts);
}
if (variable_get('a11y_animation', 1)) {
$js_variables['a11y']['animation'] = 1;
drupal_add_js($plugin_path . 'animation/animation.js', $plugin_js_opts);
}
if (user_access('use voice commander')) {
$js_variables['a11y']['voicecommander'] = 1;
drupal_add_js($plugin_path . 'voicecommander/voicecommander.js', $plugin_js_opts);
if (variable_get('a11y_speechsynth', 1)) {
$js_variables['a11y']['speechsynth'] = 1;
$js_variables['a11y']['speechSynthSelector'] = variable_get('a11y_speechsynthSelector', 'article');
drupal_add_js($plugin_path . 'speechsynth/speechsynth.js', $plugin_js_opts);
}
}
if (variable_get('a11y_textsize', 1)) {
$js_variables['a11y']['textsize'] = 1;
drupal_add_js($plugin_path . 'textsize/textsize.js', $plugin_js_opts);
}
if (variable_get('a11y_sim_dyslexia', 1)) {
$js_variables['a11y']['sim']['dyslexia'] = 1;
}
if (variable_get('a11y_sim_field_loss', 1)) {
$js_variables['a11y']['sim']['field_loss'] = 1;
}
if (variable_get('a11y_sim_colorblind', 1)) {
$js_variables['a11y']['sim']['colorblind'] = 1;
}
drupal_add_js($js_variables, array(
'type' => 'setting',
'scope' => 'footer',
'weight' => 1000,
));
}