Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / slick / js / slick.colorbox.js
1 /**
2  * @file
3  * Provides Colorbox integration.
4  */
5
6 (function ($, Drupal) {
7
8   'use strict';
9
10   Drupal.behaviors.slickColorbox = {
11     attach: function (context) {
12       $(context).on('cbox_open', function () {
13         Drupal.slickColorbox.set('slickPause');
14       });
15
16       $(context).on('cbox_load', function () {
17         Drupal.slickColorbox.set('setPosition');
18       });
19     }
20   };
21
22   /**
23    * Slick Colorbox utility functions.
24    *
25    * @namespace
26    */
27   Drupal.slickColorbox = Drupal.slickColorbox || {
28
29     /**
30      * Provides common Slick Browser utilities.
31      *
32      * @name set
33      *
34      * @param {string} method
35      *   The method to apply to .slick__slider element.
36      */
37     set: function (method) {
38       var $box = $.colorbox.element();
39       var $slider = $box.closest('.slick__slider');
40       var $wrap = $slider.closest('.slick-wrapper');
41       var curr;
42
43       if ($slider.length) {
44         curr = $box.closest('.slick__slide:not(.slick-cloned)').data('slickIndex');
45
46         // Slick is broken after colorbox close, do setPosition manually.
47         if (method === 'setPosition') {
48           if ($wrap.length) {
49             var $thumb = $wrap.find('.slick--thumbnail .slick__slider');
50             $thumb.slick('slickGoTo', curr);
51           }
52           $slider.slick('slickGoTo', curr);
53         }
54         else {
55           $slider.slick(method);
56         }
57       }
58     }
59   };
60
61 }(jQuery, Drupal));