commit 91f42c9e3d78e69fbc3b478da52821f937ee68fe
Author: Assos Assos <assos+forge@centrale-marseille.fr>
Date:   Wed May 28 22:38:43 2014 +0200

    Weekly update of contrib modules

diff --git a/drupal7/sites/all/modules/colorbox/colorbox.info b/drupal7/sites/all/modules/colorbox/colorbox.info
index 3ae0c589..7830b416 100644
--- a/drupal7/sites/all/modules/colorbox/colorbox.info
+++ b/drupal7/sites/all/modules/colorbox/colorbox.info
@@ -6,9 +6,9 @@ configure = admin/config/media/colorbox
 
 files[] = views/colorbox_handler_field_colorbox.inc
 
-; Information added by  packaging script on 2013-11-30
-version = "7.x-2.5"
+; Information added by Drupal.org packaging script on 2014-05-28
+version = "7.x-2.6"
 core = "7.x"
 project = "colorbox"
-datestamp = "1385815706"
+datestamp = "1401278628"
 
diff --git a/drupal7/sites/all/modules/colorbox/colorbox.make.example b/drupal7/sites/all/modules/colorbox/colorbox.make
similarity index 86%
rename from drupal7/sites/all/modules/colorbox/colorbox.make.example
rename to drupal7/sites/all/modules/colorbox/colorbox.make
index d11b4c85..66b47fab 100644
--- a/drupal7/sites/all/modules/colorbox/colorbox.make.example
+++ b/drupal7/sites/all/modules/colorbox/colorbox.make
@@ -1,6 +1,7 @@
 core = 7.x
 api = 2
 
+libraries[colorbox][type] = "libraries"
 libraries[colorbox][download][type] = "file"
 libraries[colorbox][download][url] = "https://github.com/jackmoore/colorbox/archive/1.x.zip"
 libraries[colorbox][directory_name] = "colorbox"
diff --git a/drupal7/sites/all/modules/colorbox/colorbox.module b/drupal7/sites/all/modules/colorbox/colorbox.module
index 816aee03..e5ea03db 100644
--- a/drupal7/sites/all/modules/colorbox/colorbox.module
+++ b/drupal7/sites/all/modules/colorbox/colorbox.module
@@ -44,6 +44,7 @@ function colorbox_theme() {
         'node' => NULL,  // Left for legacy support.
         'field' => array(),
         'display_settings' => array(),
+        'delta' => null,
       ),
       'file' => 'colorbox.theme.inc',
     ),
@@ -256,6 +257,7 @@ function colorbox_field_formatter_info() {
       'field types' => array('image'),
       'settings' => array(
         'colorbox_node_style' => '',
+        'colorbox_node_style_first' => '',
         'colorbox_image_style' => '',
         'colorbox_gallery' => 'post',
         'colorbox_gallery_custom' => '',
@@ -285,6 +287,14 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
     '#options' => $image_styles_hide,
     '#description' => t('Image style to use in the content.'),
   );
+  $element['colorbox_node_style_first'] = array(
+    '#title' => t('Content image style for first image'),
+    '#type' => 'select',
+    '#default_value' => $settings['colorbox_node_style_first'],
+    '#empty_option' => t('No special style.'),
+    '#options' => $image_styles,
+    '#description' => t('Image style to use in the content for the first image.'),
+  );
   $element['colorbox_image_style'] = array(
     '#title' => t('Colorbox image style'),
     '#type' => 'select',
@@ -386,7 +396,7 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
  * Validate function for colorbox_gallery_custom.
  */
 function colorbox_gallery_custom_validate($element, &$form_state) {
-  if ($element['#value'] != drupal_html_class($element['#value'])) {
+  if ($form_state['values']['fields']['field_image']['settings_edit_form']['settings']['colorbox_gallery'] == 'custom' && !preg_match('!^[a-z0-9_-]+$!', $element['#value'])) {
     form_error($element, t('%name must only contain lowercase letters, numbers, hyphen and underscores.', array('%name' => $element['#title'])));
   }
 }
@@ -415,6 +425,10 @@ function colorbox_field_formatter_settings_summary($field, $instance, $view_mode
     $summary[] = t('Content image style: Original image');
   }
 
+  if (isset($image_styles[$settings['colorbox_node_style_first']])) {
+    $summary[] = t('Content image style of first image: @style', array('@style' => $image_styles[$settings['colorbox_node_style_first']]));
+  }
+
   if (isset($image_styles[$settings['colorbox_image_style']])) {
     $summary[] = t('Colorbox image style: @style', array('@style' => $image_styles[$settings['colorbox_image_style']]));
   }
@@ -466,6 +480,7 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
         '#node' => $entity, // Left for legacy support.
         '#field' => $field,
         '#display_settings' => $display['settings'],
+        '#delta' => $delta,
       );
     }
   }
@@ -479,7 +494,8 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
 function colorbox_insert_styles() {
   $insert_styles = array();
   foreach (image_styles() as $key => $style) {
-    $insert_styles['colorbox__' . $key] = array('label' => t('Colorbox @style', array('@style' => $style['name'])));
+    $label = isset($style['label']) ? $style['label'] : $style['name'];
+    $insert_styles['colorbox__' . $key] = array('label' => t('Colorbox @style', array('@style' => $label)));
   }
 
   return $insert_styles;
diff --git a/drupal7/sites/all/modules/colorbox/colorbox.theme.inc b/drupal7/sites/all/modules/colorbox/colorbox.theme.inc
index beafb1dd..a30f91e2 100644
--- a/drupal7/sites/all/modules/colorbox/colorbox.theme.inc
+++ b/drupal7/sites/all/modules/colorbox/colorbox.theme.inc
@@ -30,11 +30,19 @@ function theme_colorbox_image_formatter($variables) {
     'style_name' => $settings['colorbox_node_style'],
   );
 
+  if ($variables['delta'] == 0 && !empty($settings['colorbox_node_style_first'])) {
+    $image['style_name'] = $settings['colorbox_node_style_first'];
+  }
+
   if (isset($item['width']) && isset($item['height'])) {
     $image['width'] = $item['width'];
     $image['height'] = $item['height'];
   }
 
+  if (isset($item['attributes'])) {
+    $image['attributes'] = $item['attributes'];
+  }
+
   $entity_title = entity_label($entity_type, $entity);
 
   switch ($settings['colorbox_caption']) {
@@ -153,10 +161,11 @@ function theme_colorbox_imagefield($variables) {
  * Preprocess variables for the colorbox-insert-image.tpl.php file.
  */
 function template_preprocess_colorbox_insert_image(&$variables) {
-  $variables['file'] = file_load($variables['item']['fid']);
-  $variables['style_name'] = $variables['item']['style_name'];
-  $variables['width'] = $variables['item']['width'];
-  $variables['height'] = $variables['item']['height'];
+  $item = $variables['item'];
+  $variables['file'] = file_load($item['fid']);
+  $variables['style_name'] = $item['style_name'];
+  $variables['width'] = isset($item['width']) ? $item['width'] : NULL;
+  $variables['height'] = isset($item['height']) ? $item['height'] : NULL;
 
   // Determine dimensions of the image after the image style transformations.
   image_style_transform_dimensions($variables['style_name'], $variables);
diff --git a/drupal7/sites/all/modules/colorbox/js/colorbox.js b/drupal7/sites/all/modules/colorbox/js/colorbox.js
index 684c3006..ace202ef 100644
--- a/drupal7/sites/all/modules/colorbox/js/colorbox.js
+++ b/drupal7/sites/all/modules/colorbox/js/colorbox.js
@@ -8,7 +8,7 @@ Drupal.behaviors.initColorbox = {
 
     if (settings.colorbox.mobiledetect && window.matchMedia) {
       // Disable Colorbox for small screens.
-      mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
+      var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
       if (mq.matches) {
         return;
       }
@@ -17,13 +17,11 @@ Drupal.behaviors.initColorbox = {
     $('.colorbox', context)
       .once('init-colorbox')
       .colorbox(settings.colorbox);
+
+    $(context).bind('cbox_complete', function () {
+      Drupal.attachBehaviors('#cboxLoadedContent');
+    });
   }
 };
 
-{
-  $(document).bind('cbox_complete', function () {
-    Drupal.attachBehaviors('#cboxLoadedContent');
-  });
-}
-
 })(jQuery);
diff --git a/drupal7/sites/all/modules/colorbox/styles/default/colorbox_style.js b/drupal7/sites/all/modules/colorbox/styles/default/colorbox_style.js
index 9393b614..47875ffd 100644
--- a/drupal7/sites/all/modules/colorbox/styles/default/colorbox_style.js
+++ b/drupal7/sites/all/modules/colorbox/styles/default/colorbox_style.js
@@ -2,7 +2,7 @@
 
 Drupal.behaviors.initColorboxDefaultStyle = {
   attach: function (context, settings) {
-    $(document).bind('cbox_complete', function () {
+    $(context).bind('cbox_complete', function () {
       // Only run if there is a title.
       if ($('#cboxTitle:empty', context).length == false) {
         $('#cboxLoadedContent img', context).bind('mouseover', function () {
diff --git a/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.css b/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.css
index cef876a2..0b500daf 100644
--- a/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.css
+++ b/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.css
@@ -126,7 +126,7 @@
       #cboxClose.cbox-close-plain {
         position: absolute;
         font-size: 20px;
-        line-height: 18px;;
+        line-height: 18px;
         text-align: center;
         color: rgba(255, 255, 255, 0.7);
         background: rgba(0, 0, 0, 0.5);
diff --git a/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.js b/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.js
index 02c4de06..19d8e66e 100644
--- a/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.js
+++ b/drupal7/sites/all/modules/colorbox/styles/plain/colorbox_style.js
@@ -2,7 +2,7 @@
 
 Drupal.behaviors.initColorboxPlainStyle = {
   attach: function (context, settings) {
-    $(document).bind('cbox_complete', function () {
+    $(context).bind('cbox_complete', function () {
       // Make all the controls invisible.
       $('#cboxCurrent, #cboxSlideshow, #cboxPrevious, #cboxNext', context).addClass('element-invisible');
       // Replace "Close" with "×" and show.
@@ -24,7 +24,7 @@ Drupal.behaviors.initColorboxPlainStyle = {
         }
       });
     });
-    $(document).bind('cbox_closed', function () {
+    $(context).bind('cbox_closed', function () {
       $('#cboxClose', context).removeClass('cbox-close-plain');
     });
   }
diff --git a/drupal7/sites/all/modules/colorbox/styles/stockholmsyndrome/colorbox_style.js b/drupal7/sites/all/modules/colorbox/styles/stockholmsyndrome/colorbox_style.js
index afe2c0fc..db3ab3ef 100644
--- a/drupal7/sites/all/modules/colorbox/styles/stockholmsyndrome/colorbox_style.js
+++ b/drupal7/sites/all/modules/colorbox/styles/stockholmsyndrome/colorbox_style.js
@@ -2,15 +2,15 @@
 
 Drupal.behaviors.initColorboxStockholmsyndromeStyle = {
   attach: function (context, settings) {
-    $(document).bind('cbox_open', function () {
+    $(context).bind('cbox_open', function () {
       // Hide close button initially.
       $('#cboxClose', context).css('opacity', 0);
     });
-    $(document).bind('cbox_load', function () {
+    $(context).bind('cbox_load', function () {
       // Hide close button. (It doesn't handle the load animation well.)
       $('#cboxClose', context).css('opacity', 0);
     });
-    $(document).bind('cbox_complete', function () {
+    $(context).bind('cbox_complete', function () {
       // Show close button with a delay.
       $('#cboxClose', context).fadeTo('fast', 0, function () {$(this).css('opacity', 1)});
     });
