Version 1
[yaffs-website] / web / modules / contrib / blazy / js / blazy.photobox.js
diff --git a/web/modules/contrib/blazy/js/blazy.photobox.js b/web/modules/contrib/blazy/js/blazy.photobox.js
new file mode 100644 (file)
index 0000000..b0b2d62
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Provides Photobox integration for Image and Media fields.
+ */
+
+(function ($, Drupal) {
+
+  'use strict';
+
+  Drupal.blazy = Drupal.blazy || {};
+
+  Drupal.behaviors.blazyPhotobox = {
+    attach: function (context) {
+      $('[data-photobox-gallery]', context).once('blazy-photobox').each(function () {
+        $(this).photobox('a[data-photobox-trigger]', {thumb: '> [data-thumb]', thumbAttr: 'data-thumb'}, Drupal.blazy.photobox);
+      });
+    }
+  };
+
+  /**
+   * Callback for custom captions.
+   */
+  Drupal.blazy.photobox = function () {
+    var $caption = $(this).next('.litebox-caption');
+
+    if ($caption.length) {
+      $('#pbCaption .title').html($caption.html());
+    }
+  };
+
+}(jQuery, Drupal));