function colorbox_swipe_page_build in Colorbox Swipe Gestures Support 7
Initialization of colorbox_swipe (on each page).
File
- ./
colorbox_swipe.module, line 11 - Helper module to recognize swipe events in lightbox. Mini Module developed by DROWL.de
Code
function colorbox_swipe_page_build(&$page) {
static $already_added = FALSE;
if ($already_added) {
return;
// Don't add the JavaScript and CSS multiple times.
}
// Only add the swipe support if colorbox is added on the page.
// Respect the lightbox settings.
// Do not load colorbox swipe during the Drupal installation process, e.g. if part
// of installation profiles.
if (!drupal_installation_attempted() && _colorbox_active()) {
if (($library_jquery_event_move = libraries_load('jquery.event.move')) && !empty($library_jquery_event_move['loaded']) && ($library_jquery_event_swipe = libraries_load('jquery.event.swipe')) && !empty($library_jquery_event_swipe['loaded'])) {
// We need jQuery UI!
drupal_add_library('system', 'ui');
$module_path = drupal_get_path('module', 'colorbox_swipe');
drupal_add_css($module_path . '/colorbox_swipe.css');
drupal_add_js($module_path . '/colorbox_swipe.js', array(
'scope' => 'footer',
));
}
$already_added = TRUE;
}
}