PageSourceSearch

https://anh-usa.org/wp-content/plugins/totalplus/public/js/lightgallery.js

js anh-usa.org collected 2026-10-02 04:43:10 UTC 94,229 bytes, 2,609 lines download raw bytes

1/*! lightgallery - v1.6.5 - 2017-11-16
2 * http://sachinchoolur.github.io/lightGallery/
3 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4/*! lightgallery - v1.6.5 - 2017-11-16
5 * http://sachinchoolur.github.io/lightGallery/
6 * Copyright (c) 2017 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 exports === 'object') {
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                    // execute only on .lg-object
1159                    if (!_this.$outer.hasClass('lg-zoomed')) {
1160                        if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1161                            e.preventDefault();
1162
1163                            if (!_this.lgBusy) {
1164                                _this.manageSwipeClass();
1165                                startCoords = e.pageX;
1166                                isDraging = true;
1167
1168                                // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
1169                                _this.$outer.scrollLeft += 1;
1170                                _this.$outer.scrollLeft -= 1;
1171
1172                                // *
1173
1174                                _this.$outer.removeClass('lg-grab').addClass('lg-grabbing');
1175
1176                                _this.$el.trigger('onDragstart.lg');
1177                            }
1178
1179                        }
1180                    }
1181                });
1182
1183                $(window).on('mousemove.lg', function (e) {
1184                    if (isDraging) {
1185                        isMoved = true;
1186                        endCoords = e.pageX;
1187                        _this.touchMove(startCoords, endCoords);
1188                        _this.$el.trigger('onDragmove.lg');
1189                    }
1190                });
1191
1192                $(window).on('mouseup.lg', function (e) {
1193                    if (isMoved) {
1194                        isMoved = false;
1195                        _this.touchEnd(endCoords - startCoords);
1196                        _this.$el.trigger('onDragend.lg');
1197                    } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1198                        _this.$el.trigger('onSlideClick.lg');
1199                    }
1200
1201                    // Prevent execution on click
1202                    if (isDraging) {
1203                        isDraging = false;
1204                        _this.$outer.removeClass('lg-grabbing').addClass('lg-grab');
1205                    }
1206                });
1207
1208            }
1209        };
1210
1211        Plugin.prototype.manageSwipeClass = function () {
1212            var _touchNext = this.index + 1;
1213            var _touchPrev = this.index - 1;
1214            if (this.s.loop && this.$slide.length > 2) {
1215                if (this.index === 0) {
1216                    _touchPrev = this.$slide.length - 1;
1217                } else if (this.index === this.$slide.length - 1) {
1218                    _touchNext = 0;
1219                }
1220            }
1221
1222            this.$slide.removeClass('lg-next-slide lg-prev-slide');
1223            if (_touchPrev > -1) {
1224                this.$slide.eq(_touchPrev).addClass('lg-prev-slide');
1225            }
1226
1227            this.$slide.eq(_touchNext).addClass('lg-next-slide');
1228        };
1229
1230        Plugin.prototype.mousewheel = function () {
1231            var _this = this;
1232            _this.$outer.on('mousewheel.lg', function (e) {
1233
1234                if (!e.deltaY) {
1235                    return;
1236                }
1237
1238                if (e.deltaY > 0) {
1239                    _this.goToPrevSlide();
1240                } else {
1241                    _this.goToNextSlide();
1242                }
1243
1244                e.preventDefault();
1245            });
1246
1247        };
1248
1249        Plugin.prototype.closeGallery = function () {
1250
1251            var _this = this;
1252            var mousedown = false;
1253            this.$outer.find('.lg-close').on('click.lg', function () {
1254                _this.destroy();
1255            });
1256
1257            if (_this.s.closable) {
1258
1259                // If you drag the slide and release outside gallery gets close on chrome
1260                // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
1261                _this.$outer.on('mousedown.lg', function (e) {
1262
1263                    if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
1264                        mousedown = true;
1265                    } else {
1266                        mousedown = false;
1267                    }
1268
1269                });
1270
1271                _this.$outer.on('mouseup.lg', function (e) {
1272
1273                    if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
1274                        if (!_this.$outer.hasClass('lg-dragging')) {
1275                            _this.destroy();
1276                        }
1277                    }
1278
1279                });
1280
1281            }
1282
1283        };
1284
1285        Plugin.prototype.destroy = function (d) {
1286
1287            var _this = this;
1288
1289            if (!d) {
1290                _this.$el.trigger('onBeforeClose.lg');
1291                $(window).scrollTop(_this.prevScrollTop);
1292            }
1293
1294
1295            /**
1296             * if d is false or undefined destroy will only close the gallery
1297             * plugins instance remains with the element
1298             *
1299             * if d is true destroy will completely remove the plugin
1300             */
1301
1302            if (d) {
1303                if (!_this.s.dynamic) {
1304                    // only when not using dynamic mode is $items a jquery collection
1305                    this.$items.off('click.lg click.lgcustom');
1306                }
1307
1308                $.removeData(_this.el, 'lightGallery');
1309            }
1310
1311            // Unbind all events added by lightGallery
1312            this.$el.off('.lg.tm');
1313
1314            // Distroy all lightGallery modules
1315            $.each($.fn.lightGallery.modules, function (key) {
1316                if (_this.modules[key]) {
1317                    _this.modules[key].destroy();
1318                }
1319            });
1320
1321            this.lGalleryOn = false;
1322
1323            clearTimeout(_this.hideBartimeout);
1324            this.hideBartimeout = false;
1325            $(window).off('.lg');
1326            $('body').removeClass('lg-on lg-from-hash');
1327
1328            if (_this.$outer) {
1329                _this.$outer.removeClass('lg-visible');
1330            }
1331
1332            $('.lg-backdrop').removeClass('in');
1333
1334            setTimeout(function () {
1335                if (_this.$outer) {
1336                    _this.$outer.remove();
1337                }
1338
1339                $('.lg-backdrop').remove();
1340
1341                if (!d) {
1342                    _this.$el.trigger('onCloseAfter.lg');
1343                }
1344
1345            }, _this.s.backdropDuration + 50);
1346        };
1347
1348        $.fn.lightGallery = function (options) {
1349            return this.each(function () {
1350                if (!$.data(this, 'lightGallery')) {
1351                    $.data(this, 'lightGallery', new Plugin(this, options));
1352                } else {
1353                    try {
1354                        $(this).data('lightGallery').init();
1355                    } catch (err) {
1356                        console.error('lightGallery has not initiated properly');
1357                    }
1358                }
1359            });
1360        };
1361
1362        $.fn.lightGallery.modules = {};
1363
1364    })();
1365
1366
1367}));
1368
1369/*! lg-autoplay - v1.0.4 - 2017-03-28
1370 * http://sachinchoolur.github.io/lightGallery
1371 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1372
1373(function (root, factory) {
1374    if (typeof define === 'function' && define.amd) {
1375        // AMD. Register as an anonymous module unless amdModuleId is set
1376        define(['jquery'], function (a0) {
1377            return (factory(a0));
1378        });
1379    } else if (typeof exports === 'object') {
1380        // Node. Does not work with strict CommonJS, but
1381        // only CommonJS-like environments that support module.exports,
1382        // like Node.
1383        module.exports = factory(require('jquery'));
1384    } else {
1385        factory(jQuery);
1386    }
1387}(this, function ($) {
1388
1389
1390    (function () {
1391
1392        'use strict';
1393
1394        var defaults = {
1395            autoplay: false,
1396            pause: 5000,
1397            progressBar: true,
1398            fourceAutoplay: false,
1399            autoplayControls: true,
1400            appendAutoplayControlsTo: '.lg-toolbar'
1401        };
1402
1403        /**
1404         * Creates the autoplay plugin.
1405         * @param {object} element - lightGallery element
1406         */
1407        var Autoplay = function (element) {
1408
1409            this.core = $(element).data('lightGallery');
1410
1411            this.$el = $(element);
1412
1413            // Execute only if items are above 1
1414            if (this.core.$items.length < 2) {
1415                return false;
vendor: 5,111 bytes, lines 1416-1557
1416            }
1417
1418            this.core.s = $.extend({}, defaults, this.core.s);
1419            this.interval = false;
1420
1421            // Identify if slide happened from autoplay
1422            this.fromAuto = true;
1423
1424            // Identify if autoplay canceled from touch/drag
1425            this.canceledOnTouch = false;
1426
1427            // save fourceautoplay value
1428            this.fourceAutoplayTemp = this.core.s.fourceAutoplay;
1429
1430            // do not allow progress bar if browser does not support css3 transitions
1431            if (!this.core.doCss()) {
1432                this.core.s.progressBar = false;
1433            }
1434
1435            this.init();
1436
1437            return this;
1438        };
1439
1440        Autoplay.prototype.init = function () {
1441            var _this = this;
1442
1443            // append autoplay controls
1444            if (_this.core.s.autoplayControls) {
1445                _this.controls();
1446            }
1447
1448            // Create progress bar
1449            if (_this.core.s.progressBar) {
1450                _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
1451            }
1452
1453            // set progress
1454            _this.progress();
1455
1456            // Start autoplay
1457            if (_this.core.s.autoplay) {
1458                _this.$el.one('onSlideItemLoad.lg.tm', function () {
1459                    _this.startlAuto();
1460                });
1461            }
1462
1463            // cancel interval on touchstart and dragstart
1464            _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function () {
1465                if (_this.interval) {
1466                    _this.cancelAuto();
1467                    _this.canceledOnTouch = true;
1468                }
1469            });
1470
1471            // restore autoplay if autoplay canceled from touchstart / dragstart
1472            _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function () {
1473                if (!_this.interval && _this.canceledOnTouch) {
1474                    _this.startlAuto();
1475                    _this.canceledOnTouch = false;
1476                }
1477            });
1478
1479        };
1480
1481        Autoplay.prototype.progress = function () {
1482
1483            var _this = this;
1484            var _$progressBar;
1485            var _$progress;
1486
1487            _this.$el.on('onBeforeSlide.lg.tm', function () {
1488
1489                // start progress bar animation
1490                if (_this.core.s.progressBar && _this.fromAuto) {
1491                    _$progressBar = _this.core.$outer.find('.lg-progress-bar');
1492                    _$progress = _this.core.$outer.find('.lg-progress');
1493                    if (_this.interval) {
1494                        _$progress.removeAttr('style');
1495                        _$progressBar.removeClass('lg-start');
1496                        setTimeout(function () {
1497                            _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
1498                            _$progressBar.addClass('lg-start');
1499                        }, 20);
1500                    }
1501                }
1502
1503                // Remove setinterval if slide is triggered manually and fourceautoplay is false
1504                if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
1505                    _this.cancelAuto();
1506                }
1507
1508                _this.fromAuto = false;
1509
1510            });
1511        };
1512
1513        // Manage autoplay via play/stop buttons
1514        Autoplay.prototype.controls = function () {
1515            var _this = this;
1516            var _html = '<span class="lg-autoplay-button lg-icon"></span>';
1517
1518            // Append autoplay controls
1519            $(this.core.s.appendAutoplayControlsTo).append(_html);
1520
1521            _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function () {
1522                if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
1523                    _this.cancelAuto();
1524                    _this.core.s.fourceAutoplay = false;
1525                } else {
1526                    if (!_this.interval) {
1527                        _this.startlAuto();
1528                        _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
1529                    }
1530                }
1531            });
1532        };
1533
1534        // Autostart gallery
1535        Autoplay.prototype.startlAuto = function () {
1536            var _this = this;
1537
1538            _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
1539            _this.core.$outer.addClass('lg-show-autoplay');
1540            _this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
1541
1542            _this.interval = setInterval(function () {
1543                if (_this.core.index + 1 < _this.core.$items.length) {
1544                    _this.core.index++;
1545                } else {
1546                    _this.core.index = 0;
1547                }
1548
1549                _this.fromAuto = true;
1550                _this.core.slide(_this.core.index, false, false, 'next');
1551            }, _this.core.s.speed + _this.core.s.pause);
1552        };
1553
1554        // cancel Autostart
1555        Autoplay.prototype.cancelAuto = function () {
1556            clearInterval(this.interval);
1557            this.interval = false;
1558            this.core.$outer.find('.lg-progress').removeAttr('style');
1559            this.core.$outer.removeClass('lg-show-autoplay');
1560            this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
1561        };
1562
1563        Autoplay.prototype.destroy = function () {
1564
1565            this.cancelAuto();
1566            this.core.$outer.find('.lg-progress-bar').remove();
1567        };
1568
1569        $.fn.lightGallery.modules.autoplay = Autoplay;
1570
1571    })();
1572
1573
1574}));
1575
1576/*! lg-fullscreen - v1.0.1 - 2016-09-30
1577 * http://sachinchoolur.github.io/lightGallery
1578 * Copyright (c) 2016 Sachin N; Licensed GPLv3 */
1579
1580(function (root, factory) {
1581    if (typeof define === 'function' && define.amd) {
1582        // AMD. Register as an anonymous module unless amdModuleId is set
1583        define(['jquery'], function (a0) {
1584            return (factory(a0));
1585        });
1586    } else if (typeof exports === 'object') {
1587        // Node. Does not work with strict CommonJS, but
1588        // only CommonJS-like environments that support module.exports,
1589        // like Node.
1590        module.exports = factory(require('jquery'));
1591    } else {
1592        factory(jQuery);
1593    }
1594}(this, function ($) {
1595
1596    (function () {
1597
1598        'use strict';
1599
1600        var defaults = {
1601            fullScreen: true
1602        };
1603
1604        var Fullscreen = function (element) {
1605
1606            // get lightGallery core plugin data
1607            this.core = $(element).data('lightGallery');
1608
1609            this.$el = $(element);
1610
1611            // extend module defalut settings with lightGallery core settings
1612            this.core.s = $.extend({}, defaults, this.core.s);
1613
1614            this.init();
1615
1616            return this;
1617        };
1618
1619        Fullscreen.prototype.init = function () {
1620            var fullScreen = '';
1621            if (this.core.s.fullScreen) {
1622
1623                // check for fullscreen browser support
1624                if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
1625                        !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
1626                    return;
1627                } else {
1628                    fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
1629                    this.core.$outer.find('.lg-toolbar').append(fullScreen);
1630                    this.fullScreen();
1631                }
1632            }
1633        };
1634
1635        Fullscreen.prototype.requestFullscreen = function () {
1636            var el = document.documentElement;
1637            if (el.requestFullscreen) {
1638                el.requestFullscreen();
1639            } else if (el.msRequestFullscreen) {
1640                el.msRequestFullscreen();
1641            } else if (el.mozRequestFullScreen) {
1642                el.mozRequestFullScreen();
1643            } else if (el.webkitRequestFullscreen) {
1644                el.webkitRequestFullscreen();
1645            }
1646        };
1647
1648        Fullscreen.prototype.exitFullscreen = function () {
1649            if (document.exitFullscreen) {
1650                document.exitFullscreen();
1651            } else if (document.msExitFullscreen) {
1652                document.msExitFullscreen();
1653            } else if (document.mozCancelFullScreen) {
1654                document.mozCancelFullScreen();
1655            } else if (document.webkitExitFullscreen) {
1656                document.webkitExitFullscreen();
1657            }
1658        };
1659
1660        // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
1661        Fullscreen.prototype.fullScreen = function () {
1662            var _this = this;
1663
1664            $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function () {
1665                _this.core.$outer.toggleClass('lg-fullscreen-on');
1666            });
1667
1668            this.core.$outer.find('.lg-fullscreen').on('click.lg', function () {
1669                if (!document.fullscreenElement &&
1670                        !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
1671                    _this.requestFullscreen();
1672                } else {
1673                    _this.exitFullscreen();
1674                }
1675            });
1676
1677        };
1678
1679        Fullscreen.prototype.destroy = function () {
1680
1681            // exit from fullscreen if activated
1682            this.exitFullscreen();
1683
1684            $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
1685        };
1686
1687        $.fn.lightGallery.modules.fullscreen = Fullscreen;
1688
1689    })();
1690
1691}));
1692
1693/*! lg-pager - v1.0.2 - 2017-01-22
1694 * http://sachinchoolur.github.io/lightGallery
1695 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1696
1697(function (root, factory) {
1698    if (typeof define === 'function' && define.amd) {
1699        // AMD. Register as an anonymous module unless amdModuleId is set
1700        define(['jquery'], function (a0) {
1701            return (factory(a0));
1702        });
1703    } else if (typeof exports === 'object') {
1704        // Node. Does not work with strict CommonJS, but
1705        // only CommonJS-like environments that support module.exports,
1706        // like Node.
1707        module.exports = factory(require('jquery'));
1708    } else {
1709        factory(jQuery);
1710    }
1711}(this, function ($) {
1712
1713    (function () {
1714
1715        'use strict';
1716
1717        var defaults = {
1718            pager: false
1719        };
1720
1721        var Pager = function (element) {
1722
1723            this.core = $(element).data('lightGallery');
1724
1725            this.$el = $(element);
1726            this.core.s = $.extend({}, defaults, this.core.s);
1727            if (this.core.s.pager && this.core.$items.length > 1) {
1728                this.init();
1729            }
1730
1731            return this;
1732        };
1733
1734        Pager.prototype.init = function () {
1735            var _this = this;
1736            var pagerList = '';
1737            var $pagerCont;
1738            var $pagerOuter;
1739            var timeout;
1740
1741            _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');
1742
1743            if (_this.core.s.dynamic) {
1744                for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1745                    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>';
1746                }
1747            } else {
1748                _this.core.$items.each(function () {
1749
1750                    if (!_this.core.s.exThumbImage) {
1751                        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>';
1752                    } else {
1753                        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>';
1754                    }
1755
1756                });
1757            }
1758
1759            $pagerOuter = _this.core.$outer.find('.lg-pager-outer');
1760
vendor: 19,453 bytes, lines 1761-2311
1761            $pagerOuter.html(pagerList);
1762
1763            $pagerCont = _this.core.$outer.find('.lg-pager-cont');
1764            $pagerCont.on('click.lg touchend.lg', function () {
1765                var _$this = $(this);
1766                _this.core.index = _$this.index();
1767                _this.core.slide(_this.core.index, false, true, false);
1768            });
1769
1770            $pagerOuter.on('mouseover.lg', function () {
1771                clearTimeout(timeout);
1772                $pagerOuter.addClass('lg-pager-hover');
1773            });
1774
1775            $pagerOuter.on('mouseout.lg', function () {
1776                timeout = setTimeout(function () {
1777                    $pagerOuter.removeClass('lg-pager-hover');
1778                });
1779            });
1780
1781            _this.core.$el.on('onBeforeSlide.lg.tm', function (e, prevIndex, index) {
1782                $pagerCont.removeClass('lg-pager-active');
1783                $pagerCont.eq(index).addClass('lg-pager-active');
1784            });
1785
1786        };
1787
1788        Pager.prototype.destroy = function () {
1789
1790        };
1791
1792        $.fn.lightGallery.modules.pager = Pager;
1793
1794    })();
1795
1796
1797}));
1798
1799/*! lg-thumbnail - v1.1.0 - 2017-08-08
1800 * http://sachinchoolur.github.io/lightGallery
1801 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1802
1803(function (root, factory) {
1804    if (typeof define === 'function' && define.amd) {
1805        // AMD. Register as an anonymous module unless amdModuleId is set
1806        define(['jquery'], function (a0) {
1807            return (factory(a0));
1808        });
1809    } else if (typeof exports === 'object') {
1810        // Node. Does not work with strict CommonJS, but
1811        // only CommonJS-like environments that support module.exports,
1812        // like Node.
1813        module.exports = factory(require('jquery'));
1814    } else {
1815        factory(jQuery);
1816    }
1817}(this, function ($) {
1818
1819    (function () {
1820
1821        'use strict';
1822
1823        var defaults = {
1824            thumbnail: true,
1825
1826            animateThumb: true,
1827            currentPagerPosition: 'middle',
1828
1829            thumbWidth: 100,
1830            thumbHeight: '80px',
1831            thumbContHeight: 100,
1832            thumbMargin: 5,
1833
1834            exThumbImage: false,
1835            showThumbByDefault: true,
1836            toogleThumb: true,
1837            pullCaptionUp: true,
1838
1839            enableThumbDrag: true,
1840            enableThumbSwipe: true,
1841            swipeThreshold: 50,
1842
1843            loadYoutubeThumbnail: true,
1844            youtubeThumbSize: 1,
1845
1846            loadVimeoThumbnail: true,
1847            vimeoThumbSize: 'thumbnail_small',
1848
1849            loadDailymotionThumbnail: true
1850        };
1851
1852        var Thumbnail = function (element) {
1853
1854            // get lightGallery core plugin data
1855            this.core = $(element).data('lightGallery');
1856
1857            // extend module default settings with lightGallery core settings
1858            this.core.s = $.extend({}, defaults, this.core.s);
1859
1860            this.$el = $(element);
1861            this.$thumbOuter = null;
1862            this.thumbOuterWidth = 0;
1863            this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
1864            this.thumbIndex = this.core.index;
1865
1866            if (this.core.s.animateThumb) {
1867                this.core.s.thumbHeight = '100%';
1868            }
1869
1870            // Thumbnail animation value
1871            this.left = 0;
1872
1873            this.init();
1874
1875            return this;
1876        };
1877
1878        Thumbnail.prototype.init = function () {
1879            var _this = this;
1880            if (this.core.s.thumbnail && this.core.$items.length > 1) {
1881                if (this.core.s.showThumbByDefault) {
1882                    setTimeout(function () {
1883                        _this.core.$outer.addClass('lg-thumb-open');
1884                    }, 700);
1885                }
1886
1887                if (this.core.s.pullCaptionUp) {
1888                    this.core.$outer.addClass('lg-pull-caption-up');
1889                }
1890
1891                this.build();
1892                if (this.core.s.animateThumb && this.core.doCss()) {
1893                    if (this.core.s.enableThumbDrag) {
1894                        this.enableThumbDrag();
1895                    }
1896
1897                    if (this.core.s.enableThumbSwipe) {
1898                        this.enableThumbSwipe();
1899                    }
1900
1901                    this.thumbClickable = false;
1902                } else {
1903                    this.thumbClickable = true;
1904                }
1905
1906                this.toogle();
1907                this.thumbkeyPress();
1908            }
1909        };
1910
1911        Thumbnail.prototype.build = function () {
1912            var _this = this;
1913            var thumbList = '';
1914            var vimeoErrorThumbSize = '';
1915            var $thumb;
1916            var html = '<div class="lg-thumb-outer">' +
1917                    '<div class="lg-thumb lg-group">' +
1918                    '</div>' +
1919                    '</div>';
1920
1921            switch (this.core.s.vimeoThumbSize) {
1922                case 'thumbnail_large':
1923                    vimeoErrorThumbSize = '640';
1924                    break;
1925                case 'thumbnail_medium':
1926                    vimeoErrorThumbSize = '200x150';
1927                    break;
1928                case 'thumbnail_small':
1929                    vimeoErrorThumbSize = '100x75';
1930            }
1931
1932            _this.core.$outer.addClass('lg-has-thumb');
1933
1934            _this.core.$outer.find('.lg').append(html);
1935
1936            _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
1937            _this.thumbOuterWidth = _this.$thumbOuter.width();
1938
1939            if (_this.core.s.animateThumb) {
1940                _this.core.$outer.find('.lg-thumb').css({
1941                    width: _this.thumbTotalWidth + 'px',
1942                    position: 'relative'
1943                });
1944            }
1945
1946            if (this.core.s.animateThumb) {
1947                _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
1948            }
1949
1950            function getThumb(src, thumb, index) {
1951                var isVideo = _this.core.isVideo(src, index) || {};
1952                var thumbImg;
1953                var vimeoId = '';
1954
1955                if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
1956                    if (isVideo.youtube) {
1957                        if (_this.core.s.loadYoutubeThumbnail) {
1958                            thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
1959                        } else {
1960                            thumbImg = thumb;
1961                        }
1962                    } else if (isVideo.vimeo) {
1963                        if (_this.core.s.loadVimeoThumbnail) {
1964                            thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
1965                            vimeoId = isVideo.vimeo[1];
1966                        } else {
1967                            thumbImg = thumb;
1968                        }
1969                    } else if (isVideo.dailymotion) {
1970                        if (_this.core.s.loadDailymotionThumbnail) {
1971                            thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
1972                        } else {
1973                            thumbImg = thumb;
1974                        }
1975                    }
1976                } else {
1977                    thumbImg = thumb;
1978                }
1979
1980                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>';
1981                vimeoId = '';
1982            }
1983
1984            if (_this.core.s.dynamic) {
1985                for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1986                    getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
1987                }
1988            } else {
1989                _this.core.$items.each(function (i) {
1990
1991                    if (!_this.core.s.exThumbImage) {
1992                        getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
1993                    } else {
1994                        getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
1995                    }
1996
1997                });
1998            }
1999
2000            _this.core.$outer.find('.lg-thumb').html(thumbList);
2001
2002            $thumb = _this.core.$outer.find('.lg-thumb-item');
2003
2004            // Load vimeo thumbnails
2005            $thumb.each(function () {
2006                var $this = $(this);
2007                var vimeoVideoId = $this.attr('data-vimeo-id');
2008
2009                if (vimeoVideoId) {
2010                    $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
2011                        format: 'json'
2012                    }, function (data) {
2013                        $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
2014                    });
2015                }
2016            });
2017
2018            // manage active class for thumbnail
2019            $thumb.eq(_this.core.index).addClass('active');
2020            _this.core.$el.on('onBeforeSlide.lg.tm', function () {
2021                $thumb.removeClass('active');
2022                $thumb.eq(_this.core.index).addClass('active');
2023            });
2024
2025            $thumb.on('click.lg touchend.lg', function () {
2026                var _$this = $(this);
2027                setTimeout(function () {
2028
2029                    // In IE9 and bellow touch does not support
2030                    // Go to slide if browser does not support css transitions
2031                    if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
2032                        _this.core.index = _$this.index();
2033                        _this.core.slide(_this.core.index, false, true, false);
2034                    }
2035                }, 50);
2036            });
2037
2038            _this.core.$el.on('onBeforeSlide.lg.tm', function () {
2039                _this.animateThumb(_this.core.index);
2040            });
2041
2042            $(window).on('resize.lg.thumb orientationchange.lg.thumb', function () {
2043                setTimeout(function () {
2044                    _this.animateThumb(_this.core.index);
2045                    _this.thumbOuterWidth = _this.$thumbOuter.width();
2046                }, 200);
2047            });
2048
2049        };
2050
2051        Thumbnail.prototype.setTranslate = function (value) {
2052            // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
2053            this.core.$outer.find('.lg-thumb').css({
2054                transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
2055            });
2056        };
2057
2058        Thumbnail.prototype.animateThumb = function (index) {
2059            var $thumb = this.core.$outer.find('.lg-thumb');
2060            if (this.core.s.animateThumb) {
2061                var position;
2062                switch (this.core.s.currentPagerPosition) {
2063                    case 'left':
2064                        position = 0;
2065                        break;
2066                    case 'middle':
2067                        position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
2068                        break;
2069                    case 'right':
2070                        position = this.thumbOuterWidth - this.core.s.thumbWidth;
2071                }
2072                this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
2073                if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
2074                    this.left = this.thumbTotalWidth - this.thumbOuterWidth;
2075                }
2076
2077                if (this.left < 0) {
2078                    this.left = 0;
2079                }
2080
2081                if (this.core.lGalleryOn) {
2082                    if (!$thumb.hasClass('on')) {
2083                        this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
2084                    }
2085
2086                    if (!this.core.doCss()) {
2087                        $thumb.animate({
2088                            left: -this.left + 'px'
2089                        }, this.core.s.speed);
2090                    }
2091                } else {
2092                    if (!this.core.doCss()) {
2093                        $thumb.css('left', -this.left + 'px');
2094                    }
2095                }
2096
2097                this.setTranslate(this.left);
2098
2099            }
2100        };
2101
2102        // Enable thumbnail dragging and swiping
2103        Thumbnail.prototype.enableThumbDrag = function () {
2104
2105            var _this = this;
2106            var startCoords = 0;
2107            var endCoords = 0;
2108            var isDraging = false;
2109            var isMoved = false;
2110            var tempLeft = 0;
2111
2112            _this.$thumbOuter.addClass('lg-grab');
2113
2114            _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function (e) {
2115                if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2116                    // execute only on .lg-object
2117                    e.preventDefault();
2118                    startCoords = e.pageX;
2119                    isDraging = true;
2120
2121                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2122                    _this.core.$outer.scrollLeft += 1;
2123                    _this.core.$outer.scrollLeft -= 1;
2124
2125                    // *
2126                    _this.thumbClickable = false;
2127                    _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
2128                }
2129            });
2130
2131            $(window).on('mousemove.lg.thumb', function (e) {
2132                if (isDraging) {
2133                    tempLeft = _this.left;
2134                    isMoved = true;
2135                    endCoords = e.pageX;
2136
2137                    _this.$thumbOuter.addClass('lg-dragging');
2138
2139                    tempLeft = tempLeft - (endCoords - startCoords);
2140
2141                    if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2142                        tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2143                    }
2144
2145                    if (tempLeft < 0) {
2146                        tempLeft = 0;
2147                    }
2148
2149                    // move current slide
2150                    _this.setTranslate(tempLeft);
2151
2152                }
2153            });
2154
2155            $(window).on('mouseup.lg.thumb', function () {
2156                if (isMoved) {
2157                    isMoved = false;
2158                    _this.$thumbOuter.removeClass('lg-dragging');
2159
2160                    _this.left = tempLeft;
2161
2162                    if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2163                        _this.thumbClickable = true;
2164                    }
2165
2166                } else {
2167                    _this.thumbClickable = true;
2168                }
2169
2170                if (isDraging) {
2171                    isDraging = false;
2172                    _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
2173                }
2174            });
2175
2176        };
2177
2178        Thumbnail.prototype.enableThumbSwipe = function () {
2179            var _this = this;
2180            var startCoords = 0;
2181            var endCoords = 0;
2182            var isMoved = false;
2183            var tempLeft = 0;
2184
2185            _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function (e) {
2186                if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2187                    e.preventDefault();
2188                    startCoords = e.originalEvent.targetTouches[0].pageX;
2189                    _this.thumbClickable = false;
2190                }
2191            });
2192
2193            _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function (e) {
2194                if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2195                    e.preventDefault();
2196                    endCoords = e.originalEvent.targetTouches[0].pageX;
2197                    isMoved = true;
2198
2199                    _this.$thumbOuter.addClass('lg-dragging');
2200
2201                    tempLeft = _this.left;
2202
2203                    tempLeft = tempLeft - (endCoords - startCoords);
2204
2205                    if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2206                        tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2207                    }
2208
2209                    if (tempLeft < 0) {
2210                        tempLeft = 0;
2211                    }
2212
2213                    // move current slide
2214                    _this.setTranslate(tempLeft);
2215
2216                }
2217            });
2218
2219            _this.core.$outer.find('.lg-thumb').on('touchend.lg', function () {
2220                if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2221
2222                    if (isMoved) {
2223                        isMoved = false;
2224                        _this.$thumbOuter.removeClass('lg-dragging');
2225                        if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2226                            _this.thumbClickable = true;
2227                        }
2228
2229                        _this.left = tempLeft;
2230                    } else {
2231                        _this.thumbClickable = true;
2232                    }
2233                } else {
2234                    _this.thumbClickable = true;
2235                }
2236            });
2237
2238        };
2239
2240        Thumbnail.prototype.toogle = function () {
2241            var _this = this;
2242            if (_this.core.s.toogleThumb) {
2243                _this.core.$outer.addClass('lg-can-toggle');
2244                _this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
2245                _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function () {
2246                    _this.core.$outer.toggleClass('lg-thumb-open');
2247                });
2248            }
2249        };
2250
2251        Thumbnail.prototype.thumbkeyPress = function () {
2252            var _this = this;
2253            $(window).on('keydown.lg.thumb', function (e) {
2254                if (e.keyCode === 38) {
2255                    e.preventDefault();
2256                    _this.core.$outer.addClass('lg-thumb-open');
2257                } else if (e.keyCode === 40) {
2258                    e.preventDefault();
2259                    _this.core.$outer.removeClass('lg-thumb-open');
2260                }
2261            });
2262        };
2263
2264        Thumbnail.prototype.destroy = function () {
2265            if (this.core.s.thumbnail && this.core.$items.length > 1) {
2266                $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
2267                this.$thumbOuter.remove();
2268                this.core.$outer.removeClass('lg-has-thumb');
2269            }
2270        };
2271
2272        $.fn.lightGallery.modules.Thumbnail = Thumbnail;
2273
2274    })();
2275
2276}));
2277
2278/*! lg-video - v1.2.0 - 2017-11-16
2279 * http://sachinchoolur.github.io/lightGallery
2280 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
2281
2282(function (root, factory) {
2283    if (typeof define === 'function' && define.amd) {
2284        // AMD. Register as an anonymous module unless amdModuleId is set
2285        define(['jquery'], function (a0) {
2286            return (factory(a0));
2287        });
2288    } else if (typeof exports === 'object') {
2289        // Node. Does not work with strict CommonJS, but
2290        // only CommonJS-like environments that support module.exports,
2291        // like Node.
2292        module.exports = factory(require('jquery'));
2293    } else {
2294        factory(jQuery);
2295    }
2296}(this, function ($) {
2297
2298    (function () {
2299
2300        'use strict';
2301
2302        var defaults = {
2303            videoMaxWidth: '855px',
2304
2305            autoplayFirstVideo: true,
2306
2307            youtubePlayerParams: false,
2308            vimeoPlayerParams: false,
2309            dailymotionPlayerParams: false,
2310            vkPlayerParams: false,
2311
vendor: 12,063 bytes, lines 2312-2609
2312            videojs: false,
2313            videojsOptions: {}
2314        };
2315
2316        var Video = function (element) {
2317
2318            this.core = $(element).data('lightGallery');
2319
2320            this.$el = $(element);
2321            this.core.s = $.extend({}, defaults, this.core.s);
2322            this.videoLoaded = false;
2323
2324            this.init();
2325
2326            return this;
2327        };
2328
2329        Video.prototype.init = function () {
2330            var _this = this;
2331
2332            // Event triggered when video url found without poster
2333            _this.core.$el.on('hasVideo.lg.tm', onHasVideo.bind(this));
2334
2335            // Set max width for video
2336            _this.core.$el.on('onAferAppendSlide.lg.tm', onAferAppendSlide.bind(this));
2337
2338            if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) {
2339                _this.core.$el.on('onSlideClick.lg.tm', function () {
2340                    var $el = _this.core.$slide.eq(_this.core.index);
2341                    _this.loadVideoOnclick($el);
2342                });
2343            } else {
2344
2345                // For IE 9 and bellow
2346                _this.core.$slide.on('click.lg', function () {
2347                    _this.loadVideoOnclick($(this));
2348                });
2349            }
2350
2351            _this.core.$el.on('onBeforeSlide.lg.tm', onBeforeSlide.bind(this));
2352
2353            _this.core.$el.on('onAfterSlide.lg.tm', function (event, prevIndex) {
2354                _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing');
2355            });
2356        };
2357
2358        Video.prototype.loadVideo = function (src, addClass, noPoster, index, html) {
2359            var video = '';
2360            var autoplay = 1;
2361            var a = '';
2362            var isVideo = this.core.isVideo(src, index) || {};
2363
2364            // Enable autoplay based on setting for first video if poster doesn't exist
2365            if (noPoster) {
2366                if (this.videoLoaded) {
2367                    autoplay = 0;
2368                } else {
2369                    autoplay = this.core.s.autoplayFirstVideo ? 1 : 0;
2370                }
2371            }
2372
2373            if (isVideo.youtube) {
2374
2375                a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
2376                if (this.core.s.youtubePlayerParams) {
2377                    a = a + '&' + $.param(this.core.s.youtubePlayerParams);
2378                }
2379
2380                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>';
2381
2382            } else if (isVideo.vimeo) {
2383
2384                a = '?autoplay=' + autoplay + '&api=1';
2385                if (this.core.s.vimeoPlayerParams) {
2386                    a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
2387                }
2388
2389                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>';
2390
2391            } else if (isVideo.dailymotion) {
2392
2393                a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
2394                if (this.core.s.dailymotionPlayerParams) {
2395                    a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
2396                }
2397
2398                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>';
2399
2400            } else if (isVideo.html5) {
2401                var fL = html.substring(0, 1);
2402                if (fL === '.' || fL === '#') {
2403                    html = $(html).html();
2404                }
2405
2406                video = html;
2407
2408            } else if (isVideo.vk) {
2409
2410                a = '&autoplay=' + autoplay;
2411                if (this.core.s.vkPlayerParams) {
2412                    a = a + '&' + $.param(this.core.s.vkPlayerParams);
2413                }
2414
2415                video = '<iframe class="lg-video-object lg-vk ' + addClass + '" width="560" height="315" src="http://vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>';
2416
2417            }
2418
2419            return video;
2420        };
2421
2422        Video.prototype.loadVideoOnclick = function ($el) {
2423
2424            var _this = this;
2425            // check slide has poster
2426            if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {
2427
2428                // check already video element present
2429                if (!$el.hasClass('lg-has-video')) {
2430
2431                    $el.addClass('lg-video-playing lg-has-video');
2432
2433                    var _src;
2434                    var _html;
2435                    var _loadVideo = function (_src, _html) {
2436
2437                        $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html));
2438
2439                        if (_html) {
2440                            if (_this.core.s.videojs) {
2441                                try {
2442                                    videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function () {
2443                                        this.play();
2444                                    });
2445                                } catch (e) {
2446                                    console.error('Make sure you have included videojs');
2447                                }
2448                            } else {
2449                                _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play();
2450                            }
2451                        }
2452
2453                    };
2454
2455                    if (_this.core.s.dynamic) {
2456
2457                        _src = _this.core.s.dynamicEl[_this.core.index].src;
2458                        _html = _this.core.s.dynamicEl[_this.core.index].html;
2459
2460                        _loadVideo(_src, _html);
2461
2462                    } else {
2463
2464                        _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src');
2465                        _html = _this.core.$items.eq(_this.core.index).attr('data-html');
2466
2467                        _loadVideo(_src, _html);
2468
2469                    }
2470
2471                    var $tempImg = $el.find('.lg-object');
2472                    $el.find('.lg-video').append($tempImg);
2473
2474                    // @todo loading icon for html5 videos also
2475                    // for showing the loading indicator while loading video
2476                    if (!$el.find('.lg-video-object').hasClass('lg-html5')) {
2477                        $el.removeClass('lg-complete');
2478                        $el.find('.lg-video-object').on('load.lg error.lg', function () {
2479                            $el.addClass('lg-complete');
2480                        });
2481                    }
2482
2483                } else {
2484
2485                    var youtubePlayer = $el.find('.lg-youtube').get(0);
2486                    var vimeoPlayer = $el.find('.lg-vimeo').get(0);
2487                    var dailymotionPlayer = $el.find('.lg-dailymotion').get(0);
2488                    var html5Player = $el.find('.lg-html5').get(0);
2489                    if (youtubePlayer) {
2490                        youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
2491                    } else if (vimeoPlayer) {
2492                        try {
2493                            $f(vimeoPlayer).api('play');
2494                        } catch (e) {
2495                            console.error('Make sure you have included froogaloop2 js');
2496                        }
2497                    } else if (dailymotionPlayer) {
2498                        dailymotionPlayer.contentWindow.postMessage('play', '*');
2499
2500                    } else if (html5Player) {
2501                        if (_this.core.s.videojs) {
2502                            try {
2503                                videojs(html5Player).play();
2504                            } catch (e) {
2505                                console.error('Make sure you have included videojs');
2506                            }
2507                        } else {
2508                            html5Player.play();
2509                        }
2510                    }
2511
2512                    $el.addClass('lg-video-playing');
2513
2514                }
2515            }
2516        };
2517
2518        Video.prototype.destroy = function () {
2519            this.videoLoaded = false;
2520        };
2521
2522        function onHasVideo(event, index, src, html) {
2523            /*jshint validthis:true */
2524            var _this = this;
2525            _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html));
2526            if (html) {
2527                if (_this.core.s.videojs) {
2528                    try {
2529                        videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function () {
2530                            if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
2531                                this.play();
2532                            }
2533                        });
2534                    } catch (e) {
2535                        console.error('Make sure you have included videojs');
2536                    }
2537                } else {
2538                    if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
2539                        _this.core.$slide.eq(index).find('.lg-html5').get(0).play();
2540                    }
2541                }
2542            }
2543        }
2544
2545        function onAferAppendSlide(event, index) {
2546            /*jshint validthis:true */
2547            var $videoCont = this.core.$slide.eq(index).find('.lg-video-cont');
2548            if (!$videoCont.hasClass('lg-has-iframe')) {
2549                $videoCont.css('max-width', this.core.s.videoMaxWidth);
2550                this.videoLoaded = true;
2551            }
2552        }
2553
2554        function onBeforeSlide(event, prevIndex, index) {
2555            /*jshint validthis:true */
2556            var _this = this;
2557
2558            var $videoSlide = _this.core.$slide.eq(prevIndex);
2559            var youtubePlayer = $videoSlide.find('.lg-youtube').get(0);
2560            var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0);
2561            var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0);
2562            var vkPlayer = $videoSlide.find('.lg-vk').get(0);
2563            var html5Player = $videoSlide.find('.lg-html5').get(0);
2564            if (youtubePlayer) {
2565                youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
2566            } else if (vimeoPlayer) {
2567                try {
2568                    $f(vimeoPlayer).api('pause');
2569                } catch (e) {
2570                    console.error('Make sure you have included froogaloop2 js');
2571                }
2572            } else if (dailymotionPlayer) {
2573                dailymotionPlayer.contentWindow.postMessage('pause', '*');
2574
2575            } else if (html5Player) {
2576                if (_this.core.s.videojs) {
2577                    try {
2578                        videojs(html5Player).pause();
2579                    } catch (e) {
2580                        console.error('Make sure you have included videojs');
2581                    }
2582                } else {
2583                    html5Player.pause();
2584                }
2585            }
2586            if (vkPlayer) {
2587                $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay'));
2588            }
2589
2590            var _src;
2591            if (_this.core.s.dynamic) {
2592                _src = _this.core.s.dynamicEl[index].src;
2593            } else {
2594                _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src');
2595
2596            }
2597
2598            var _isVideo = _this.core.isVideo(_src, index) || {};
2599            if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
2600                _this.core.$outer.addClass('lg-hide-download');
2601            }
2602
2603        }
2604
2605        $.fn.lightGallery.modules.video = Video;
2606
2607    })();
2608
2609}));

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.