PageSourceSearch

https://www.nmtl.gov.tw/Scripts/lightGallery/js/lightgallery-all.min.js

js nmtl.gov.tw collected 2026-10-02 03:57:25 UTC 126,643 bytes, 3,388 lines download raw bytes

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

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.