Override media gallery colorbox

Public

Remove the word "Item" from the start of the image counter string. Change the image click behaviour: instead of showing the image page it redirects to the next image and stays in the colorbox.

Create a new media_gallery_cbox_overrides.js file:

Get raw version
javascript
  1. (function ($) {
  2.  
  3. Drupal.behaviors.initColorboxDefaultStyle = {
  4. attach: function (context, settings) {
  5. $(document).bind('cbox_complete', function () {
  6. var cbox = $('#cboxCurrent');
  7. var newcontent = cbox.text().replace(/^Item /, '');
  8. cbox.text( newcontent );
  9.  
  10. /*
  11.   Redirects lightbox image click to advance to next image instead of opening image details.
  12.   Via http://drupal.org/node/1088738#comment-4362570
  13.   */
  14. $('.lightbox-stack .gallery-thumb-inner a').click(function(e) {
  15. e.preventDefault();
  16. $.colorbox.next();
  17. });
  18. });
  19. }
  20. };
  21.  
  22. })(jQuery);

And add it to your theme in template.php

Get raw version
php
  1. //source: http://drupal.org/node/1088738#comment-6823864
  2. function THEME_NAME_preprocess_page(&$variables, $hook) {
  3. if (isset ($variables['node']) && $variables['node']->type == "media_gallery") {
  4. drupal_add_js(drupal_get_path('theme', 'THEME_NAME') . '/media_gallery_cbox_overrides.js', array('group' => JS_THEME, 'weight' => 50));
  5. }
  6. }

Comments