function jquery_touchpunch_js_alter in jQuery UI Touch Punch 7
Implements hook_js_alter().
File
- ./
jquery_touchpunch.module, line 75 - jquery_touchpunch.module
Code
function jquery_touchpunch_js_alter(&$javascript) {
if (variable_get('jquery_touchpunch_enabled', JQUERY_TOUCHPUNCH_ENABLED)) {
// Attach plugin only if it needs (only if ui.widget is available in the
// js array). Such ugly approach is used because of modules
// that attach jQuery.ui libraries by using drupal_add_js function. Of
// course, adding of a dependency in hook_libraries_alter would be more
// prefer, but this will not work with some contrib modules.
foreach ($javascript as $name => $js) {
if (strpos($name, 'ui.widget') !== FALSE) {
$variant = variable_get('jquery_touchpunch_compression_type', 'minified');
libraries_load('jquery.ui.touch-punch', $variant);
break;
}
}
}
}