diff --git a/colorbox-display.js b/colorbox-display.js index 811095a..921eb67 100644 --- a/colorbox-display.js +++ b/colorbox-display.js @@ -20,19 +20,25 @@ Drupal.behaviors.mediaGalleryColorbox.attach = function (context, settings) { $link.attr('href', href.replace(/\/detail\/([0-9]+)\/([0-9]+)/, '/lightbox/$1/$2')); } $links.not('.meta-wrapper').colorbox({ - slideshow: true, - slideshowAuto: false, - slideshowStart: 'Slideshow', - slideshowStop: '[stop slideshow]', - slideshowSpeed: 4000, - current: "Item {current} of {total}", + slideshow: Drupal.settings.colorbox.slideshow, + slideshowAuto: Drupal.settings.colorbox.slideshowAuto, + slideshowStart: Drupal.settings.colorbox.slideshowStart, + slideshowStop: Drupal.settings.colorbox.slideshowStop, + slideshowSpeed: Drupal.settings.colorbox.slideshowSpeed, + current: Drupal.settings.colorbox.current, + next: Drupal.settings.colorbox.next, + previous: Drupal.settings.colorbox.previous, innerWidth: 'auto', + speed: Drupal.settings.colorbox.speed, + close:settings.colorbox.close, + overlayClose:settings.colorbox.overlayClose, // If 'title' evaluates to false, Colorbox will use the title from the // underlying element, which we don't want. Using a space is the // officially approved workaround. See // http://groups.google.com/group/colorbox/msg/7671ae69708950bf title: ' ', - transition: 'fade', + transition: Drupal.settings.colorbox.transition, + opacity: Drupal.settings.colorbox.opacity, preloading: true }); } @@ -74,3 +80,15 @@ Drupal.mediaGalleryColorbox.handleMediaYoutubeLoad = function (event, videoSetti // set the slideshow to restart when the video is done playing. } }; + +jQuery(document).ready(function() { + if (jQuery().colorbox) { + jQuery(".cboxElement").colorbox({ + onComplete:function(){ + var cboxTitle = jQuery("#mg-cbox-title").html(); + jQuery("#cboxTitle").html(cboxTitle); + } + }); + } +}); + diff --git a/media_gallery.css b/media_gallery.css index cad3938..5505193 100644 --- a/media_gallery.css +++ b/media_gallery.css @@ -550,14 +550,35 @@ a.media-gallery-thumb img, } .mg-lightbox-detail { - float: left; - padding-right: 320px; } .mg-lightbox-description { - width: 300px; - margin-left: -300px; - float: left; + width: auto; + position: absolute; + z-index: 10010; + padding: 0 8px; +} + +.mg-lightbox-description .mg-lightbox-description-inner { + overflow: auto; + height: 50px; +} + +.lightbox-stack .media-gallery-detail-info { + padding: 0; + margin: 0; +} + +.lightbox-has-description .media-gallery-detail-info { + padding: 0; + margin: 0; + height: 80px; +} + +.lightbox-stack .gallery-download, +.lightbox-stack .lightbox-view-detail, +.lightbox-stack .media-license { + padding: 0 8px; } .lightbox-stack { diff --git a/media_gallery.module b/media_gallery.module index cb76f3e..f132795 100644 --- a/media_gallery.module +++ b/media_gallery.module @@ -674,7 +674,7 @@ function media_gallery_block_save($delta = '', $edit = array()) { /** * Implements hook_library(). */ -function media_gallery_library() { +/*function media_gallery_library() { $library_path = variable_get('media_gallery_library_path', 'sites/all/libraries'); $stylesheet = variable_get('media_gallery_colorbox_stylesheet', 'example1'); $libraries['colorbox'] = array( @@ -692,7 +692,7 @@ function media_gallery_library() { ), ); return $libraries; -} +}*/ /** * Helper function to sort media gallery items by an ordered list of file IDs. diff --git a/media_gallery.theme.inc b/media_gallery.theme.inc index 1b6b635..31bcc15 100644 --- a/media_gallery.theme.inc +++ b/media_gallery.theme.inc @@ -193,7 +193,7 @@ function theme_media_gallery_media_item_lightbox($variables) { $link_vars['no_link'] = $element['#bundle'] == 'video' ? TRUE : FALSE; if ($gallery_node->getValue('media_gallery_allow_download') == TRUE) { - $download_link = $element['#bundle'] == 'video' ? l(t('View detail page'), $link_vars['link_path']) : theme('media_gallery_download_link', array('file' => $media_entity)); + $download_link = $element['#bundle'] == 'video' ? l(t('View detail page'), $link_vars['link_path'], array('attributes' => array('class' => array('lightbox-view-detail')))) : theme('media_gallery_download_link', array('file' => $media_entity)); } else { @@ -204,31 +204,32 @@ function theme_media_gallery_media_item_lightbox($variables) { $download_link = ' '; } + if (!empty($gallery_node->media_gallery_lightbox_extras[LANGUAGE_NONE][0]['value'])) { + $media_desc = '
' . + drupal_render_children($element['media_description']) . + '
'; + $media_desc_class = (!empty($element['media_description'])) ? ' lightbox-has-description' : ''; + $media_title = '
' . drupal_render($element['media_title']) . '
'; + } else { + $media_desc = ''; + $media_desc_class = ''; + } $media_gallery_detail = - '