PageSourceSearch

https://skibikemarathon.com/catalog/view/theme/journal3/lib/lightgallery/js/lightgallery-all.js?v=185b08f7

js skibikemarathon.com collected 2026-10-08 10:06:51 UTC 111,954 bytes, 3,343 lines download raw bytes

1/*! lightgallery - v1.6.9 - 2018-04-03
2* http://sachinchoolur.github.io/lightGallery/
3* Copyright (c) 2018 Sachin N; Licensed GPLv3 */
4/*! lightgallery - v1.6.9 - 2018-04-03
5* http://sachinchoolur.github.io/lightGallery/
6* Copyright (c) 2018 Sachin N; Licensed GPLv3 */
7(function (root, factory) {
8  if (typeof define === 'function' && define.amd) {
9    // AMD. Register as an anonymous module unless amdModuleId is set
10    define(['jquery'], function (a0) {
11      return (factory(a0));
12    });
13  } else if (typeof module === 'object' && module.exports) {
14    // Node. Does not work with strict CommonJS, but
15    // only CommonJS-like environments that support module.exports,
16    // like Node.
17    module.exports = factory(require('jquery'));
18  } else {
19    factory(root["jQuery"]);
20  }
21}(this, function ($) {
22
23(function() {
24    'use strict';
25
26    var defaults = {
27
28        mode: 'lg-slide',
29
30        // Ex : 'ease'
31        cssEasing: 'ease',
32
33        //'for jquery animation'
34        easing: 'linear',
35        speed: 600,
36        height: '100%',
37        width: '100%',
38        addClass: '',
39        startClass: 'lg-start-zoom',
40        backdropDuration: 150,
41        hideBarsDelay: 6000,
42
43        useLeft: false,
44
45        closable: true,
46        loop: true,
47        escKey: true,
48        keyPress: true,
49        controls: true,
50        slideEndAnimatoin: true,
51        hideControlOnEnd: false,
52        mousewheel: true,
53
54        getCaptionFromTitleOrAlt: true,
55
56        // .lg-item || '.lg-sub-html'
57        appendSubHtmlTo: '.lg-sub-html',
58
59        subHtmlSelectorRelative: false,
60
61        /**
62         * @desc number of preload slides
63         * will exicute only after the current slide is fully loaded.
64         *
65         * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th
66         * slide will be loaded in the background after the 4th slide is fully loaded..
67         * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...
68         *
69         */
70        preload: 1,
71        showAfterLoad: true,
72        selector: '',
73        selectWithin: '',
74        nextHtml: '',
75        prevHtml: '',
76
77        // 0, 1
78        index: false,
79
80        iframeMaxWidth: '100%',
81
82        download: true,
83        counter: true,
84        appendCounterTo: '.lg-toolbar',
85
86        swipeThreshold: 50,
87        enableSwipe: true,
88        enableDrag: true,
89
90        dynamic: false,
91        dynamicEl: [],
92        galleryId: 1
93    };
94
95    function Plugin(element, options) {
96
97        // Current lightGallery element
98        this.el = element;
99
100        // Current jquery element
101        this.$el = $(element);
102
103        // lightGallery settings
104        this.s = $.extend({}, defaults, options);
105
106        // When using dynamic mode, ensure dynamicEl is an array
107        if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) {
108            throw ('When using dynamic mode, you must also define dynamicEl as an Array.');
109        }
110
111        // lightGallery modules
112        this.modules = {};
113
114        // false when lightgallery complete first slide;
115        this.lGalleryOn = false;
116
117        this.lgBusy = false;
118
119        // Timeout function for hiding controls;
120        this.hideBartimeout = false;
121
122        // To determine browser supports for touch events;
123        this.isTouch = ('ontouchstart' in document.documentElement);
124
125        // Disable hideControlOnEnd if sildeEndAnimation is true
126        if (this.s.slideEndAnimatoin) {
127            this.s.hideControlOnEnd = false;
128        }
129
130        // Gallery items
131        if (this.s.dynamic) {
132            this.$items = this.s.dynamicEl;
133        } else {
134            if (this.s.selector === 'this') {
135                this.$items = this.$el;
136            } else if (this.s.selector !== '') {
137                if (this.s.selectWithin) {
138                    this.$items = $(this.s.selectWithin).find(this.s.selector);
139                } else {
140                    this.$items = this.$el.find($(this.s.selector));
141                }
142            } else {
143                this.$items = this.$el.children();
144            }
145        }
146
147        // .lg-item
148        this.$slide = '';
149
150        // .lg-outer
151        this.$outer = '';
152
153        this.init();
154
155        return this;
156    }
157
158    Plugin.prototype.init = function() {
159
160        var _this = this;
161
162        // s.preload should not be more than $item.length
163        if (_this.s.preload > _this.$items.length) {
164            _this.s.preload = _this.$items.length;
165        }
166
167        // if dynamic option is enabled execute immediately
168        var _hash = window.location.hash;
169        if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {
170
171            _this.index = parseInt(_hash.split('&slide=')[1], 10);
172
173            $('body').addClass('lg-from-hash');
174            if (!$('body').hasClass('lg-on')) {
175                setTimeout(function() {
176                    _this.build(_this.index);
177                });
178
179                $('body').addClass('lg-on');
180            }
181        }
182
183        if (_this.s.dynamic) {
184
185            _this.$el.trigger('onBeforeOpen.lg');
186
187            _this.index = _this.s.index || 0;
188
189            // prevent accidental double execution
190            if (!$('body').hasClass('lg-on')) {
191                setTimeout(function() {
192                    _this.build(_this.index);
193                    $('body').addClass('lg-on');
194                });
195            }
196        } else {
197
198            // Using different namespace for click because click event should not unbind if selector is same object('this')
199            _this.$items.on('click.lgcustom', function(event) {
200
201                // For IE8
202                try {
203                    event.preventDefault();
204                    event.preventDefault();
205                } catch (er) {
206                    event.returnValue = false;
207                }
208
209                _this.$el.trigger('onBeforeOpen.lg');
210
211                _this.index = _this.s.index || _this.$items.index(this);
212
213                // prevent accidental double execution
214                if (!$('body').hasClass('lg-on')) {
215                    _this.build(_this.index);
216                    $('body').addClass('lg-on');
217                }
218            });
219        }
220
221    };
222
223    Plugin.prototype.build = function(index) {
224
225        var _this = this;
226
227        _this.structure();
228
229        // module constructor
230        $.each($.fn.lightGallery.modules, function(key) {
231            _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el);
232        });
233
234        // initiate slide function
235        _this.slide(index, false, false, false);
236
237        if (_this.s.keyPress) {
238            _this.keyPress();
239        }
240
241        if (_this.$items.length > 1) {
242
243            _this.arrow();
244
245            setTimeout(function() {
246                _this.enableDrag();
247                _this.enableSwipe();
248            }, 50);
249
250            if (_this.s.mousewheel) {
251                _this.mousewheel();
252            }
253        } else {
254            _this.$slide.on('click.lg', function() {
255                _this.$el.trigger('onSlideClick.lg');
256            });
257        }
258
259        _this.counter();
260
261        _this.closeGallery();
262
263        _this.$el.trigger('onAfterOpen.lg');
264
265        // Hide controllers if mouse doesn't move for some period
266        _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() {
267
268            _this.$outer.removeClass('lg-hide-items');
269
270            clearTimeout(_this.hideBartimeout);
271
272            // Timeout will be cleared on each slide movement also
273            _this.hideBartimeout = setTimeout(function() {
274                _this.$outer.addClass('lg-hide-items');
275            }, _this.s.hideBarsDelay);
276
277        });
278
279        _this.$outer.trigger('mousemove.lg');
280
281    };
282
283    Plugin.prototype.structure = function() {
284        var list = '';
285        var controls = '';
286        var i = 0;
287        var subHtmlCont = '';
288        var template;
289        var _this = this;
290
291        $('body').append('<div class="lg-backdrop"></div>');
292        $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms');
293
294        // Create gallery items
295        for (i = 0; i < this.$items.length; i++) {
296            list += '<div class="lg-item"></div>';
297        }
298
299        // Create controlls
300        if (this.s.controls && this.$items.length > 1) {
301            controls = '<div class="lg-actions">' +
302                '<button class="lg-prev lg-icon">' + this.s.prevHtml + '</button>' +
303                '<button class="lg-next lg-icon">' + this.s.nextHtml + '</button>' +
304                '</div>';
305        }
306
307        if (this.s.appendSubHtmlTo === '.lg-sub-html') {
308            subHtmlCont = '<div class="lg-sub-html"></div>';
309        }
310
311        template = '<div class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' +
312            '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' +
313            '<div class="lg-inner">' + list + '</div>' +
314            '<div class="lg-toolbar lg-group">' +
315            '<span class="lg-close lg-icon"></span>' +
316            '</div>' +
317            controls +
318            subHtmlCont +
319            '</div>' +
320            '</div>';
321
322        $('body').append(template);
323        this.$outer = $('.lg-outer');
324        this.$slide = this.$outer.find('.lg-item');
325
326        if (this.s.useLeft) {
327            this.$outer.addClass('lg-use-left');
328
329            // Set mode lg-slide if use left is true;
330            this.s.mode = 'lg-slide';
331        } else {
332            this.$outer.addClass('lg-use-css3');
333        }
334
335        // For fixed height gallery
336        _this.setTop();
337        $(window).on('resize.lg orientationchange.lg', function() {
338            setTimeout(function() {
339                _this.setTop();
340            }, 100);
341        });
342
343        // add class lg-current to remove initial transition
344        this.$slide.eq(this.index).addClass('lg-current');
345
346        // add Class for css support and transition mode
347        if (this.doCss()) {
348            this.$outer.addClass('lg-css3');
349        } else {
350            this.$outer.addClass('lg-css');
351
352            // Set speed 0 because no animation will happen if browser doesn't support css3
353            this.s.speed = 0;
354        }
355
356        this.$outer.addClass(this.s.mode);
357
358        if (this.s.enableDrag && this.$items.length > 1) {
359            this.$outer.addClass('lg-grab');
360        }
361
362        if (this.s.showAfterLoad) {
363            this.$outer.addClass('lg-show-after-load');
364        }
365
366        if (this.doCss()) {
367            var $inner = this.$outer.find('.lg-inner');
368            $inner.css('transition-timing-function', this.s.cssEasing);
369            $inner.css('transition-duration', this.s.speed + 'ms');
370        }
371
372        setTimeout(function() {
373            $('.lg-backdrop').addClass('in');
374        });
375
376        setTimeout(function() {
377            _this.$outer.addClass('lg-visible');
378        }, this.s.backdropDuration);
379
380        if (this.s.download) {
381            this.$outer.find('.lg-toolbar').append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>');
382        }
383
384        // Store the current scroll top value to scroll back after closing the gallery..
385        this.prevScrollTop = $(window).scrollTop();
386
387    };
388
389    // For fixed height gallery
390    Plugin.prototype.setTop = function() {
391        if (this.s.height !== '100%') {
392            var wH = $(window).height();
393            var top = (wH - parseInt(this.s.height, 10)) / 2;
394            var $lGallery = this.$outer.find('.lg');
395            if (wH >= parseInt(this.s.height, 10)) {
396                $lGallery.css('top', top + 'px');
397            } else {
398                $lGallery.css('top', '0px');
399            }
400        }
401    };
402
403    // Find css3 support
404    Plugin.prototype.doCss = function() {
405        // check for css animation support
406        var support = function() {
407            var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
408            var root = document.documentElement;
409            var i = 0;
410            for (i = 0; i < transition.length; i++) {
411                if (transition[i] in root.style) {
412                    return true;
413                }
414            }
415        };
416
417        if (support()) {
418            return true;
419        }
420
421        return false;
422    };
423
424    /**
425     *  @desc Check the given src is video
426     *  @param {String} src
427     *  @return {Object} video type
428     *  Ex:{ youtube  :  ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
429     */
430    Plugin.prototype.isVideo = function(src, index) {
431
432        var html;
433        if (this.s.dynamic) {
434            html = this.s.dynamicEl[index].html;
435        } else {
436            html = this.$items.eq(index).attr('data-html');
437        }
438
439        if (!src) {
440            if(html) {
441                return {
442                    html5: true
443                };
444            } else {
445                console.error('lightGallery :- data-src is not pvovided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html');
446                return false;
447            }
448        }
449
450        var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
451        var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
452        var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i);
453        var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);
454
455        if (youtube) {
456            return {
457                youtube: youtube
458            };
459        } else if (vimeo) {
460            return {
461                vimeo: vimeo
462            };
463        } else if (dailymotion) {
464            return {
465                dailymotion: dailymotion
466            };
467        } else if (vk) {
468            return {
469                vk: vk
470            };
471        }
472    };
473
474    /**
475     *  @desc Create image counter
476     *  Ex: 1/10
477     */
478    Plugin.prototype.counter = function() {
479        if (this.s.counter) {
480            $(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>');
481        }
482    };
483
484    /**
485     *  @desc add sub-html into the slide
486     *  @param {Number} index - index of the slide
487     */
488    Plugin.prototype.addHtml = function(index) {
489        var subHtml = null;
490        var subHtmlUrl;
491        var $currentEle;
492        if (this.s.dynamic) {
493            if (this.s.dynamicEl[index].subHtmlUrl) {
494                subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl;
495            } else {
496                subHtml = this.s.dynamicEl[index].subHtml;
497            }
498        } else {
499            $currentEle = this.$items.eq(index);
500            if ($currentEle.attr('data-sub-html-url')) {
501                subHtmlUrl = $currentEle.attr('data-sub-html-url');
502            } else {
503                subHtml = $currentEle.attr('data-sub-html');
504                if (this.s.getCaptionFromTitleOrAlt && !subHtml) {
505                    subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt');
506                }
507            }
508        }
509
510        if (!subHtmlUrl) {
511            if (typeof subHtml !== 'undefined' && subHtml !== null) {
512
513                // get first letter of subhtml
514                // if first letter starts with . or # get the html form the jQuery object
515                var fL = subHtml.substring(0, 1);
516                if (fL === '.' || fL === '#') {
517                    if (this.s.subHtmlSelectorRelative && !this.s.dynamic) {
518                        subHtml = $currentEle.find(subHtml).html();
519                    } else {
520                        subHtml = $(subHtml).html();
521                    }
522                }
523            } else {
524                subHtml = '';
525            }
526        }
527
528        if (this.s.appendSubHtmlTo === '.lg-sub-html') {
529
530            if (subHtmlUrl) {
531                this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl);
532            } else {
533                this.$outer.find(this.s.appendSubHtmlTo).html(subHtml);
534            }
535
536        } else {
537
538            if (subHtmlUrl) {
539                this.$slide.eq(index).load(subHtmlUrl);
540            } else {
541                this.$slide.eq(index).append(subHtml);
542            }
543        }
544
545        // Add lg-empty-html class if title doesn't exist
546        if (typeof subHtml !== 'undefined' && subHtml !== null) {
547            if (subHtml === '') {
548                this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html');
549            } else {
550                this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html');
551            }
552        }
553
554        this.$el.trigger('onAfterAppendSubHtml.lg', [index]);
555    };
556
557    /**
558     *  @desc Preload slides
559     *  @param {Number} index - index of the slide
560     */
561    Plugin.prototype.preload = function(index) {
562        var i = 1;
563        var j = 1;
564        for (i = 1; i <= this.s.preload; i++) {
565            if (i >= this.$items.length - index) {
566                break;
567            }
568
569            this.loadContent(index + i, false, 0);
570        }
571
572        for (j = 1; j <= this.s.preload; j++) {
573            if (index - j < 0) {
574                break;
575            }
576
577            this.loadContent(index - j, false, 0);
578        }
579    };
580
581    /**
582     *  @desc Load slide content into slide.
583     *  @param {Number} index - index of the slide.
584     *  @param {Boolean} rec - if true call loadcontent() function again.
585     *  @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
586     */
587    Plugin.prototype.loadContent = function(index, rec, delay) {
588
589        var _this = this;
590        var _hasPoster = false;
591        var _$img;
592        var _src;
593        var _poster;
594        var _srcset;
595        var _sizes;
596        var _html;
597        var getResponsiveSrc = function(srcItms) {
598            var rsWidth = [];
599            var rsSrc = [];
600            for (var i = 0; i < srcItms.length; i++) {
601                var __src = srcItms[i].split(' ');
602
603                // Manage empty space
604                if (__src[0] === '') {
605                    __src.splice(0, 1);
606                }
607
608                rsSrc.push(__src[0]);
609                rsWidth.push(__src[1]);
610            }
611
612            var wWidth = $(window).width();
613            for (var j = 0; j < rsWidth.length; j++) {
614                if (parseInt(rsWidth[j], 10) > wWidth) {
615                    _src = rsSrc[j];
616                    break;
617                }
618            }
619        };
620
621        if (_this.s.dynamic) {
622
623            if (_this.s.dynamicEl[index].poster) {
624                _hasPoster = true;
625                _poster = _this.s.dynamicEl[index].poster;
626            }
627
628            _html = _this.s.dynamicEl[index].html;
629            _src = _this.s.dynamicEl[index].src;
630
631            if (_this.s.dynamicEl[index].responsive) {
632                var srcDyItms = _this.s.dynamicEl[index].responsive.split(',');
633                getResponsiveSrc(srcDyItms);
634            }
635
636            _srcset = _this.s.dynamicEl[index].srcset;
637            _sizes = _this.s.dynamicEl[index].sizes;
638
639        } else {
640
641            if (_this.$items.eq(index).attr('data-poster')) {
642                _hasPoster = true;
643                _poster = _this.$items.eq(index).attr('data-poster');
644            }
645
646            _html = _this.$items.eq(index).attr('data-html');
647            _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src');
648
649            if (_this.$items.eq(index).attr('data-responsive')) {
650                var srcItms = _this.$items.eq(index).attr('data-responsive').split(',');
651                getResponsiveSrc(srcItms);
652            }
653
654            _srcset = _this.$items.eq(index).attr('data-srcset');
655            _sizes = _this.$items.eq(index).attr('data-sizes');
656
657        }
658
659        //if (_src || _srcset || _sizes || _poster) {
660
661        var iframe = false;
662        if (_this.s.dynamic) {
663            if (_this.s.dynamicEl[index].iframe) {
664                iframe = true;
665            }
666        } else {
667            if (_this.$items.eq(index).attr('data-iframe') === 'true') {
668                iframe = true;
669            }
670        }
671
672        var _isVideo = _this.isVideo(_src, index);
673        if (!_this.$slide.eq(index).hasClass('lg-loaded')) {
674            if (iframe) {
675                _this.$slide.eq(index).prepend('<div class="lg-video-cont lg-has-iframe" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '"  allowfullscreen="true"></iframe></div></div>');
676            } else if (_hasPoster) {
677                var videoClass = '';
678                if (_isVideo && _isVideo.youtube) {
679                    videoClass = 'lg-has-youtube';
680                } else if (_isVideo && _isVideo.vimeo) {
681                    videoClass = 'lg-has-vimeo';
682                } else {
683                    videoClass = 'lg-has-html5';
684                }
685
686                _this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
687
688            } else if (_isVideo) {
689                _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>');
690                _this.$el.trigger('hasVideo.lg', [index, _src, _html]);
691            } else {
692                _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="' + _src + '" /></div>');
693            }
694
695            _this.$el.trigger('onAferAppendSlide.lg', [index]);
696
697            _$img = _this.$slide.eq(index).find('.lg-object');
698            if (_sizes) {
699                _$img.attr('sizes', _sizes);
700            }
701
702            if (_srcset) {
703                _$img.attr('srcset', _srcset);
704                try {
705                    picturefill({
706                        elements: [_$img[0]]
707                    });
708                } catch (e) {
709                    console.warn('lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.');
710                }
711            }
712
713            if (this.s.appendSubHtmlTo !== '.lg-sub-html') {
714                _this.addHtml(index);
715            }
716
717            _this.$slide.eq(index).addClass('lg-loaded');
718        }
719
720        _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
721
722            // For first time add some delay for displaying the start animation.
723            var _speed = 0;
724
725            // Do not change the delay value because it is required for zoom plugin.
726            // If gallery opened from direct url (hash) speed value should be 0
727            if (delay && !$('body').hasClass('lg-from-hash')) {
728                _speed = delay;
729            }
730
731            setTimeout(function() {
732                _this.$slide.eq(index).addClass('lg-complete');
733                _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]);
734            }, _speed);
735
736        });
737
738        // @todo check load state for html5 videos
739        if (_isVideo && _isVideo.html5 && !_hasPoster) {
740            _this.$slide.eq(index).addClass('lg-complete');
741        }
742
743        if (rec === true) {
744            if (!_this.$slide.eq(index).hasClass('lg-complete')) {
745                _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
746                    _this.preload(index);
747                });
748            } else {
749                _this.preload(index);
750            }
751        }
752
753        //}
754    };
755
756    /**
757    *   @desc slide function for lightgallery
758        ** Slide() gets call on start
759        ** ** Set lg.on true once slide() function gets called.
760        ** Call loadContent() on slide() function inside setTimeout
761        ** ** On first slide we do not want any animation like slide of fade
762        ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately
763        ** ** Else loadContent() should wait for the transition to complete.
764        ** ** So set timeout s.speed + 50
765    <=> ** loadContent() will load slide content in to the particular slide
766        ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function.
767        ** ** preload will execute only when the previous slide is fully loaded (images iframe)
768        ** ** avoid simultaneous image load
769    <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value
770        ** loadContent()  <====> Preload();
771
772    *   @param {Number} index - index of the slide
773    *   @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
774    *   @param {Boolean} fromThumb - true if slide function called via thumbnail click
775    *   @param {String} direction - Direction of the slide(next/prev)
776    */
777    Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) {
778
779        var _prevIndex = this.$outer.find('.lg-current').index();
780        var _this = this;
781
782        // Prevent if multiple call
783        // Required for hsh plugin
784        if (_this.lGalleryOn && (_prevIndex === index)) {
785            return;
786        }
787
788        var _length = this.$slide.length;
789        var _time = _this.lGalleryOn ? this.s.speed : 0;
790
791        if (!_this.lgBusy) {
792
793            if (this.s.download) {
794                var _src;
795                if (_this.s.dynamic) {
796                    _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
797                } else {
798                    _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
799
800                }
801
802                if (_src) {
803                    $('#lg-download').attr('href', _src);
804                    _this.$outer.removeClass('lg-hide-download');
805                } else {
806                    _this.$outer.addClass('lg-hide-download');
807                }
808            }
809
810            this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
811
812            _this.lgBusy = true;
813
814            clearTimeout(_this.hideBartimeout);
815
816            // Add title if this.s.appendSubHtmlTo === lg-sub-html
817            if (this.s.appendSubHtmlTo === '.lg-sub-html') {
818
819                // wait for slide animation to complete
820                setTimeout(function() {
821                    _this.addHtml(index);
822                }, _time);
823            }
824
825            this.arrowDisable(index);
826
827            if (!direction) {
828                if (index < _prevIndex) {
829                    direction = 'prev';
830                } else if (index > _prevIndex) {
831                    direction = 'next';
832                }
833            }
834
835            if (!fromTouch) {
836
837                // remove all transitions
838                _this.$outer.addClass('lg-no-trans');
839
840                this.$slide.removeClass('lg-prev-slide lg-next-slide');
841
842                if (direction === 'prev') {
843
844                    //prevslide
845                    this.$slide.eq(index).addClass('lg-prev-slide');
846                    this.$slide.eq(_prevIndex).addClass('lg-next-slide');
847                } else {
848
849                    // next slide
850                    this.$slide.eq(index).addClass('lg-next-slide');
851                    this.$slide.eq(_prevIndex).addClass('lg-prev-slide');
852                }
853
854                // give 50 ms for browser to add/remove class
855                setTimeout(function() {
856                    _this.$slide.removeClass('lg-current');
857
858                    //_this.$slide.eq(_prevIndex).removeClass('lg-current');
859                    _this.$slide.eq(index).addClass('lg-current');
860
861                    // reset all transitions
862                    _this.$outer.removeClass('lg-no-trans');
863                }, 50);
864            } else {
865
866                this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide');
867                var touchPrev;
868                var touchNext;
869                if (_length > 2) {
870                    touchPrev = index - 1;
871                    touchNext = index + 1;
872
873                    if ((index === 0) && (_prevIndex === _length - 1)) {
874
875                        // next slide
876                        touchNext = 0;
877                        touchPrev = _length - 1;
878                    } else if ((index === _length - 1) && (_prevIndex === 0)) {
879
880                        // prev slide
881                        touchNext = 0;
882                        touchPrev = _length - 1;
883                    }
884
885                } else {
886                    touchPrev = 0;
887                    touchNext = 1;
888                }
889
890                if (direction === 'prev') {
891                    _this.$slide.eq(touchNext).addClass('lg-next-slide');
892                } else {
893                    _this.$slide.eq(touchPrev).addClass('lg-prev-slide');
894                }
895
896                _this.$slide.eq(index).addClass('lg-current');
897            }
898
899            if (_this.lGalleryOn) {
900                setTimeout(function() {
901                    _this.loadContent(index, true, 0);
902                }, this.s.speed + 50);
903
904                setTimeout(function() {
905                    _this.lgBusy = false;
906                    _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
907                }, this.s.speed);
908
909            } else {
910                _this.loadContent(index, true, _this.s.backdropDuration);
911
912                _this.lgBusy = false;
913                _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
914            }
915
916            _this.lGalleryOn = true;
917
918            if (this.s.counter) {
919                $('#lg-counter-current').text(index + 1);
920            }
921
922        }
923        _this.index = index;
924
925    };
926
927    /**
928     *  @desc Go to next slide
929     *  @param {Boolean} fromTouch - true if slide function called via touch event
930     */
931    Plugin.prototype.goToNextSlide = function(fromTouch) {
932        var _this = this;
933        var _loop = _this.s.loop;
934        if (fromTouch && _this.$slide.length < 3) {
935            _loop = false;
936        }
937
938        if (!_this.lgBusy) {
939            if ((_this.index + 1) < _this.$slide.length) {
940                _this.index++;
941                _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
942                _this.slide(_this.index, fromTouch, false, 'next');
943            } else {
944                if (_loop) {
945                    _this.index = 0;
946                    _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
947                    _this.slide(_this.index, fromTouch, false, 'next');
948                } else if (_this.s.slideEndAnimatoin && !fromTouch) {
949                    _this.$outer.addClass('lg-right-end');
950                    setTimeout(function() {
951                        _this.$outer.removeClass('lg-right-end');
952                    }, 400);
953                }
954            }
955        }
956    };
957
958    /**
959     *  @desc Go to previous slide
960     *  @param {Boolean} fromTouch - true if slide function called via touch event
961     */
962    Plugin.prototype.goToPrevSlide = function(fromTouch) {
963        var _this = this;
964        var _loop = _this.s.loop;
965        if (fromTouch && _this.$slide.length < 3) {
966            _loop = false;
967        }
968
969        if (!_this.lgBusy) {
970            if (_this.index > 0) {
971                _this.index--;
972                _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
973                _this.slide(_this.index, fromTouch, false, 'prev');
974            } else {
975                if (_loop) {
976                    _this.index = _this.$items.length - 1;
977                    _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
978                    _this.slide(_this.index, fromTouch, false, 'prev');
979                } else if (_this.s.slideEndAnimatoin && !fromTouch) {
980                    _this.$outer.addClass('lg-left-end');
981                    setTimeout(function() {
982                        _this.$outer.removeClass('lg-left-end');
983                    }, 400);
984                }
985            }
986        }
987    };
988
989    Plugin.prototype.keyPress = function() {
990        var _this = this;
991        if (this.$items.length > 1) {
992            $(window).on('keyup.lg', function(e) {
993                if (_this.$items.length > 1) {
994                    if (e.keyCode === 37) {
995                        e.preventDefault();
996                        _this.goToPrevSlide();
997                    }
998
999                    if (e.keyCode === 39) {
1000                        e.preventDefault();
1001                        _this.goToNextSlide();
1002                    }
1003                }
1004            });
1005        }
1006
1007        $(window).on('keydown.lg', function(e) {
1008            if (_this.s.escKey === true && e.keyCode === 27) {
1009                e.preventDefault();
1010                if (!_this.$outer.hasClass('lg-thumb-open')) {
1011                    _this.destroy();
1012                } else {
1013                    _this.$outer.removeClass('lg-thumb-open');
1014                }
1015            }
1016        });
1017    };
1018
1019    Plugin.prototype.arrow = function() {
1020        var _this = this;
1021        this.$outer.find('.lg-prev').on('click.lg', function() {
1022            _this.goToPrevSlide();
1023        });
1024
1025        this.$outer.find('.lg-next').on('click.lg', function() {
1026            _this.goToNextSlide();
1027        });
1028    };
1029
1030    Plugin.prototype.arrowDisable = function(index) {
1031
1032        // Disable arrows if s.hideControlOnEnd is true
1033        if (!this.s.loop && this.s.hideControlOnEnd) {
1034            if ((index + 1) < this.$slide.length) {
1035                this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled');
1036            } else {
1037                this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled');
1038            }
1039
1040            if (index > 0) {
1041                this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled');
1042            } else {
1043                this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled');
1044            }
1045        }
1046    };
1047
1048    Plugin.prototype.setTranslate = function($el, xValue, yValue) {
1049        // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
1050        if (this.s.useLeft) {
1051            $el.css('left', xValue);
1052        } else {
1053            $el.css({
1054                transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)'
1055            });
1056        }
1057    };
1058
1059    Plugin.prototype.touchMove = function(startCoords, endCoords) {
1060
1061        var distance = endCoords - startCoords;
1062
1063        if (Math.abs(distance) > 15) {
1064            // reset opacity and transition duration
1065            this.$outer.addClass('lg-dragging');
1066
1067            // move current slide
1068            this.setTranslate(this.$slide.eq(this.index), distance, 0);
1069
1070            // move next and prev slide with current slide
1071            this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0);
1072            this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0);
1073        }
1074    };
1075
1076    Plugin.prototype.touchEnd = function(distance) {
1077        var _this = this;
1078
1079        // keep slide animation for any mode while dragg/swipe
1080        if (_this.s.mode !== 'lg-slide') {
1081            _this.$outer.addClass('lg-slide');
1082        }
1083
1084        this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0');
1085
1086        // set transition duration
1087        setTimeout(function() {
1088            _this.$outer.removeClass('lg-dragging');
1089            if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
1090                _this.goToNextSlide(true);
1091            } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
1092                _this.goToPrevSlide(true);
1093            } else if (Math.abs(distance) < 5) {
1094
1095                // Trigger click if distance is less than 5 pix
1096                _this.$el.trigger('onSlideClick.lg');
1097            }
1098
1099            _this.$slide.removeAttr('style');
1100        });
1101
1102        // remove slide class once drag/swipe is completed if mode is not slide
1103        setTimeout(function() {
1104            if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') {
1105                _this.$outer.removeClass('lg-slide');
1106            }
1107        }, _this.s.speed + 100);
1108
1109    };
1110
1111    Plugin.prototype.enableSwipe = function() {
1112        var _this = this;
1113        var startCoords = 0;
1114        var endCoords = 0;
1115        var isMoved = false;
1116
1117        if (_this.s.enableSwipe && _this.doCss()) {
1118
1119            _this.$slide.on('touchstart.lg', function(e) {
1120                if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) {
1121                    e.preventDefault();
1122                    _this.manageSwipeClass();
1123                    startCoords = e.originalEvent.targetTouches[0].pageX;
1124                }
1125            });
1126
1127            _this.$slide.on('touchmove.lg', function(e) {
1128                if (!_this.$outer.hasClass('lg-zoomed')) {
1129                    e.preventDefault();
1130                    endCoords = e.originalEvent.targetTouches[0].pageX;
1131                    _this.touchMove(startCoords, endCoords);
1132                    isMoved = true;
1133                }
1134            });
1135
1136            _this.$slide.on('touchend.lg', function() {
1137                if (!_this.$outer.hasClass('lg-zoomed')) {
1138                    if (isMoved) {
1139                        isMoved = false;
1140                        _this.touchEnd(endCoords - startCoords);
1141                    } else {
1142                        _this.$el.trigger('onSlideClick.lg');
1143                    }
1144                }
1145            });
1146        }
1147
1148    };
1149
1150    Plugin.prototype.enableDrag = function() {
1151        var _this = this;
1152        var startCoords = 0;
1153        var endCoords = 0;
1154        var isDraging = false;
1155        var isMoved = false;
1156        if (_this.s.enableDrag && _this.doCss()) {
1157            _this.$slide.on('mousedown.lg', function(e) {
1158                if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy && !$(e.target).text().trim()) {
1159                    e.preventDefault();
1160                    _this.manageSwipeClass();
1161                    startCoords = e.pageX;
1162                    isDraging = true;
1163
1164                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
1165                    _this.$outer.scrollLeft += 1;
1166                    _this.$outer.scrollLeft -= 1;
1167
1168                    // *
1169
1170                    _this.$outer.removeClass('lg-grab').addClass('lg-grabbing');
1171
1172                    _this.$el.trigger('onDragstart.lg');
1173                }
1174            });
1175
1176            $(window).on('mousemove.lg', function(e) {
1177                if (isDraging) {
1178                    isMoved = true;
1179                    endCoords = e.pageX;
1180                    _this.touchMove(startCoords, endCoords);
1181                    _this.$el.trigger('onDragmove.lg');
1182                }
1183            });
1184
1185            $(window).on('mouseup.lg', function(e) {
1186                if (isMoved) {
1187                    isMoved = false;
1188                    _this.touchEnd(endCoords - startCoords);
1189                    _this.$el.trigger('onDragend.lg');
1190                } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1191                    _this.$el.trigger('onSlideClick.lg');
1192                }
1193
1194                // Prevent execution on click
1195                if (isDraging) {
1196                    isDraging = false;
1197                    _this.$outer.removeClass('lg-grabbing').addClass('lg-grab');
1198                }
1199            });
1200
1201        }
1202    };
1203
1204    Plugin.prototype.manageSwipeClass = function() {
1205        var _touchNext = this.index + 1;
1206        var _touchPrev = this.index - 1;
1207        if (this.s.loop && this.$slide.length > 2) {
1208            if (this.index === 0) {
1209                _touchPrev = this.$slide.length - 1;
1210            } else if (this.index === this.$slide.length - 1) {
1211                _touchNext = 0;
1212            }
1213        }
1214
1215        this.$slide.removeClass('lg-next-slide lg-prev-slide');
1216        if (_touchPrev > -1) {
1217            this.$slide.eq(_touchPrev).addClass('lg-prev-slide');
1218        }
1219
1220        this.$slide.eq(_touchNext).addClass('lg-next-slide');
1221    };
1222
1223    Plugin.prototype.mousewheel = function() {
1224        var _this = this;
1225        _this.$outer.on('mousewheel.lg', function(e) {
1226
1227            if (!e.deltaY) {
1228                return;
1229            }
1230
1231            if (e.deltaY > 0) {
1232                _this.goToPrevSlide();
1233            } else {
1234                _this.goToNextSlide();
1235            }
1236
1237            e.preventDefault();
1238        });
1239
1240    };
1241
1242    Plugin.prototype.closeGallery = function() {
1243
1244        var _this = this;
1245        var mousedown = false;
1246        this.$outer.find('.lg-close').on('click.lg', function() {
1247            _this.destroy();
1248        });
1249
1250        if (_this.s.closable) {
1251
1252            // If you drag the slide and release outside gallery gets close on chrome
1253            // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
1254            _this.$outer.on('mousedown.lg', function(e) {
1255
1256                if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
1257                    mousedown = true;
1258                } else {
1259                    mousedown = false;
1260                }
1261
1262            });
1263            
1264            _this.$outer.on('mousemove.lg', function() {
1265                mousedown = false;
1266            });
1267
1268            _this.$outer.on('mouseup.lg', function(e) {
1269
1270                if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
1271                    if (!_this.$outer.hasClass('lg-dragging')) {
1272                        _this.destroy();
1273                    }
1274                }
1275
1276            });
1277
1278        }
1279
1280    };
1281
1282    Plugin.prototype.destroy = function(d) {
1283
1284        var _this = this;
1285
1286        if (!d) {
1287            _this.$el.trigger('onBeforeClose.lg');
1288            $(window).scrollTop(_this.prevScrollTop);
1289        }
1290
1291
1292        /**
1293         * if d is false or undefined destroy will only close the gallery
1294         * plugins instance remains with the element
1295         *
1296         * if d is true destroy will completely remove the plugin
1297         */
1298
1299        if (d) {
1300            if (!_this.s.dynamic) {
1301                // only when not using dynamic mode is $items a jquery collection
1302                this.$items.off('click.lg click.lgcustom');
1303            }
1304
1305            $.removeData(_this.el, 'lightGallery');
1306        }
1307
1308        // Unbind all events added by lightGallery
1309        this.$el.off('.lg.tm');
1310
1311        // Distroy all lightGallery modules
1312        $.each($.fn.lightGallery.modules, function(key) {
1313            if (_this.modules[key]) {
1314                _this.modules[key].destroy();
1315            }
1316        });
1317
1318        this.lGalleryOn = false;
1319
1320        clearTimeout(_this.hideBartimeout);
1321        this.hideBartimeout = false;
1322        $(window).off('.lg');
1323        $('body').removeClass('lg-on lg-from-hash');
1324
1325        if (_this.$outer) {
1326            _this.$outer.removeClass('lg-visible');
1327        }
1328
1329        $('.lg-backdrop').removeClass('in');
1330
1331        setTimeout(function() {
1332            if (_this.$outer) {
1333                _this.$outer.remove();
1334            }
1335
1336            $('.lg-backdrop').remove();
1337
1338            if (!d) {
1339                _this.$el.trigger('onCloseAfter.lg');
1340            }
1341
1342        }, _this.s.backdropDuration + 50);
1343    };
1344
1345    $.fn.lightGallery = function(options) {
1346        return this.each(function() {
1347            if (!$.data(this, 'lightGallery')) {
1348                $.data(this, 'lightGallery', new Plugin(this, options));
1349            } else {
1350                try {
1351                    $(this).data('lightGallery').init();
1352                } catch (err) {
1353                    console.error('lightGallery has not initiated properly');
1354                }
1355            }
1356        });
1357    };
1358
1359    $.fn.lightGallery.modules = {};
1360
1361})();
1362
1363
1364}));
1365
1366/*! lg-autoplay - v1.0.4 - 2017-03-28
1367* http://sachinchoolur.github.io/lightGallery
1368* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1369
1370(function (root, factory) {
1371  if (typeof define === 'function' && define.amd) {
1372    // AMD. Register as an anonymous module unless amdModuleId is set
1373    define(['jquery'], function (a0) {
1374      return (factory(a0));
1375    });
1376  } else if (typeof exports === 'object') {
1377    // Node. Does not work with strict CommonJS, but
1378    // only CommonJS-like environments that support module.exports,
1379    // like Node.
1380    module.exports = factory(require('jquery'));
1381  } else {
1382    factory(jQuery);
1383  }
1384}(this, function ($) {
1385
1386
1387(function() {
1388
1389    'use strict';
1390
1391    var defaults = {
1392        autoplay: false,
1393        pause: 5000,
1394        progressBar: true,
1395        fourceAutoplay: false,
1396        autoplayControls: true,
1397        appendAutoplayControlsTo: '.lg-toolbar'
1398    };
1399
1400    /**
1401     * Creates the autoplay plugin.
1402     * @param {object} element - lightGallery element
1403     */
1404    var Autoplay = function(element) {
1405
1406        this.core = $(element).data('lightGallery');
1407
1408        this.$el = $(element);
1409
1410        // Execute only if items are above 1
1411        if (this.core.$items.length < 2) {
1412            return false;
vendor: 4,651 bytes, lines 1413-1554
1413        }
1414
1415        this.core.s = $.extend({}, defaults, this.core.s);
1416        this.interval = false;
1417
1418        // Identify if slide happened from autoplay
1419        this.fromAuto = true;
1420
1421        // Identify if autoplay canceled from touch/drag
1422        this.canceledOnTouch = false;
1423
1424        // save fourceautoplay value
1425        this.fourceAutoplayTemp = this.core.s.fourceAutoplay;
1426
1427        // do not allow progress bar if browser does not support css3 transitions
1428        if (!this.core.doCss()) {
1429            this.core.s.progressBar = false;
1430        }
1431
1432        this.init();
1433
1434        return this;
1435    };
1436
1437    Autoplay.prototype.init = function() {
1438        var _this = this;
1439
1440        // append autoplay controls
1441        if (_this.core.s.autoplayControls) {
1442            _this.controls();
1443        }
1444
1445        // Create progress bar
1446        if (_this.core.s.progressBar) {
1447            _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
1448        }
1449
1450        // set progress
1451        _this.progress();
1452
1453        // Start autoplay
1454        if (_this.core.s.autoplay) {
1455            _this.$el.one('onSlideItemLoad.lg.tm', function() {
1456                _this.startlAuto();
1457            });
1458        }
1459
1460        // cancel interval on touchstart and dragstart
1461        _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
1462            if (_this.interval) {
1463                _this.cancelAuto();
1464                _this.canceledOnTouch = true;
1465            }
1466        });
1467
1468        // restore autoplay if autoplay canceled from touchstart / dragstart
1469        _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() {
1470            if (!_this.interval && _this.canceledOnTouch) {
1471                _this.startlAuto();
1472                _this.canceledOnTouch = false;
1473            }
1474        });
1475
1476    };
1477
1478    Autoplay.prototype.progress = function() {
1479
1480        var _this = this;
1481        var _$progressBar;
1482        var _$progress;
1483
1484        _this.$el.on('onBeforeSlide.lg.tm', function() {
1485
1486            // start progress bar animation
1487            if (_this.core.s.progressBar && _this.fromAuto) {
1488                _$progressBar = _this.core.$outer.find('.lg-progress-bar');
1489                _$progress = _this.core.$outer.find('.lg-progress');
1490                if (_this.interval) {
1491                    _$progress.removeAttr('style');
1492                    _$progressBar.removeClass('lg-start');
1493                    setTimeout(function() {
1494                        _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
1495                        _$progressBar.addClass('lg-start');
1496                    }, 20);
1497                }
1498            }
1499
1500            // Remove setinterval if slide is triggered manually and fourceautoplay is false
1501            if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
1502                _this.cancelAuto();
1503            }
1504
1505            _this.fromAuto = false;
1506
1507        });
1508    };
1509
1510    // Manage autoplay via play/stop buttons
1511    Autoplay.prototype.controls = function() {
1512        var _this = this;
1513        var _html = '<span class="lg-autoplay-button lg-icon"></span>';
1514
1515        // Append autoplay controls
1516        $(this.core.s.appendAutoplayControlsTo).append(_html);
1517
1518        _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function() {
1519            if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
1520                _this.cancelAuto();
1521                _this.core.s.fourceAutoplay = false;
1522            } else {
1523                if (!_this.interval) {
1524                    _this.startlAuto();
1525                    _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
1526                }
1527            }
1528        });
1529    };
1530
1531    // Autostart gallery
1532    Autoplay.prototype.startlAuto = function() {
1533        var _this = this;
1534
1535        _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
1536        _this.core.$outer.addClass('lg-show-autoplay');
1537        _this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
1538
1539        _this.interval = setInterval(function() {
1540            if (_this.core.index + 1 < _this.core.$items.length) {
1541                _this.core.index++;
1542            } else {
1543                _this.core.index = 0;
1544            }
1545
1546            _this.fromAuto = true;
1547            _this.core.slide(_this.core.index, false, false, 'next');
1548        }, _this.core.s.speed + _this.core.s.pause);
1549    };
1550
1551    // cancel Autostart
1552    Autoplay.prototype.cancelAuto = function() {
1553        clearInterval(this.interval);
1554        this.interval = false;
1555        this.core.$outer.find('.lg-progress').removeAttr('style');
1556        this.core.$outer.removeClass('lg-show-autoplay');
1557        this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
1558    };
1559
1560    Autoplay.prototype.destroy = function() {
1561
1562        this.cancelAuto();
1563        this.core.$outer.find('.lg-progress-bar').remove();
1564    };
1565
1566    $.fn.lightGallery.modules.autoplay = Autoplay;
1567
1568})();
1569
1570
1571}));
1572
1573/*! lg-fullscreen - v1.0.1 - 2016-09-30
1574* http://sachinchoolur.github.io/lightGallery
1575* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
1576
1577(function (root, factory) {
1578  if (typeof define === 'function' && define.amd) {
1579    // AMD. Register as an anonymous module unless amdModuleId is set
1580    define(['jquery'], function (a0) {
1581      return (factory(a0));
1582    });
1583  } else if (typeof exports === 'object') {
1584    // Node. Does not work with strict CommonJS, but
1585    // only CommonJS-like environments that support module.exports,
1586    // like Node.
1587    module.exports = factory(require('jquery'));
1588  } else {
1589    factory(jQuery);
1590  }
1591}(this, function ($) {
1592
1593(function() {
1594
1595    'use strict';
1596
1597    var defaults = {
1598        fullScreen: true
1599    };
1600
1601    var Fullscreen = function(element) {
1602
1603        // get lightGallery core plugin data
1604        this.core = $(element).data('lightGallery');
1605
1606        this.$el = $(element);
1607
1608        // extend module defalut settings with lightGallery core settings
1609        this.core.s = $.extend({}, defaults, this.core.s);
1610
1611        this.init();
1612
1613        return this;
1614    };
1615
1616    Fullscreen.prototype.init = function() {
1617        var fullScreen = '';
1618        if (this.core.s.fullScreen) {
1619
1620            // check for fullscreen browser support
1621            if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
1622                !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
1623                return;
1624            } else {
1625                fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
1626                this.core.$outer.find('.lg-toolbar').append(fullScreen);
1627                this.fullScreen();
1628            }
1629        }
1630    };
1631
1632    Fullscreen.prototype.requestFullscreen = function() {
1633        var el = document.documentElement;
1634        if (el.requestFullscreen) {
1635            el.requestFullscreen();
1636        } else if (el.msRequestFullscreen) {
1637            el.msRequestFullscreen();
1638        } else if (el.mozRequestFullScreen) {
1639            el.mozRequestFullScreen();
1640        } else if (el.webkitRequestFullscreen) {
1641            el.webkitRequestFullscreen();
1642        }
1643    };
1644
1645    Fullscreen.prototype.exitFullscreen = function() {
1646        if (document.exitFullscreen) {
1647            document.exitFullscreen();
1648        } else if (document.msExitFullscreen) {
1649            document.msExitFullscreen();
1650        } else if (document.mozCancelFullScreen) {
1651            document.mozCancelFullScreen();
1652        } else if (document.webkitExitFullscreen) {
1653            document.webkitExitFullscreen();
1654        }
1655    };
1656
1657    // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
1658    Fullscreen.prototype.fullScreen = function() {
1659        var _this = this;
1660
1661        $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
1662            _this.core.$outer.toggleClass('lg-fullscreen-on');
1663        });
1664
1665        this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
1666            if (!document.fullscreenElement &&
1667                !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
1668                _this.requestFullscreen();
1669            } else {
1670                _this.exitFullscreen();
1671            }
1672        });
1673
1674    };
1675
1676    Fullscreen.prototype.destroy = function() {
1677
1678        // exit from fullscreen if activated
1679        // this.exitFullscreen();
1680
1681        $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
1682    };
1683
1684    $.fn.lightGallery.modules.fullscreen = Fullscreen;
1685
1686})();
1687
1688}));
1689
1690/*! lg-pager - v1.0.2 - 2017-01-22
1691* http://sachinchoolur.github.io/lightGallery
1692* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1693
1694(function (root, factory) {
1695  if (typeof define === 'function' && define.amd) {
1696    // AMD. Register as an anonymous module unless amdModuleId is set
1697    define(['jquery'], function (a0) {
1698      return (factory(a0));
1699    });
1700  } else if (typeof exports === 'object') {
1701    // Node. Does not work with strict CommonJS, but
1702    // only CommonJS-like environments that support module.exports,
1703    // like Node.
1704    module.exports = factory(require('jquery'));
1705  } else {
1706    factory(jQuery);
1707  }
1708}(this, function ($) {
1709
1710(function() {
1711
1712    'use strict';
1713
1714    var defaults = {
1715        pager: false
1716    };
1717
1718    var Pager = function(element) {
1719
1720        this.core = $(element).data('lightGallery');
1721
1722        this.$el = $(element);
1723        this.core.s = $.extend({}, defaults, this.core.s);
1724        if (this.core.s.pager && this.core.$items.length > 1) {
1725            this.init();
1726        }
1727
1728        return this;
1729    };
1730
1731    Pager.prototype.init = function() {
1732        var _this = this;
1733        var pagerList = '';
1734        var $pagerCont;
1735        var $pagerOuter;
1736        var timeout;
1737
1738        _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');
1739
1740        if (_this.core.s.dynamic) {
1741            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1742                pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[i].thumb + '" /></div></span>';
1743            }
1744        } else {
1745            _this.core.$items.each(function() {
1746
1747                if (!_this.core.s.exThumbImage) {
1748                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).find('img').attr('src') + '" /></div></span>';
1749                } else {
1750                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).attr(_this.core.s.exThumbImage) + '" /></div></span>';
1751                }
1752
1753            });
1754        }
1755
1756        $pagerOuter = _this.core.$outer.find('.lg-pager-outer');
1757
vendor: 17,777 bytes, lines 1758-2308
1758        $pagerOuter.html(pagerList);
1759
1760        $pagerCont = _this.core.$outer.find('.lg-pager-cont');
1761        $pagerCont.on('click.lg touchend.lg', function() {
1762            var _$this = $(this);
1763            _this.core.index = _$this.index();
1764            _this.core.slide(_this.core.index, false, true, false);
1765        });
1766
1767        $pagerOuter.on('mouseover.lg', function() {
1768            clearTimeout(timeout);
1769            $pagerOuter.addClass('lg-pager-hover');
1770        });
1771
1772        $pagerOuter.on('mouseout.lg', function() {
1773            timeout = setTimeout(function() {
1774                $pagerOuter.removeClass('lg-pager-hover');
1775            });
1776        });
1777
1778        _this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
1779            $pagerCont.removeClass('lg-pager-active');
1780            $pagerCont.eq(index).addClass('lg-pager-active');
1781        });
1782
1783    };
1784
1785    Pager.prototype.destroy = function() {
1786
1787    };
1788
1789    $.fn.lightGallery.modules.pager = Pager;
1790
1791})();
1792
1793
1794}));
1795
1796/*! lg-thumbnail - v1.1.0 - 2017-08-08
1797* http://sachinchoolur.github.io/lightGallery
1798* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1799
1800(function (root, factory) {
1801  if (typeof define === 'function' && define.amd) {
1802    // AMD. Register as an anonymous module unless amdModuleId is set
1803    define(['jquery'], function (a0) {
1804      return (factory(a0));
1805    });
1806  } else if (typeof exports === 'object') {
1807    // Node. Does not work with strict CommonJS, but
1808    // only CommonJS-like environments that support module.exports,
1809    // like Node.
1810    module.exports = factory(require('jquery'));
1811  } else {
1812    factory(jQuery);
1813  }
1814}(this, function ($) {
1815
1816(function() {
1817
1818    'use strict';
1819
1820    var defaults = {
1821        thumbnail: true,
1822
1823        animateThumb: true,
1824        currentPagerPosition: 'middle',
1825
1826        thumbWidth: 100,
1827        thumbHeight: '80px',
1828        thumbContHeight: 100,
1829        thumbMargin: 5,
1830
1831        exThumbImage: false,
1832        showThumbByDefault: true,
1833        toogleThumb: true,
1834        pullCaptionUp: true,
1835
1836        enableThumbDrag: true,
1837        enableThumbSwipe: true,
1838        swipeThreshold: 50,
1839
1840        loadYoutubeThumbnail: true,
1841        youtubeThumbSize: 1,
1842
1843        loadVimeoThumbnail: true,
1844        vimeoThumbSize: 'thumbnail_small',
1845
1846        loadDailymotionThumbnail: true
1847    };
1848
1849    var Thumbnail = function(element) {
1850
1851        // get lightGallery core plugin data
1852        this.core = $(element).data('lightGallery');
1853
1854        // extend module default settings with lightGallery core settings
1855        this.core.s = $.extend({}, defaults, this.core.s);
1856
1857        this.$el = $(element);
1858        this.$thumbOuter = null;
1859        this.thumbOuterWidth = 0;
1860        this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
1861        this.thumbIndex = this.core.index;
1862
1863        if (this.core.s.animateThumb) {
1864            this.core.s.thumbHeight = '100%';
1865        }
1866
1867        // Thumbnail animation value
1868        this.left = 0;
1869
1870        this.init();
1871
1872        return this;
1873    };
1874
1875    Thumbnail.prototype.init = function() {
1876        var _this = this;
1877        if (this.core.s.thumbnail && this.core.$items.length > 1) {
1878            if (this.core.s.showThumbByDefault) {
1879                setTimeout(function(){
1880                    _this.core.$outer.addClass('lg-thumb-open');
1881                }, 700);
1882            }
1883
1884            if (this.core.s.pullCaptionUp) {
1885                this.core.$outer.addClass('lg-pull-caption-up');
1886            }
1887
1888            this.build();
1889            if (this.core.s.animateThumb && this.core.doCss()) {
1890                if (this.core.s.enableThumbDrag) {
1891                    this.enableThumbDrag();
1892                }
1893
1894                if (this.core.s.enableThumbSwipe) {
1895                    this.enableThumbSwipe();
1896                }
1897
1898                this.thumbClickable = false;
1899            } else {
1900                this.thumbClickable = true;
1901            }
1902
1903            this.toogle();
1904            this.thumbkeyPress();
1905        }
1906    };
1907
1908    Thumbnail.prototype.build = function() {
1909        var _this = this;
1910        var thumbList = '';
1911        var vimeoErrorThumbSize = '';
1912        var $thumb;
1913        var html = '<div class="lg-thumb-outer">' +
1914            '<div class="lg-thumb lg-group">' +
1915            '</div>' +
1916            '</div>';
1917
1918        switch (this.core.s.vimeoThumbSize) {
1919            case 'thumbnail_large':
1920                vimeoErrorThumbSize = '640';
1921                break;
1922            case 'thumbnail_medium':
1923                vimeoErrorThumbSize = '200x150';
1924                break;
1925            case 'thumbnail_small':
1926                vimeoErrorThumbSize = '100x75';
1927        }
1928
1929        _this.core.$outer.addClass('lg-has-thumb');
1930
1931        _this.core.$outer.find('.lg').append(html);
1932
1933        _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
1934        _this.thumbOuterWidth = _this.$thumbOuter.width();
1935
1936        if (_this.core.s.animateThumb) {
1937            _this.core.$outer.find('.lg-thumb').css({
1938                width: _this.thumbTotalWidth + 'px',
1939                position: 'relative'
1940            });
1941        }
1942
1943        if (this.core.s.animateThumb) {
1944            _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
1945        }
1946
1947        function getThumb(src, thumb, index) {
1948            var isVideo = _this.core.isVideo(src, index) || {};
1949            var thumbImg;
1950            var vimeoId = '';
1951
1952            if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
1953                if (isVideo.youtube) {
1954                    if (_this.core.s.loadYoutubeThumbnail) {
1955                        thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
1956                    } else {
1957                        thumbImg = thumb;
1958                    }
1959                } else if (isVideo.vimeo) {
1960                    if (_this.core.s.loadVimeoThumbnail) {
1961                        thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
1962                        vimeoId = isVideo.vimeo[1];
1963                    } else {
1964                        thumbImg = thumb;
1965                    }
1966                } else if (isVideo.dailymotion) {
1967                    if (_this.core.s.loadDailymotionThumbnail) {
1968                        thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
1969                    } else {
1970                        thumbImg = thumb;
1971                    }
1972                }
1973            } else {
1974                thumbImg = thumb;
1975            }
1976
1977            thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; height: ' + _this.core.s.thumbHeight + '; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
1978            vimeoId = '';
1979        }
1980
1981        if (_this.core.s.dynamic) {
1982            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1983                getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
1984            }
1985        } else {
1986            _this.core.$items.each(function(i) {
1987
1988                if (!_this.core.s.exThumbImage) {
1989                    getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
1990                } else {
1991                    getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
1992                }
1993
1994            });
1995        }
1996
1997        _this.core.$outer.find('.lg-thumb').html(thumbList);
1998
1999        $thumb = _this.core.$outer.find('.lg-thumb-item');
2000
2001        // Load vimeo thumbnails
2002        $thumb.each(function() {
2003            var $this = $(this);
2004            var vimeoVideoId = $this.attr('data-vimeo-id');
2005
2006            if (vimeoVideoId) {
2007                $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
2008                    format: 'json'
2009                }, function(data) {
2010                    $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
2011                });
2012            }
2013        });
2014
2015        // manage active class for thumbnail
2016        $thumb.eq(_this.core.index).addClass('active');
2017        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2018            $thumb.removeClass('active');
2019            $thumb.eq(_this.core.index).addClass('active');
2020        });
2021
2022        $thumb.on('click.lg touchend.lg', function() {
2023            var _$this = $(this);
2024            setTimeout(function() {
2025
2026                // In IE9 and bellow touch does not support
2027                // Go to slide if browser does not support css transitions
2028                if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
2029                    _this.core.index = _$this.index();
2030                    _this.core.slide(_this.core.index, false, true, false);
2031                }
2032            }, 50);
2033        });
2034
2035        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2036            _this.animateThumb(_this.core.index);
2037        });
2038
2039        $(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
2040            setTimeout(function() {
2041                _this.animateThumb(_this.core.index);
2042                _this.thumbOuterWidth = _this.$thumbOuter.width();
2043            }, 200);
2044        });
2045
2046    };
2047
2048    Thumbnail.prototype.setTranslate = function(value) {
2049        // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
2050        this.core.$outer.find('.lg-thumb').css({
2051            transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
2052        });
2053    };
2054
2055    Thumbnail.prototype.animateThumb = function(index) {
2056        var $thumb = this.core.$outer.find('.lg-thumb');
2057        if (this.core.s.animateThumb) {
2058            var position;
2059            switch (this.core.s.currentPagerPosition) {
2060                case 'left':
2061                    position = 0;
2062                    break;
2063                case 'middle':
2064                    position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
2065                    break;
2066                case 'right':
2067                    position = this.thumbOuterWidth - this.core.s.thumbWidth;
2068            }
2069            this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
2070            if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
2071                this.left = this.thumbTotalWidth - this.thumbOuterWidth;
2072            }
2073
2074            if (this.left < 0) {
2075                this.left = 0;
2076            }
2077
2078            if (this.core.lGalleryOn) {
2079                if (!$thumb.hasClass('on')) {
2080                    this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
2081                }
2082
2083                if (!this.core.doCss()) {
2084                    $thumb.animate({
2085                        left: -this.left + 'px'
2086                    }, this.core.s.speed);
2087                }
2088            } else {
2089                if (!this.core.doCss()) {
2090                    $thumb.css('left', -this.left + 'px');
2091                }
2092            }
2093
2094            this.setTranslate(this.left);
2095
2096        }
2097    };
2098
2099    // Enable thumbnail dragging and swiping
2100    Thumbnail.prototype.enableThumbDrag = function() {
2101
2102        var _this = this;
2103        var startCoords = 0;
2104        var endCoords = 0;
2105        var isDraging = false;
2106        var isMoved = false;
2107        var tempLeft = 0;
2108
2109        _this.$thumbOuter.addClass('lg-grab');
2110
2111        _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
2112            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2113                // execute only on .lg-object
2114                e.preventDefault();
2115                startCoords = e.pageX;
2116                isDraging = true;
2117
2118                // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2119                _this.core.$outer.scrollLeft += 1;
2120                _this.core.$outer.scrollLeft -= 1;
2121
2122                // *
2123                _this.thumbClickable = false;
2124                _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
2125            }
2126        });
2127
2128        $(window).on('mousemove.lg.thumb', function(e) {
2129            if (isDraging) {
2130                tempLeft = _this.left;
2131                isMoved = true;
2132                endCoords = e.pageX;
2133
2134                _this.$thumbOuter.addClass('lg-dragging');
2135
2136                tempLeft = tempLeft - (endCoords - startCoords);
2137
2138                if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2139                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2140                }
2141
2142                if (tempLeft < 0) {
2143                    tempLeft = 0;
2144                }
2145
2146                // move current slide
2147                _this.setTranslate(tempLeft);
2148
2149            }
2150        });
2151
2152        $(window).on('mouseup.lg.thumb', function() {
2153            if (isMoved) {
2154                isMoved = false;
2155                _this.$thumbOuter.removeClass('lg-dragging');
2156
2157                _this.left = tempLeft;
2158
2159                if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2160                    _this.thumbClickable = true;
2161                }
2162
2163            } else {
2164                _this.thumbClickable = true;
2165            }
2166
2167            if (isDraging) {
2168                isDraging = false;
2169                _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
2170            }
2171        });
2172
2173    };
2174
2175    Thumbnail.prototype.enableThumbSwipe = function() {
2176        var _this = this;
2177        var startCoords = 0;
2178        var endCoords = 0;
2179        var isMoved = false;
2180        var tempLeft = 0;
2181
2182        _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
2183            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2184                e.preventDefault();
2185                startCoords = e.originalEvent.targetTouches[0].pageX;
2186                _this.thumbClickable = false;
2187            }
2188        });
2189
2190        _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
2191            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2192                e.preventDefault();
2193                endCoords = e.originalEvent.targetTouches[0].pageX;
2194                isMoved = true;
2195
2196                _this.$thumbOuter.addClass('lg-dragging');
2197
2198                tempLeft = _this.left;
2199
2200                tempLeft = tempLeft - (endCoords - startCoords);
2201
2202                if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2203                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2204                }
2205
2206                if (tempLeft < 0) {
2207                    tempLeft = 0;
2208                }
2209
2210                // move current slide
2211                _this.setTranslate(tempLeft);
2212
2213            }
2214        });
2215
2216        _this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
2217            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2218
2219                if (isMoved) {
2220                    isMoved = false;
2221                    _this.$thumbOuter.removeClass('lg-dragging');
2222                    if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2223                        _this.thumbClickable = true;
2224                    }
2225
2226                    _this.left = tempLeft;
2227                } else {
2228                    _this.thumbClickable = true;
2229                }
2230            } else {
2231                _this.thumbClickable = true;
2232            }
2233        });
2234
2235    };
2236
2237    Thumbnail.prototype.toogle = function() {
2238        var _this = this;
2239        if (_this.core.s.toogleThumb) {
2240            _this.core.$outer.addClass('lg-can-toggle');
2241            _this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
2242            _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
2243                _this.core.$outer.toggleClass('lg-thumb-open');
2244            });
2245        }
2246    };
2247
2248    Thumbnail.prototype.thumbkeyPress = function() {
2249        var _this = this;
2250        $(window).on('keydown.lg.thumb', function(e) {
2251            if (e.keyCode === 38) {
2252                e.preventDefault();
2253                _this.core.$outer.addClass('lg-thumb-open');
2254            } else if (e.keyCode === 40) {
2255                e.preventDefault();
2256                _this.core.$outer.removeClass('lg-thumb-open');
2257            }
2258        });
2259    };
2260
2261    Thumbnail.prototype.destroy = function() {
2262        if (this.core.s.thumbnail && this.core.$items.length > 1) {
2263            $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
2264            this.$thumbOuter.remove();
2265            this.core.$outer.removeClass('lg-has-thumb');
2266        }
2267    };
2268
2269    $.fn.lightGallery.modules.Thumbnail = Thumbnail;
2270
2271})();
2272
2273}));
2274
2275/*! lg-video - v1.2.1 - 2018-03-08
2276* http://sachinchoolur.github.io/lightGallery
2277* Copyright (c) 2018 Sachin N; Licensed GPLv3 */
2278
2279(function (root, factory) {
2280  if (typeof define === 'function' && define.amd) {
2281    // AMD. Register as an anonymous module unless amdModuleId is set
2282    define(['jquery'], function (a0) {
2283      return (factory(a0));
2284    });
2285  } else if (typeof module === 'object' && module.exports) {
2286    // Node. Does not work with strict CommonJS, but
2287    // only CommonJS-like environments that support module.exports,
2288    // like Node.
2289    module.exports = factory(require('jquery'));
2290  } else {
2291    factory(root["jQuery"]);
2292  }
2293}(this, function ($) {
2294
2295(function() {
2296    
2297        'use strict';
2298    
2299        var defaults = {
2300            videoMaxWidth: '855px',
2301
2302            autoplayFirstVideo: true,
2303
2304            youtubePlayerParams: false,
2305            vimeoPlayerParams: false,
2306            dailymotionPlayerParams: false,
2307            vkPlayerParams: false,
2308
vendor: 12,909 bytes, lines 2309-2632
2309            videojs: false,
2310            videojsOptions: {}
2311        };
2312    
2313        var Video = function(element) {
2314    
2315            this.core = $(element).data('lightGallery');
2316    
2317            this.$el = $(element);
2318            this.core.s = $.extend({}, defaults, this.core.s);
2319            this.videoLoaded = false;
2320    
2321            this.init();
2322    
2323            return this;
2324        };
2325    
2326        Video.prototype.init = function() {
2327            var _this = this;
2328    
2329            // Event triggered when video url found without poster
2330            _this.core.$el.on('hasVideo.lg.tm', onHasVideo.bind(this));
2331    
2332            // Set max width for video
2333            _this.core.$el.on('onAferAppendSlide.lg.tm', onAferAppendSlide.bind(this));
2334    
2335            if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) {
2336                _this.core.$el.on('onSlideClick.lg.tm', function() {
2337                    var $el = _this.core.$slide.eq(_this.core.index);
2338                    _this.loadVideoOnclick($el);
2339                });
2340            } else {
2341    
2342                // For IE 9 and bellow
2343                _this.core.$slide.on('click.lg', function() {
2344                    _this.loadVideoOnclick($(this));
2345                });
2346            }
2347    
2348            _this.core.$el.on('onBeforeSlide.lg.tm', onBeforeSlide.bind(this));
2349    
2350            _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) {
2351                _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing');
2352            });
2353        };
2354    
2355        Video.prototype.loadVideo = function(src, addClass, noPoster, index, html) {
2356            var video = '';
2357            var autoplay = 1;
2358            var a = '';
2359            var isVideo = this.core.isVideo(src, index) || {};
2360    
2361            // Enable autoplay based on setting for first video if poster doesn't exist
2362            if (noPoster) {
2363                if (this.videoLoaded) {
2364                    autoplay = 0;
2365                } else {
2366                    autoplay = this.core.s.autoplayFirstVideo ? 1 : 0;
2367                }
2368            }
2369    
2370            if (isVideo.youtube) {
2371    
2372                a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
2373                if (this.core.s.youtubePlayerParams) {
2374                    a = a + '&' + $.param(this.core.s.youtubePlayerParams);
2375                }
2376    
2377                video = '<iframe class="lg-video-object lg-youtube ' + addClass + '" width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>';
2378    
2379            } else if (isVideo.vimeo) {
2380    
2381                a = '?autoplay=' + autoplay + '&api=1';
2382                if (this.core.s.vimeoPlayerParams) {
2383                    a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
2384                }
2385    
2386                video = '<iframe class="lg-video-object lg-vimeo ' + addClass + '" width="560" height="315"  src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
2387    
2388            } else if (isVideo.dailymotion) {
2389    
2390                a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
2391                if (this.core.s.dailymotionPlayerParams) {
2392                    a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
2393                }
2394    
2395                video = '<iframe class="lg-video-object lg-dailymotion ' + addClass + '" width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[1] + a + '" frameborder="0" allowfullscreen></iframe>';
2396    
2397            } else if (isVideo.html5) {
2398                var fL = html.substring(0, 1);
2399                if (fL === '.' || fL === '#') {
2400                    html = $(html).html();
2401                }
2402    
2403                video = html;
2404    
2405            } else if (isVideo.vk) {
2406    
2407                a = '&autoplay=' + autoplay;
2408                if (this.core.s.vkPlayerParams) {
2409                    a = a + '&' + $.param(this.core.s.vkPlayerParams);
2410                }
2411    
2412                video = '<iframe class="lg-video-object lg-vk ' + addClass + '" width="560" height="315" src="//vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>';
2413    
2414            }
2415    
2416            return video;
2417        };
2418
2419        Video.prototype.loadVideoOnclick = function($el){
2420
2421            var _this = this;
2422            // check slide has poster
2423            if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {
2424
2425                // check already video element present
2426                if (!$el.hasClass('lg-has-video')) {
2427
2428                    $el.addClass('lg-video-playing lg-has-video');
2429
2430                    var _src;
2431                    var _html;
2432                    var _loadVideo = function(_src, _html) {
2433
2434                        $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html));
2435
2436                        if (_html) {
2437                            if (_this.core.s.videojs) {
2438                                try {
2439                                    videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
2440                                        this.play();
2441                                    });
2442                                } catch (e) {
2443                                    console.error('Make sure you have included videojs');
2444                                }
2445                            } else {
2446                                _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play();
2447                            }
2448                        }
2449
2450                    };
2451
2452                    if (_this.core.s.dynamic) {
2453
2454                        _src = _this.core.s.dynamicEl[_this.core.index].src;
2455                        _html = _this.core.s.dynamicEl[_this.core.index].html;
2456
2457                        _loadVideo(_src, _html);
2458
2459                    } else {
2460
2461                        _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src');
2462                        _html = _this.core.$items.eq(_this.core.index).attr('data-html');
2463
2464                        _loadVideo(_src, _html);
2465
2466                    }
2467
2468                    var $tempImg = $el.find('.lg-object');
2469                    $el.find('.lg-video').append($tempImg);
2470
2471                    // @todo loading icon for html5 videos also
2472                    // for showing the loading indicator while loading video
2473                    if (!$el.find('.lg-video-object').hasClass('lg-html5')) {
2474                        $el.removeClass('lg-complete');
2475                        $el.find('.lg-video-object').on('load.lg error.lg', function() {
2476                            $el.addClass('lg-complete');
2477                        });
2478                    }
2479
2480                } else {
2481
2482                    var youtubePlayer = $el.find('.lg-youtube').get(0);
2483                    var vimeoPlayer = $el.find('.lg-vimeo').get(0);
2484                    var dailymotionPlayer = $el.find('.lg-dailymotion').get(0);
2485                    var html5Player = $el.find('.lg-html5').get(0);
2486                    if (youtubePlayer) {
2487                        youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
2488                    } else if (vimeoPlayer) {
2489                        try {
2490                            $f(vimeoPlayer).api('play');
2491                        } catch (e) {
2492                            console.error('Make sure you have included froogaloop2 js');
2493                        }
2494                    } else if (dailymotionPlayer) {
2495                        dailymotionPlayer.contentWindow.postMessage('play', '*');
2496
2497                    } else if (html5Player) {
2498                        if (_this.core.s.videojs) {
2499                            try {
2500                                videojs(html5Player).play();
2501                            } catch (e) {
2502                                console.error('Make sure you have included videojs');
2503                            }
2504                        } else {
2505                            html5Player.play();
2506                        }
2507                    }
2508
2509                    $el.addClass('lg-video-playing');
2510
2511                }
2512            }
2513        };
2514    
2515        Video.prototype.destroy = function() {
2516            this.videoLoaded = false;
2517        };
2518
2519        function onHasVideo(event, index, src, html) {
2520            /*jshint validthis:true */
2521            var _this = this;
2522            _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html));
2523            if (html) {
2524                if (_this.core.s.videojs) {
2525                    try {
2526                        videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
2527                            if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
2528                                this.play();
2529                            }
2530                        });
2531                    } catch (e) {
2532                        console.error('Make sure you have included videojs');
2533                    }
2534                } else {
2535                    if(!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
2536                        _this.core.$slide.eq(index).find('.lg-html5').get(0).play();
2537                    }
2538                }
2539            }
2540        }
2541
2542        function onAferAppendSlide(event, index) {
2543            /*jshint validthis:true */
2544            var $videoCont = this.core.$slide.eq(index).find('.lg-video-cont');
2545            if (!$videoCont.hasClass('lg-has-iframe')) {
2546                $videoCont.css('max-width', this.core.s.videoMaxWidth);
2547                this.videoLoaded = true;
2548            }
2549        }
2550
2551        function onBeforeSlide(event, prevIndex, index) {
2552            /*jshint validthis:true */
2553            var _this = this;
2554
2555            var $videoSlide = _this.core.$slide.eq(prevIndex);
2556            var youtubePlayer = $videoSlide.find('.lg-youtube').get(0);
2557            var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0);
2558            var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0);
2559            var vkPlayer = $videoSlide.find('.lg-vk').get(0);
2560            var html5Player = $videoSlide.find('.lg-html5').get(0);
2561            if (youtubePlayer) {
2562                youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
2563            } else if (vimeoPlayer) {
2564                try {
2565                    $f(vimeoPlayer).api('pause');
2566                } catch (e) {
2567                    console.error('Make sure you have included froogaloop2 js');
2568                }
2569            } else if (dailymotionPlayer) {
2570                dailymotionPlayer.contentWindow.postMessage('pause', '*');
2571
2572            } else if (html5Player) {
2573                if (_this.core.s.videojs) {
2574                    try {
2575                        videojs(html5Player).pause();
2576                    } catch (e) {
2577                        console.error('Make sure you have included videojs');
2578                    }
2579                } else {
2580                    html5Player.pause();
2581                }
2582            } if (vkPlayer) {
2583                $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay'));
2584            }
2585
2586            var _src;
2587            if (_this.core.s.dynamic) {
2588                _src = _this.core.s.dynamicEl[index].src;
2589            } else {
2590                _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src');
2591
2592            }
2593
2594            var _isVideo = _this.core.isVideo(_src, index) || {};
2595            if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
2596                _this.core.$outer.addClass('lg-hide-download');
2597            }
2598
2599        }
2600    
2601        $.fn.lightGallery.modules.video = Video;
2602    
2603    })();
2604
2605}));
2606
2607/*! lg-zoom - v1.1.0 - 2017-08-08
2608* http://sachinchoolur.github.io/lightGallery
2609* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
2610
2611(function (root, factory) {
2612  if (typeof define === 'function' && define.amd) {
2613    // AMD. Register as an anonymous module unless amdModuleId is set
2614    define(['jquery'], function (a0) {
2615      return (factory(a0));
2616    });
2617  } else if (typeof exports === 'object') {
2618    // Node. Does not work with strict CommonJS, but
2619    // only CommonJS-like environments that support module.exports,
2620    // like Node.
2621    module.exports = factory(require('jquery'));
2622  } else {
2623    factory(jQuery);
2624  }
2625}(this, function ($) {
2626
2627(function() {
2628
2629    'use strict';
2630
2631    var getUseLeft = function() {
2632        var useLeft = false;
vendor: 10,553 bytes, lines 2633-2948
2633        var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
2634        if (isChrome && parseInt(isChrome[2], 10) < 54) {
2635            useLeft = true;
2636        }
2637
2638        return useLeft;
2639    };
2640
2641    var defaults = {
2642        scale: 1,
2643        zoom: true,
2644        actualSize: true,
2645        enableZoomAfter: 300,
2646        useLeftForZoom: getUseLeft()
2647    };
2648
2649    var Zoom = function(element) {
2650
2651        this.core = $(element).data('lightGallery');
2652
2653        this.core.s = $.extend({}, defaults, this.core.s);
2654
2655        if (this.core.s.zoom && this.core.doCss()) {
2656            this.init();
2657
2658            // Store the zoomable timeout value just to clear it while closing
2659            this.zoomabletimeout = false;
2660
2661            // Set the initial value center
2662            this.pageX = $(window).width() / 2;
2663            this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2664        }
2665
2666        return this;
2667    };
2668
2669    Zoom.prototype.init = function() {
2670
2671        var _this = this;
2672        var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
2673
2674        if (_this.core.s.actualSize) {
2675            zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
2676        }
2677
2678        if (_this.core.s.useLeftForZoom) {
2679            _this.core.$outer.addClass('lg-use-left-for-zoom');
2680        } else {
2681            _this.core.$outer.addClass('lg-use-transition-for-zoom');
2682        }
2683
2684        this.core.$outer.find('.lg-toolbar').append(zoomIcons);
2685
2686        // Add zoomable class
2687        _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
2688
2689            // delay will be 0 except first time
2690            var _speed = _this.core.s.enableZoomAfter + delay;
2691
2692            // set _speed value 0 if gallery opened from direct url and if it is first slide
2693            if ($('body').hasClass('lg-from-hash') && delay) {
2694
2695                // will execute only once
2696                _speed = 0;
2697            } else {
2698
2699                // Remove lg-from-hash to enable starting animation.
2700                $('body').removeClass('lg-from-hash');
2701            }
2702
2703            _this.zoomabletimeout = setTimeout(function() {
2704                _this.core.$slide.eq(index).addClass('lg-zoomable');
2705            }, _speed + 30);
2706        });
2707
2708        var scale = 1;
2709        /**
2710         * @desc Image zoom
2711         * Translate the wrap and scale the image to get better user experience
2712         *
2713         * @param {String} scaleVal - Zoom decrement/increment value
2714         */
2715        var zoom = function(scaleVal) {
2716
2717            var $image = _this.core.$outer.find('.lg-current .lg-image');
2718            var _x;
2719            var _y;
2720
2721            // Find offset manually to avoid issue after zoom
2722            var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2;
2723            var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop();
2724
2725            _x = _this.pageX - offsetX;
2726            _y = _this.pageY - offsetY;
2727
2728            var x = (scaleVal - 1) * (_x);
2729            var y = (scaleVal - 1) * (_y);
2730
2731            $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
2732
2733            if (_this.core.s.useLeftForZoom) {
2734                $image.parent().css({
2735                    left: -x + 'px',
2736                    top: -y + 'px'
2737                }).attr('data-x', x).attr('data-y', y);
2738            } else {
2739                $image.parent().css('transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)').attr('data-x', x).attr('data-y', y);
2740            }
2741        };
2742
2743        var callScale = function() {
2744            if (scale > 1) {
2745                _this.core.$outer.addClass('lg-zoomed');
2746            } else {
2747                _this.resetZoom();
2748            }
2749
2750            if (scale < 1) {
2751                scale = 1;
2752            }
2753
2754            zoom(scale);
2755        };
2756
2757        var actualSize = function(event, $image, index, fromIcon) {
2758            var w = $image.prop('offsetWidth');
2759            var nw;
2760            if (_this.core.s.dynamic) {
2761                nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
2762            } else {
2763                nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
2764            }
2765
2766            var _scale;
2767
2768            if (_this.core.$outer.hasClass('lg-zoomed')) {
2769                scale = 1;
2770            } else {
2771                if (nw > w) {
2772                    _scale = nw / w;
2773                    scale = _scale || 2;
2774                }
2775            }
2776
2777            if (fromIcon) {
2778                _this.pageX = $(window).width() / 2;
2779                _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2780            } else {
2781                _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
2782                _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
2783            }
2784
2785            callScale();
2786            setTimeout(function() {
2787                _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
2788            }, 10);
2789        };
2790
2791        var tapped = false;
2792
2793        // event triggered after appending slide content
2794        _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
2795
2796            // Get the current element
2797            var $image = _this.core.$slide.eq(index).find('.lg-image');
2798
2799            $image.on('dblclick', function(event) {
2800                actualSize(event, $image, index);
2801            });
2802
2803            $image.on('touchstart', function(event) {
2804                if (!tapped) {
2805                    tapped = setTimeout(function() {
2806                        tapped = null;
2807                    }, 300);
2808                } else {
2809                    clearTimeout(tapped);
2810                    tapped = null;
2811                    actualSize(event, $image, index);
2812                }
2813
2814                event.preventDefault();
2815            });
2816
2817        });
2818
2819        // Update zoom on resize and orientationchange
2820        $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
2821            _this.pageX = $(window).width() / 2;
2822            _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2823            zoom(scale);
2824        });
2825
2826        $('#lg-zoom-out').on('click.lg', function() {
2827            if (_this.core.$outer.find('.lg-current .lg-image').length) {
2828                scale -= _this.core.s.scale;
2829                callScale();
2830            }
2831        });
2832
2833        $('#lg-zoom-in').on('click.lg', function() {
2834            if (_this.core.$outer.find('.lg-current .lg-image').length) {
2835                scale += _this.core.s.scale;
2836                callScale();
2837            }
2838        });
2839
2840        $('#lg-actual-size').on('click.lg', function(event) {
2841            actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
2842        });
2843
2844        // Reset zoom on slide change
2845        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2846            scale = 1;
2847            _this.resetZoom();
2848        });
2849
2850        // Drag option after zoom
2851        _this.zoomDrag();
2852
2853        _this.zoomSwipe();
2854
2855    };
2856
2857    // Reset zoom effect
2858    Zoom.prototype.resetZoom = function() {
2859        this.core.$outer.removeClass('lg-zoomed');
2860        this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
2861        this.core.$slide.find('.lg-image').removeAttr('style data-scale');
2862
2863        // Reset pagx pagy values to center
2864        this.pageX = $(window).width() / 2;
2865        this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2866    };
2867
2868    Zoom.prototype.zoomSwipe = function() {
2869        var _this = this;
2870        var startCoords = {};
2871        var endCoords = {};
2872        var isMoved = false;
2873
2874        // Allow x direction drag
2875        var allowX = false;
2876
2877        // Allow Y direction drag
2878        var allowY = false;
2879
2880        _this.core.$slide.on('touchstart.lg', function(e) {
2881
2882            if (_this.core.$outer.hasClass('lg-zoomed')) {
2883                var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2884
2885                allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
2886                allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
2887                if ((allowX || allowY)) {
2888                    e.preventDefault();
2889                    startCoords = {
2890                        x: e.originalEvent.targetTouches[0].pageX,
2891                        y: e.originalEvent.targetTouches[0].pageY
2892                    };
2893                }
2894            }
2895
2896        });
2897
2898        _this.core.$slide.on('touchmove.lg', function(e) {
2899
2900            if (_this.core.$outer.hasClass('lg-zoomed')) {
2901
2902                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
2903                var distanceX;
2904                var distanceY;
2905
2906                e.preventDefault();
2907                isMoved = true;
2908
2909                endCoords = {
2910                    x: e.originalEvent.targetTouches[0].pageX,
2911                    y: e.originalEvent.targetTouches[0].pageY
2912                };
2913
2914                // reset opacity and transition duration
2915                _this.core.$outer.addClass('lg-zoom-dragging');
2916
2917                if (allowY) {
2918                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
2919                } else {
2920                    distanceY = -Math.abs(_$el.attr('data-y'));
2921                }
2922
2923                if (allowX) {
2924                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
2925                } else {
2926                    distanceX = -Math.abs(_$el.attr('data-x'));
2927                }
2928
2929                if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
2930
2931                    if (_this.core.s.useLeftForZoom) {
2932                        _$el.css({
2933                            left: distanceX + 'px',
2934                            top: distanceY + 'px'
2935                        });
2936                    } else {
2937                        _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
2938                    }
2939                }
2940
2941            }
2942
2943        });
2944
2945        _this.core.$slide.on('touchend.lg', function() {
2946            if (_this.core.$outer.hasClass('lg-zoomed')) {
2947                if (isMoved) {
2948                    isMoved = false;
2949                    _this.core.$outer.removeClass('lg-zoom-dragging');
2950                    _this.touchendZoom(startCoords, endCoords, allowX, allowY);
2951
2952                }
2953            }
2954        });
2955
2956    };
2957
2958    Zoom.prototype.zoomDrag = function() {
2959
2960        var _this = this;
2961        var startCoords = {};
2962        var endCoords = {};
2963        var isDraging = false;
2964        var isMoved = false;
2965
2966        // Allow x direction drag
2967        var allowX = false;
2968
2969        // Allow Y direction drag
2970        var allowY = false;
2971
2972        _this.core.$slide.on('mousedown.lg.zoom', function(e) {
2973
2974            // execute only on .lg-object
2975            var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2976
2977            allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
2978            allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
2979
2980            if (_this.core.$outer.hasClass('lg-zoomed')) {
2981                if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
2982                    e.preventDefault();
2983                    startCoords = {
2984                        x: e.pageX,
2985                        y: e.pageY
2986                    };
2987
2988                    isDraging = true;
2989
2990                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2991                    _this.core.$outer.scrollLeft += 1;
2992                    _this.core.$outer.scrollLeft -= 1;
2993
2994                    _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
2995                }
2996            }
2997        });
2998
2999        $(window).on('mousemove.lg.zoom', function(e) {
3000            if (isDraging) {
3001                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
3002                var distanceX;
3003                var distanceY;
3004
3005                isMoved = true;
3006                endCoords = {
3007                    x: e.pageX,
3008                    y: e.pageY
3009                };
3010
3011                // reset opacity and transition duration
3012                _this.core.$outer.addClass('lg-zoom-dragging');
3013
3014                if (allowY) {
3015                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
3016                } else {
3017                    distanceY = -Math.abs(_$el.attr('data-y'));
3018                }
3019
3020                if (allowX) {
3021                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
3022                } else {
3023                    distanceX = -Math.abs(_$el.attr('data-x'));
3024                }
3025
3026                if (_this.core.s.useLeftForZoom) {
3027                    _$el.css({
3028                        left: distanceX + 'px',
3029                        top: distanceY + 'px'
3030                    });
3031                } else {
3032                    _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
3033                }
3034            }
3035        });
3036
3037        $(window).on('mouseup.lg.zoom', function(e) {
3038
3039            if (isDraging) {
3040                isDraging = false;
3041                _this.core.$outer.removeClass('lg-zoom-dragging');
3042
3043                // Fix for chrome mouse move on click
3044                if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
3045                    endCoords = {
3046                        x: e.pageX,
3047                        y: e.pageY
3048                    };
3049                    _this.touchendZoom(startCoords, endCoords, allowX, allowY);
3050
3051                }
3052
3053                isMoved = false;
3054            }
3055
3056            _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
3057
3058        });
3059    };
3060
3061    Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
3062
3063        var _this = this;
3064        var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
3065        var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
3066        var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
3067        var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
3068        var minY = (_this.core.$outer.find('.lg').height() - $image.prop('offsetHeight')) / 2;
3069        var maxY = Math.abs(($image.prop('offsetHeight') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
3070        var minX = (_this.core.$outer.find('.lg').width() - $image.prop('offsetWidth')) / 2;
3071        var maxX = Math.abs(($image.prop('offsetWidth') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
3072
3073        if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
3074            if (allowY) {
3075                if (distanceY <= -maxY) {
3076                    distanceY = -maxY;
3077                } else if (distanceY >= -minY) {
3078                    distanceY = -minY;
3079                }
3080            }
3081
3082            if (allowX) {
3083                if (distanceX <= -maxX) {
3084                    distanceX = -maxX;
3085                } else if (distanceX >= -minX) {
3086                    distanceX = -minX;
3087                }
3088            }
3089
3090            if (allowY) {
3091                _$el.attr('data-y', Math.abs(distanceY));
3092            } else {
3093                distanceY = -Math.abs(_$el.attr('data-y'));
3094            }
3095
3096            if (allowX) {
3097                _$el.attr('data-x', Math.abs(distanceX));
3098            } else {
3099                distanceX = -Math.abs(_$el.attr('data-x'));
3100            }
3101
3102            if (_this.core.s.useLeftForZoom) {
3103                _$el.css({
3104                    left: distanceX + 'px',
3105                    top: distanceY + 'px'
3106                });
3107            } else {
3108                _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
3109            }
3110
3111        }
3112    };
3113
3114    Zoom.prototype.destroy = function() {
3115
3116        var _this = this;
3117
3118        // Unbind all events added by lightGallery zoom plugin
3119        _this.core.$el.off('.lg.zoom');
3120        $(window).off('.lg.zoom');
3121        _this.core.$slide.off('.lg.zoom');
3122        _this.core.$el.off('.lg.tm.zoom');
3123        _this.resetZoom();
3124        clearTimeout(_this.zoomabletimeout);
3125        _this.zoomabletimeout = false;
vendor: 6,021 bytes, lines 3126-3309
3126    };
3127
3128    $.fn.lightGallery.modules.zoom = Zoom;
3129
3130})();
3131
3132
3133}));
3134
3135/*! lg-hash - v1.0.4 - 2017-12-20
3136* http://sachinchoolur.github.io/lightGallery
3137* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
3138
3139(function (root, factory) {
3140  if (typeof define === 'function' && define.amd) {
3141    // AMD. Register as an anonymous module unless amdModuleId is set
3142    define(['jquery'], function (a0) {
3143      return (factory(a0));
3144    });
3145  } else if (typeof exports === 'object') {
3146    // Node. Does not work with strict CommonJS, but
3147    // only CommonJS-like environments that support module.exports,
3148    // like Node.
3149    module.exports = factory(require('jquery'));
3150  } else {
3151    factory(jQuery);
3152  }
3153}(this, function ($) {
3154
3155(function() {
3156
3157    'use strict';
3158
3159    var defaults = {
3160        hash: true
3161    };
3162
3163    var Hash = function(element) {
3164
3165        this.core = $(element).data('lightGallery');
3166
3167        this.core.s = $.extend({}, defaults, this.core.s);
3168
3169        if (this.core.s.hash) {
3170            this.oldHash = window.location.hash;
3171            this.init();
3172        }
3173
3174        return this;
3175    };
3176
3177    Hash.prototype.init = function() {
3178        var _this = this;
3179        var _hash;
3180
3181        // Change hash value on after each slide transition
3182        _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
3183            if (history.replaceState) {
3184                history.replaceState(null, null, window.location.pathname + window.location.search + '#lg=' + _this.core.s.galleryId + '&slide=' + index);
3185            } else {
3186                window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index;
3187            }
3188        });
3189
3190        // Listen hash change and change the slide according to slide value
3191        $(window).on('hashchange.lg.hash', function() {
3192            _hash = window.location.hash;
3193            var _idx = parseInt(_hash.split('&slide=')[1], 10);
3194
3195            // it galleryId doesn't exist in the url close the gallery
3196            if ((_hash.indexOf('lg=' + _this.core.s.galleryId) > -1)) {
3197                _this.core.slide(_idx, false, false);
3198            } else if (_this.core.lGalleryOn) {
3199                _this.core.destroy();
3200            }
3201
3202        });
3203    };
3204
3205    Hash.prototype.destroy = function() {
3206
3207        if (!this.core.s.hash) {
3208            return;
3209        }
3210
3211        // Reset to old hash value
3212        if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) {
3213            if (history.replaceState) {
3214                history.replaceState(null, null, this.oldHash);
3215            } else {
3216                window.location.hash = this.oldHash;
3217            }
3218        } else {
3219            if (history.replaceState) {
3220                history.replaceState(null, document.title, window.location.pathname + window.location.search);
3221            } else {
3222                window.location.hash = '';
3223            }
3224        }
3225
3226        this.core.$el.off('.lg.hash');
3227
3228    };
3229
3230    $.fn.lightGallery.modules.hash = Hash;
3231
3232})();
3233
3234
3235}));
3236
3237/*! lg-share - v1.1.0 - 2017-10-03
3238* http://sachinchoolur.github.io/lightGallery
3239* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
3240
3241(function (root, factory) {
3242  if (typeof define === 'function' && define.amd) {
3243    // AMD. Register as an anonymous module unless amdModuleId is set
3244    define(['jquery'], function (a0) {
3245      return (factory(a0));
3246    });
3247  } else if (typeof exports === 'object') {
3248    // Node. Does not work with strict CommonJS, but
3249    // only CommonJS-like environments that support module.exports,
3250    // like Node.
3251    module.exports = factory(require('jquery'));
3252  } else {
3253    factory(jQuery);
3254  }
3255}(this, function ($) {
3256
3257(function() {
3258
3259    'use strict';
3260
3261    var defaults = {
3262        share: true,
3263        facebook: true,
3264        facebookDropdownText: 'Facebook',
3265        twitter: true,
3266        twitterDropdownText: 'Twitter',
3267        googlePlus: true,
3268        googlePlusDropdownText: 'GooglePlus',
3269        pinterest: true,
3270        pinterestDropdownText: 'Pinterest'
3271    };
3272
3273    var Share = function(element) {
3274
3275        this.core = $(element).data('lightGallery');
3276
3277        this.core.s = $.extend({}, defaults, this.core.s);
3278        if (this.core.s.share) {
3279            this.init();
3280        }
3281
3282        return this;
3283    };
3284
3285    Share.prototype.init = function() {
3286        var _this = this;
3287        var shareHtml = '<span id="lg-share" class="lg-icon">' +
3288            '<ul class="lg-dropdown" style="position: absolute;">';
3289        shareHtml += _this.core.s.facebook ? '<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.facebookDropdownText + '</span></a></li>' : '';
3290        shareHtml += _this.core.s.twitter ? '<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.twitterDropdownText + '</span></a></li>' : '';
3291        shareHtml += _this.core.s.googlePlus ? '<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.googlePlusDropdownText + '</span></a></li>' : '';
3292        shareHtml += _this.core.s.pinterest ? '<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.pinterestDropdownText + '</span></a></li>' : '';
3293        shareHtml += '</ul></span>';
3294
3295        this.core.$outer.find('.lg-toolbar').append(shareHtml);
3296        this.core.$outer.find('.lg').append('<div id="lg-dropdown-overlay"></div>');
3297        $('#lg-share').on('click.lg', function(){
3298            _this.core.$outer.toggleClass('lg-dropdown-active');
3299        });
3300
3301        $('#lg-dropdown-overlay').on('click.lg', function(){
3302            _this.core.$outer.removeClass('lg-dropdown-active');
3303        });
3304
3305        _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
3306
3307            setTimeout(function() {
3308
3309                $('#lg-share-facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + (encodeURIComponent(_this.get
vendor: 1,425 bytes, lines 3309-3343
3309SahreProps(index, 'facebookShareUrl') || window.location.href)));
3310
3311                $('#lg-share-twitter').attr('href', 'https://twitter.com/intent/tweet?text=' + _this.getSahreProps(index, 'tweetText') + '&url=' + (encodeURIComponent(_this.getSahreProps(index, 'twitterShareUrl') || window.location.href)));
3312
3313                $('#lg-share-googleplus').attr('href', 'https://plus.google.com/share?url=' + (encodeURIComponent(_this.getSahreProps(index, 'googleplusShareUrl') || window.location.href)));
3314
3315                $('#lg-share-pinterest').attr('href', 'http://www.pinterest.com/pin/create/button/?url=' + (encodeURIComponent(_this.getSahreProps(index, 'pinterestShareUrl') || window.location.href)) + '&media=' + encodeURIComponent(_this.getSahreProps(index, 'src')) + '&description=' + _this.getSahreProps(index, 'pinterestText'));
3316
3317            }, 100);
3318        });
3319    };
3320
3321    Share.prototype.getSahreProps = function(index, prop){
3322        var shareProp = '';
3323        if(this.core.s.dynamic) {
3324            shareProp = this.core.s.dynamicEl[index][prop];
3325        } else {
3326            var _href = this.core.$items.eq(index).attr('href');
3327            var _prop = this.core.$items.eq(index).data(prop);
3328            shareProp = prop === 'src' ? _href || _prop : _prop;
3329        }
3330        return shareProp;
3331    };
3332
3333    Share.prototype.destroy = function() {
3334
3335    };
3336
3337    $.fn.lightGallery.modules.share = Share;
3338
3339})();
3340
3341
3342
3343}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.