PageSourceSearch

https://idigitalise.net/wp-content/themes/idigitalise/js/lightgallery-online.min.js

js idigitalise.net collected 2026-10-06 13:20:51 UTC 72,811 bytes, 2,051 lines download raw bytes

1/**!
2 * lightgallery.js | 1.4.1-beta.0 | October 29th 2020
3 * http://sachinchoolur.github.io/lightgallery.js/
4 * Copyright (c) 2016 Sachin N;
5 * @license GPLv3
6 */ (function (f) {
7  if (typeof exports === "object" && typeof module !== "undefined") {
8    module.exports = f();
9  } else if (typeof define === "function" && define.amd) {
10    define([], f);
11  } else {
12    var g;
13    if (typeof window !== "undefined") {
14      g = window;
15    } else if (typeof global !== "undefined") {
16      g = global;
17    } else if (typeof self !== "undefined") {
18      g = self;
19    } else {
20      g = this;
21    }
22    g.Lightgallery = f();
23  }
24})(function () {
25  var define, module, exports;
26  return (function () {
27    function r(e, n, t) {
28      function o(i, f) {
29        if (!n[i]) {
30          if (!e[i]) {
31            var c = "function" == typeof require && require;
32            if (!f && c) return c(i, !0);
33            if (u) return u(i, !0);
34            var a = new Error("Cannot find module '" + i + "'");
35            throw ((a.code = "MODULE_NOT_FOUND"), a);
36          }
37          var p = (n[i] = { exports: {} });
38          e[i][0].call(
39            p.exports,
40            function (r) {
41              var n = e[i][1][r];
42              return o(n || r);
43            },
44            p,
45            p.exports,
46            r,
47            e,
48            n,
49            t
50          );
51        }
52        return n[i].exports;
53      }
54      for (
55        var u = "function" == typeof require && require, i = 0;
56        i < t.length;
57        i++
58      )
59        o(t[i]);
60      return o;
61    }
62    return r;
63  })()(
64    {
65      1: [
66        function (require, module, exports) {
67          (function (global, factory) {
68            console.log("test");
69            if (typeof define === "function" && define.amd) {
70              define(["exports"], factory);
71            } else if (typeof exports !== "undefined") {
72              factory(exports);
73            } else {
74              var mod = {
75                exports: {},
76              };
77              factory(mod.exports);
78              global.lgUtils = mod.exports;
79            }
80          })(this, function (exports) {
81            "use strict";
82
83            Object.defineProperty(exports, "__esModule", {
84              value: true,
85            });
86
87            var utils = {
88              getAttribute: function getAttribute(el, label) {
89                return el[label];
90              },
91
92              setAttribute: function setAttribute(el, label, value) {
93                el[label] = value;
94              },
95              wrap: function wrap(el, className) {
96                if (!el) {
97                  return;
98                }
99
100                var wrapper = document.createElement("div");
101                wrapper.className = className;
102                el.parentNode.insertBefore(wrapper, el);
103                el.parentNode.removeChild(el);
104                wrapper.appendChild(el);
105              },
106
107              addClass: function addClass(el, className) {
108                if (!el) {
109                  return;
110                }
111
112                if (el.classList) {
113                  el.classList.add(className);
114                } else {
115                  el.className += " " + className;
116                }
117              },
118
119              removeClass: function removeClass(el, className) {
120                if (!el) {
121                  return;
122                }
123
124                if (el.classList) {
125                  el.classList.remove(className);
126                } else {
127                  el.className = el.className.replace(
128                    new RegExp(
129                      "(^|\\b)" + className.split(" ").join("|") + "(\\b|$)",
130                      "gi"
131                    ),
132                    " "
133                  );
134                }
135              },
136
137              hasClass: function hasClass(el, className) {
138                if (el.classList) {
139                  return el.classList.contains(className);
140                } else {
141                  return new RegExp("(^| )" + className + "( |$)", "gi").test(
142                    el.className
143                  );
144                }
145              },
146
147              // ex Transform
148              // ex TransitionTimingFunction
149              setVendor: function setVendor(el, property, value) {
150                if (!el) {
151                  return;
152                }
153
154                el.style[property.charAt(0).toLowerCase() + property.slice(1)] =
155                  value;
156                el.style["webkit" + property] = value;
157                el.style["moz" + property] = value;
158                el.style["ms" + property] = value;
159                el.style["o" + property] = value;
160              },
161
162              trigger: function trigger(el, event) {
163                var detail =
164                  arguments.length > 2 && arguments[2] !== undefined
165                    ? arguments[2]
166                    : null;
167
168                if (!el) {
169                  return;
170                }
171
172                var customEvent = new CustomEvent(event, {
173                  detail: detail,
174                });
175                el.dispatchEvent(customEvent);
176              },
177
178              Listener: {
179                uid: 0,
180              },
181              on: function on(el, events, fn) {
182                var _this = this;
183
184                if (!el) {
185                  return;
186                }
187
188                events.split(" ").forEach(function (event) {
189                  var _id = _this.getAttribute(el, "lg-event-uid") || "";
190                  utils.Listener.uid++;
191                  _id += "&" + utils.Listener.uid;
192                  _this.setAttribute(el, "lg-event-uid", _id);
193                  utils.Listener[event + utils.Listener.uid] = fn;
194                  el.addEventListener(event.split(".")[0], fn, false);
195                });
196              },
197
198              off: function off(el, event) {
199                if (!el) {
200                  return;
201                }
202
203                var _id = this.getAttribute(el, "lg-event-uid");
204                if (_id) {
205                  _id = _id.split("&");
206                  for (var i = 0; i < _id.length; i++) {
207                    if (_id[i]) {
208                      var _event = event + _id[i];
209                      if (_event.substring(0, 1) === ".") {
210                        for (var key in utils.Listener) {
211                          if (utils.Listener.hasOwnProperty(key)) {
212                            if (
213                              key.split(".").indexOf(_event.split(".")[1]) > -1
214                            ) {
215                              el.removeEventListener(
216                                key.split(".")[0],
217                                utils.Listener[key]
218                              );
219                              this.setAttribute(
220                                el,
221                                "lg-event-uid",
222                                this.getAttribute(el, "lg-event-uid").replace(
223                                  "&" + _id[i],
224                                  ""
225                                )
226                              );
227                              delete utils.Listener[key];
228                            }
229                          }
230                        }
231                      } else {
232                        el.removeEventListener(
233                          _event.split(".")[0],
234                          utils.Listener[_event]
235                        );
236                        this.setAttribute(
237                          el,
238                          "lg-event-uid",
239                          this.getAttribute(el, "lg-event-uid").replace(
240                            "&" + _id[i],
241                            ""
242                          )
243                        );
244                        delete utils.Listener[_event];
245                      }
246                    }
247                  }
248                }
249              },
250
251              param: function param(obj) {
252                return Object.keys(obj)
253                  .map(function (k) {
254                    return (
255                      encodeURIComponent(k) + "=" + encodeURIComponent(obj[k])
256                    );
257                  })
258                  .join("&");
259              },
260            };
261
262            exports.default = utils;
263          });
264        },
265        {},
266      ],
267      2: [
268        function (require, module, exports) {
269          (function (global, factory) {
270            if (typeof define === "function" && define.amd) {
271              define(["./lg-utils"], factory);
272            } else if (typeof exports !== "undefined") {
273              factory(require("./lg-utils"));
274            } else {
275              var mod = {
276                exports: {},
277              };
278              factory(global.lgUtils);
279              global.lightgallery = mod.exports;
280            }
281          })(this, function (_lgUtils) {
282            "use strict";
283
284            var _lgUtils2 = _interopRequireDefault(_lgUtils);
285
286            function _interopRequireDefault(obj) {
287              return obj && obj.__esModule
288                ? obj
289                : {
290                    default: obj,
291                  };
292            }
293
294            var _extends =
295              Object.assign ||
296              function (target) {
297                for (var i = 1; i < arguments.length; i++) {
298                  var source = arguments[i];
299
300                  for (var key in source) {
301                    if (Object.prototype.hasOwnProperty.call(source, key)) {
302                      target[key] = source[key];
303                    }
304                  }
305                }
306
307                return target;
308              };
309
310            /** Polyfill the CustomEvent() constructor functionality in Internet Explorer 9 and higher */
311            (function () {
312              if (typeof window.CustomEvent === "function") {
313                return false;
314              }
315
316              function CustomEvent(event, params) {
317                params = params || {
318                  bubbles: false,
319                  cancelable: false,
320                  detail: undefined,
321                };
322                var evt = document.createEvent("CustomEvent");
323                evt.initCustomEvent(
324                  event,
325                  params.bubbles,
326                  params.cancelable,
327                  params.detail
328                );
329                return evt;
330              }
331
332              CustomEvent.prototype = window.Event.prototype;
333
334              window.CustomEvent = CustomEvent;
335            })();
336
337            window.utils = _lgUtils2.default;
338            window.lgData = {
339              uid: 0,
340            };
341
342            window.lgModules = {};
343            var defaults = {
344              mode: "lg-slide",
345
346              // Ex : 'ease'
347              cssEasing: "ease",
348
349              //'for jquery animation'
350              easing: "linear",
351              speed: 600,
352              height: "100%",
353              width: "100%",
354              addClass: "",
355              startClass: "lg-start-zoom",
356              backdropDuration: 150,
357
358              // Set 0, if u don't want to hide the controls
359              hideBarsDelay: 6000,
360
361              useLeft: false,
362
363              // aria-labelledby attribute fot gallery
364              ariaLabelledby: "",
365
366              //aria-describedby attribute for gallery
367              ariaDescribedby: "",
368
369              closable: true,
370              loop: true,
371              escKey: true,
372              keyPress: true,
373              controls: true,
374              slideEndAnimatoin: true,
375              hideControlOnEnd: false,
376              mousewheel: false,
377
378              getCaptionFromTitleOrAlt: true,
379
380              // .lg-item || '.lg-sub-html'
381              appendSubHtmlTo: ".lg-sub-html",
382
383              subHtmlSelectorRelative: false,
384
385              /**
386               * @desc number of preload slides
387               * will exicute only after the current slide is fully loaded.
388               *
389               * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th
390               * slide will be loaded in the background after the 4th slide is fully loaded..
391               * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...
392               *
393               */
394              preload: 1,
395              showAfterLoad: true,
396              selector: "",
397              selectWithin: "",
398              nextHtml: "",
399              prevHtml: "",
400
401              // 0, 1
vendor: 60,282 bytes, lines 402-2051
402              index: false,
403
404              iframeMaxWidth: "100%",
405
406              download: true,
407              counter: true,
408              appendCounterTo: ".lg-toolbar",
409
410              swipeThreshold: 50,
411              enableSwipe: true,
412              enableDrag: true,
413
414              dynamic: false,
415              dynamicEl: [],
416              galleryId: 1,
417              supportLegacyBrowser: true,
418            };
419
420            function Plugin(element, options) {
421              // Current lightGallery element
422              this.el = element;
423
424              // lightGallery settings
425              this.s = _extends({}, defaults, options);
426
427              // When using dynamic mode, ensure dynamicEl is an array
428              if (
429                this.s.dynamic &&
430                this.s.dynamicEl !== "undefined" &&
431                this.s.dynamicEl.constructor === Array &&
432                !this.s.dynamicEl.length
433              ) {
434                throw "When using dynamic mode, you must also define dynamicEl as an Array.";
435              }
436
437              // lightGallery modules
438              this.modules = {};
439
440              // false when lightgallery complete first slide;
441              this.lGalleryOn = false;
442
443              this.lgBusy = false;
444
445              // Timeout function for hiding controls;
446              this.hideBartimeout = false;
447
448              // To determine browser supports for touch events;
449              this.isTouch = "ontouchstart" in document.documentElement;
450
451              // Disable hideControlOnEnd if sildeEndAnimation is true
452              if (this.s.slideEndAnimatoin) {
453                this.s.hideControlOnEnd = false;
454              }
455
456              this.items = [];
457
458              // Gallery items
459              if (this.s.dynamic) {
460                this.items = this.s.dynamicEl;
461              } else {
462                if (this.s.selector === "this") {
463                  this.items.push(this.el);
464                } else if (this.s.selector !== "") {
465                  if (this.s.selectWithin) {
466                    this.items = document
467                      .querySelector(this.s.selectWithin)
468                      .querySelectorAll(this.s.selector);
469                  } else {
470                    this.items = this.el.querySelectorAll(this.s.selector);
471                  }
472                } else {
473                  this.items = this.el.children;
474                }
475              }
476
477              // .lg-item
478
479              this.___slide = "";
480
481              // .lg-outer
482              this.outer = "";
483
484              this.init();
485
486              return this;
487            }
488
489            Plugin.prototype.init = function () {
490              var _this = this;
491
492              // s.preload should not be more than $item.length
493              if (_this.s.preload > _this.items.length) {
494                _this.s.preload = _this.items.length;
495              }
496
497              // if dynamic option is enabled execute immediately
498              var _hash = window.location.hash;
499              if (_hash.indexOf("lg=" + this.s.galleryId) > 0) {
500                _this.index = parseInt(_hash.split("&slide=")[1], 10);
501
502                _lgUtils2.default.addClass(document.body, "lg-from-hash");
503                if (!_lgUtils2.default.hasClass(document.body, "lg-on")) {
504                  _lgUtils2.default.addClass(document.body, "lg-on");
505                  setTimeout(function () {
506                    _this.build(_this.index);
507                  });
508                }
509              }
510
511              if (_this.s.dynamic) {
512                _lgUtils2.default.trigger(this.el, "onBeforeOpen");
513
514                _this.index = _this.s.index || 0;
515
516                // prevent accidental double execution
517                if (!_lgUtils2.default.hasClass(document.body, "lg-on")) {
518                  _lgUtils2.default.addClass(document.body, "lg-on");
519                  setTimeout(function () {
520                    _this.build(_this.index);
521                  });
522                }
523              } else {
524                for (var i = 0; i < _this.items.length; i++) {
525                  /*jshint loopfunc: true */
526                  (function (index) {
527                    // Using different namespace for click because click event should not unbind if selector is same object('this')
528                    _lgUtils2.default.on(
529                      _this.items[index],
530                      "click.lgcustom",
531                      function (e) {
532                        e.preventDefault();
533
534                        _lgUtils2.default.trigger(_this.el, "onBeforeOpen");
535
536                        _this.index = _this.s.index || index;
537
538                        if (
539                          !_lgUtils2.default.hasClass(document.body, "lg-on")
540                        ) {
541                          _this.build(_this.index);
542                          _lgUtils2.default.addClass(document.body, "lg-on");
543                        }
544                      }
545                    );
546                  })(i);
547                }
548              }
549            };
550
551            Plugin.prototype.build = function (index) {
552              var _this = this;
553
554              _this.structure();
555
556              for (var key in window.lgModules) {
557                _this.modules[key] = new window.lgModules[key](_this.el);
558              }
559
560              // initiate slide function
561              _this.slide(index, false, false);
562
563              if (_this.s.keyPress) {
564                _this.keyPress();
565              }
566
567              if (_this.items.length > 1) {
568                _this.arrow();
569
570                setTimeout(function () {
571                  _this.enableDrag();
572                  _this.enableSwipe();
573                }, 50);
574
575                if (_this.s.mousewheel) {
576                  _this.mousewheel();
577                }
578              }
579
580              _this.counter();
581
582              _this.closeGallery();
583
584              _lgUtils2.default.trigger(_this.el, "onAfterOpen");
585
586              // Hide controllers if mouse doesn't move for some period
587              if (_this.s.hideBarsDelay > 0) {
588                // Hide controls if user doesn't use mouse or touch after opening gallery
589                var initialHideBarTimeout = setTimeout(function () {
590                  _lgUtils2.default.addClass(_this.outer, "lg-hide-items");
591                }, _this.s.hideBarsDelay);
592                _lgUtils2.default.on(
593                  _this.outer,
594                  "mousemove.lg click.lg touchstart.lg",
595                  function () {
596                    // Cancel initalHideBarTimout if user uses mouse or touch events
597                    // Before it fires
598                    clearTimeout(initialHideBarTimeout);
599
600                    _lgUtils2.default.removeClass(_this.outer, "lg-hide-items");
601
602                    clearTimeout(_this.hideBartimeout);
603
604                    // Timeout will be cleared on each slide movement also
605                    _this.hideBartimeout = setTimeout(function () {
606                      _lgUtils2.default.addClass(_this.outer, "lg-hide-items");
607                    }, _this.s.hideBarsDelay);
608                  }
609                );
610              }
611            };
612
613            Plugin.prototype.structure = function () {
614              var list = "";
615              var controls = "";
616              var i = 0;
617              var subHtmlCont = "";
618              var template;
619              var _this = this;
620
621              document.body.insertAdjacentHTML(
622                "beforeend",
623                '<div class="lg-backdrop"></div>'
624              );
625              _lgUtils2.default.setVendor(
626                document.querySelector(".lg-backdrop"),
627                "TransitionDuration",
628                this.s.backdropDuration + "ms"
629              );
630
631              // Create gallery items
632              for (i = 0; i < this.items.length; i++) {
633                list += '<div class="lg-item"></div>';
634              }
635
636              // Create controlls
637              if (this.s.controls && this.items.length > 1) {
638                controls =
639                  '<div class="lg-actions">' +
640                  '<button type="button" aria-label="Previous slide" class="lg-prev lg-icon">' +
641                  this.s.prevHtml +
642                  "</button>" +
643                  '<button type="button" aria-label="Next slide" class="lg-next lg-icon">' +
644                  this.s.nextHtml +
645                  "</button>" +
646                  "</div>";
647              }
648
649              if (this.s.appendSubHtmlTo === ".lg-sub-html") {
650                subHtmlCont =
651                  '<div role="status" aria-live="polite" class="lg-sub-html"></div>';
652              }
653
654              var ariaLabelledby = this.s.ariaLabelledby
655                ? 'aria-labelledby="' + this.s.ariaLabelledby + '"'
656                : "";
657              var ariaDescribedby = this.s.ariaDescribedby
658                ? 'aria-describedby="' + this.s.ariaDescribedby + '"'
659                : "";
660
661              template =
662                '<div tabindex="-1" aria-modal="true" ' +
663                ariaLabelledby +
664                " " +
665                ariaDescribedby +
666                ' role="dialog" class="lg-outer ' +
667                this.s.addClass +
668                " " +
669                this.s.startClass +
670                '">' +
671                '<div class="lg" style="width:' +
672                this.s.width +
673                "; height:" +
674                this.s.height +
675                '">' +
676                '<div class="lg-inner">' +
677                list +
678                "</div>" +
679                '<div class="lg-toolbar lg-group">' +
680                '<button type="button" aria-label="Close gallery" class="lg-close lg-icon"></button>' +
681                "</div>" +
682                controls +
683                subHtmlCont +
684                "</div>" +
685                "</div>";
686
687              document.body.insertAdjacentHTML("beforeend", template);
688              this.outer = document.querySelector(".lg-outer");
689              this.outer.focus();
690              this.___slide = this.outer.querySelectorAll(".lg-item");
691
692              if (this.s.useLeft) {
693                _lgUtils2.default.addClass(this.outer, "lg-use-left");
694
695                // Set mode lg-slide if use left is true;
696                this.s.mode = "lg-slide";
697              } else {
698                _lgUtils2.default.addClass(this.outer, "lg-use-css3");
699              }
700
701              // For fixed height gallery
702              _this.setTop();
703              _lgUtils2.default.on(
704                window,
705                "resize.lg orientationchange.lg",
706                function () {
707                  setTimeout(function () {
708                    _this.setTop();
709                  }, 100);
710                }
711              );
712
713              // add class lg-current to remove initial transition
714              _lgUtils2.default.addClass(
715                this.___slide[this.index],
716                "lg-current"
717              );
718
719              // add Class for css support and transition mode
720              if (this.doCss()) {
721                _lgUtils2.default.addClass(this.outer, "lg-css3");
722              } else {
723                _lgUtils2.default.addClass(this.outer, "lg-css");
724
725                // Set speed 0 because no animation will happen if browser doesn't support css3
726                this.s.speed = 0;
727              }
728
729              _lgUtils2.default.addClass(this.outer, this.s.mode);
730
731              if (this.s.enableDrag && this.items.length > 1) {
732                _lgUtils2.default.addClass(this.outer, "lg-grab");
733              }
734
735              if (this.s.showAfterLoad) {
736                _lgUtils2.default.addClass(this.outer, "lg-show-after-load");
737              }
738
739              if (this.doCss()) {
740                var inner = this.outer.querySelector(".lg-inner");
741                _lgUtils2.default.setVendor(
742                  inner,
743                  "TransitionTimingFunction",
744                  this.s.cssEasing
745                );
746                _lgUtils2.default.setVendor(
747                  inner,
748                  "TransitionDuration",
749                  this.s.speed + "ms"
750                );
751              }
752
753              setTimeout(function () {
754                _lgUtils2.default.addClass(
755                  document.querySelector(".lg-backdrop"),
756                  "in"
757                );
758              });
759
760              setTimeout(function () {
761                _lgUtils2.default.addClass(_this.outer, "lg-visible");
762              }, this.s.backdropDuration);
763
764              if (this.s.download) {
765                this.outer
766                  .querySelector(".lg-toolbar")
767                  .insertAdjacentHTML(
768                    "beforeend",
769                    '<a id="lg-download" aria-label="Download" target="_blank" download class="lg-download lg-icon"></a>'
770                  );
771              }
772
773              // Store the current scroll top value to scroll back after closing the gallery..
774              this.prevScrollTop =
775                document.documentElement.scrollTop || document.body.scrollTop;
776            };
777
778            // For fixed height gallery
779            Plugin.prototype.setTop = function () {
780              if (this.s.height !== "100%") {
781                var wH = window.innerHeight;
782                var top = (wH - parseInt(this.s.height, 10)) / 2;
783                var lGallery = this.outer.querySelector(".lg");
784                if (wH >= parseInt(this.s.height, 10)) {
785                  lGallery.style.top = top + "px";
786                } else {
787                  lGallery.style.top = "0px";
788                }
789              }
790            };
791
792            // Find css3 support
793            Plugin.prototype.doCss = function () {
794              // check for css animation support
795              var support = function support() {
796                var transition = [
797                  "transition",
798                  "MozTransition",
799                  "WebkitTransition",
800                  "OTransition",
801                  "msTransition",
802                  "KhtmlTransition",
803                ];
804                var root = document.documentElement;
805                var i = 0;
806                for (i = 0; i < transition.length; i++) {
807                  if (transition[i] in root.style) {
808                    return true;
809                  }
810                }
811              };
812
813              if (support()) {
814                return true;
815              }
816
817              return false;
818            };
819
820            /**
821             *  @desc Check the given src is video
822             *  @param {String} src
823             *  @return {Object} video type
824             *  Ex:{ youtube  :  ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
825             */
826            Plugin.prototype.isVideo = function (src, index) {
827              var html;
828              if (this.s.dynamic) {
829                html = this.s.dynamicEl[index].html;
830              } else {
831                html = this.items[index].getAttribute("data-html");
832              }
833
834              if (!src && html) {
835                return {
836                  html5: true,
837                };
838              }
839
840              var youtube = src.match(
841                /\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i
842              );
843              var vimeo = src.match(
844                /\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)/i
845              );
846              var dailymotion = src.match(
847                /\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i
848              );
849              var vk = src.match(
850                /\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i
851              );
852
853              if (youtube) {
854                return {
855                  youtube: youtube,
856                };
857              } else if (vimeo) {
858                return {
859                  vimeo: vimeo,
860                };
861              } else if (dailymotion) {
862                return {
863                  dailymotion: dailymotion,
864                };
865              } else if (vk) {
866                return {
867                  vk: vk,
868                };
869              }
870            };
871
872            /**
873             *  @desc Create image counter
874             *  Ex: 1/10
875             */
876            Plugin.prototype.counter = function () {
877              if (this.s.counter) {
878                this.outer
879                  .querySelector(this.s.appendCounterTo)
880                  .insertAdjacentHTML(
881                    "beforeend",
882                    '<div id="lg-counter" role="status" aria-live="polite"><span id="lg-counter-current">' +
883                      (parseInt(this.index, 10) + 1) +
884                      '</span> / <span id="lg-counter-all">' +
885                      this.items.length +
886                      "</span></div>"
887                  );
888              }
889            };
890
891            /**
892             *  @desc add sub-html into the slide
893             *  @param {Number} index - index of the slide
894             */
895            Plugin.prototype.addHtml = function (index) {
896              var subHtml = null;
897              var currentEle;
898              if (this.s.dynamic) {
899                subHtml = this.s.dynamicEl[index].subHtml;
900              } else {
901                currentEle = this.items[index];
902                subHtml = currentEle.getAttribute("data-sub-html");
903                if (this.s.getCaptionFromTitleOrAlt && !subHtml) {
904                  subHtml = currentEle.getAttribute("title");
905                  if (subHtml && currentEle.querySelector("img")) {
906                    subHtml = currentEle
907                      .querySelector("img")
908                      .getAttribute("alt");
909                  }
910                }
911              }
912
913              if (typeof subHtml !== "undefined" && subHtml !== null) {
914                // get first letter of subhtml
915                // if first letter starts with . or # get the html form the jQuery object
916                var fL = subHtml.substring(0, 1);
917                if (fL === "." || fL === "#") {
918                  if (this.s.subHtmlSelectorRelative && !this.s.dynamic) {
919                    subHtml = currentEle.querySelector(subHtml).innerHTML;
920                  } else {
921                    subHtml = document.querySelector(subHtml).innerHTML;
922                  }
923                }
924              } else {
925                subHtml = "";
926              }
927
928              if (this.s.appendSubHtmlTo === ".lg-sub-html") {
929                this.outer.querySelector(this.s.appendSubHtmlTo).innerHTML =
930                  subHtml;
931              } else {
932                this.___slide[index].insertAdjacentHTML("beforeend", subHtml);
933              }
934
935              // Add lg-empty-html class if title doesn't exist
936              if (typeof subHtml !== "undefined" && subHtml !== null) {
937                if (subHtml === "") {
938                  _lgUtils2.default.addClass(
939                    this.outer.querySelector(this.s.appendSubHtmlTo),
940                    "lg-empty-html"
941                  );
942                } else {
943                  _lgUtils2.default.removeClass(
944                    this.outer.querySelector(this.s.appendSubHtmlTo),
945                    "lg-empty-html"
946                  );
947                }
948              }
949
950              _lgUtils2.default.trigger(this.el, "onAfterAppendSubHtml", {
951                index: index,
952              });
953            };
954
955            /**
956             *  @desc Preload slides
957             *  @param {Number} index - index of the slide
958             */
959            Plugin.prototype.preload = function (index) {
960              var i = 1;
961              var j = 1;
962              for (i = 1; i <= this.s.preload; i++) {
963                if (i >= this.items.length - index) {
964                  break;
965                }
966
967                this.loadContent(index + i, false, 0);
968              }
969
970              for (j = 1; j <= this.s.preload; j++) {
971                if (index - j < 0) {
972                  break;
973                }
974
975                this.loadContent(index - j, false, 0);
976              }
977            };
978
979            /**
980             *  @desc Load slide content into slide.
981             *  @param {Number} index - index of the slide.
982             *  @param {Boolean} rec - if true call loadcontent() function again.
983             *  @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
984             */
985            Plugin.prototype.loadContent = function (index, rec, delay) {
986              var _this = this;
987              var _hasPoster = false;
988              var _img;
989              var _src;
990              var _poster;
991              var _srcset;
992              var _sizes;
993              var _html;
994              var _alt;
995              var getResponsiveSrc = function getResponsiveSrc(srcItms) {
996                var rsWidth = [];
997                var rsSrc = [];
998                for (var i = 0; i < srcItms.length; i++) {
999                  var __src = srcItms[i].split(" ");
1000
1001                  // Manage empty space
1002                  if (__src[0] === "") {
1003                    __src.splice(0, 1);
1004                  }
1005
1006                  rsSrc.push(__src[0]);
1007                  rsWidth.push(__src[1]);
1008                }
1009
1010                var wWidth = window.innerWidth;
1011                for (var j = 0; j < rsWidth.length; j++) {
1012                  if (parseInt(rsWidth[j], 10) > wWidth) {
1013                    _src = rsSrc[j];
1014                    break;
1015                  }
1016                }
1017              };
1018
1019              if (_this.s.dynamic) {
1020                if (_this.s.dynamicEl[index].poster) {
1021                  _hasPoster = true;
1022                  _poster = _this.s.dynamicEl[index].poster;
1023                }
1024
1025                _html = _this.s.dynamicEl[index].html;
1026                _src = _this.s.dynamicEl[index].src;
1027                _alt = _this.s.dynamicEl[index].alt;
1028
1029                if (_this.s.dynamicEl[index].responsive) {
1030                  var srcDyItms =
1031                    _this.s.dynamicEl[index].responsive.split(",");
1032                  getResponsiveSrc(srcDyItms);
1033                }
1034
1035                _srcset = _this.s.dynamicEl[index].srcset;
1036                _sizes = _this.s.dynamicEl[index].sizes;
1037              } else {
1038                if (_this.items[index].getAttribute("data-poster")) {
1039                  _hasPoster = true;
1040                  _poster = _this.items[index].getAttribute("data-poster");
1041                }
1042
1043                _html = _this.items[index].getAttribute("data-html");
1044                _src =
1045                  _this.items[index].getAttribute("href") ||
1046                  _this.items[index].getAttribute("data-src");
1047                _alt = _this.items[index].getAttribute("title");
1048
1049                if (_this.items[index].querySelector("img")) {
1050                  _alt =
1051                    _alt ||
1052                    _this.items[index].querySelector("img").getAttribute("alt");
1053                }
1054
1055                if (_this.items[index].getAttribute("data-responsive")) {
1056                  var srcItms = _this.items[index]
1057                    .getAttribute("data-responsive")
1058                    .split(",");
1059                  getResponsiveSrc(srcItms);
1060                }
1061
1062                _srcset = _this.items[index].getAttribute("data-srcset");
1063                _sizes = _this.items[index].getAttribute("data-sizes");
1064              }
1065
1066              //if (_src || _srcset || _sizes || _poster) {
1067
1068              var iframe = false;
1069              if (_this.s.dynamic) {
1070                if (_this.s.dynamicEl[index].iframe) {
1071                  iframe = true;
1072                }
1073              } else {
1074                if (_this.items[index].getAttribute("data-iframe") === "true") {
1075                  iframe = true;
1076                }
1077              }
1078
1079              var _isVideo = _this.isVideo(_src, index);
1080              if (
1081                !_lgUtils2.default.hasClass(_this.___slide[index], "lg-loaded")
1082              ) {
1083                if (iframe) {
1084                  _this.___slide[index].insertAdjacentHTML(
1085                    "afterbegin",
1086                    '<div class="lg-video-cont" style="max-width:' +
1087                      _this.s.iframeMaxWidth +
1088                      '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' +
1089                      _src +
1090                      '"  allowfullscreen="true"></iframe></div></div>'
1091                  );
1092                } else if (_hasPoster) {
1093                  var videoClass = "";
1094                  if (_isVideo && _isVideo.youtube) {
1095                    videoClass = "lg-has-youtube";
1096                  } else if (_isVideo && _isVideo.vimeo) {
1097                    videoClass = "lg-has-vimeo";
1098                  } else {
1099                    videoClass = "lg-has-html5";
1100                  }
1101
1102                  _this.___slide[index].insertAdjacentHTML(
1103                    "beforeend",
1104                    '<div class="lg-video-cont ' +
1105                      videoClass +
1106                      ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' +
1107                      _poster +
1108                      '" /></div></div>'
1109                  );
1110                } else if (_isVideo) {
1111                  _this.___slide[index].insertAdjacentHTML(
1112                    "beforeend",
1113                    '<div class="lg-video-cont "><div class="lg-video"></div></div>'
1114                  );
1115                  _lgUtils2.default.trigger(_this.el, "hasVideo", {
1116                    index: index,
1117                    src: _src,
1118                    html: _html,
1119                  });
1120                } else {
1121                  _alt = _alt ? 'alt="' + _alt + '"' : "";
1122                  _this.___slide[index].insertAdjacentHTML(
1123                    "beforeend",
1124                    '<div class="lg-img-wrap"><img class="lg-object lg-image" ' +
1125                      _alt +
1126                      ' src="' +
1127                      _src +
1128                      '" /></div>'
1129                  );
1130                }
1131
1132                _lgUtils2.default.trigger(_this.el, "onAferAppendSlide", {
1133                  index: index,
1134                });
1135
1136                _img = _this.___slide[index].querySelector(".lg-object");
1137                if (_sizes) {
1138                  _img.setAttribute("sizes", _sizes);
1139                }
1140
1141                if (_srcset) {
1142                  _img.setAttribute("srcset", _srcset);
1143
1144                  if (this.s.supportLegacyBrowser) {
1145                    try {
1146                      picturefill({
1147                        elements: [_img[0]],
1148                      });
1149                    } catch (e) {
1150                      console.warn(
1151                        "If you want srcset to be supported for older browsers, " +
1152                          "please include picturefil javascript library in your document."
1153                      );
1154                    }
1155                  }
1156                }
1157
1158                if (this.s.appendSubHtmlTo !== ".lg-sub-html") {
1159                  _this.addHtml(index);
1160                }
1161
1162                _lgUtils2.default.addClass(_this.___slide[index], "lg-loaded");
1163              }
1164
1165              _lgUtils2.default.on(
1166                _this.___slide[index].querySelector(".lg-object"),
1167                "load.lg error.lg",
1168                function () {
1169                  // For first time add some delay for displaying the start animation.
1170                  var _speed = 0;
1171
1172                  // Do not change the delay value because it is required for zoom plugin.
1173                  // If gallery opened from direct url (hash) speed value should be 0
1174                  if (
1175                    delay &&
1176                    !_lgUtils2.default.hasClass(document.body, "lg-from-hash")
1177                  ) {
1178                    _speed = delay;
1179                  }
1180
1181                  setTimeout(function () {
1182                    _lgUtils2.default.addClass(
1183                      _this.___slide[index],
1184                      "lg-complete"
1185                    );
1186
1187                    _lgUtils2.default.trigger(_this.el, "onSlideItemLoad", {
1188                      index: index,
1189                      delay: delay || 0,
1190                    });
1191                  }, _speed);
1192                }
1193              );
1194
1195              // @todo check load state for html5 videos
1196              if (_isVideo && _isVideo.html5 && !_hasPoster) {
1197                _lgUtils2.default.addClass(
1198                  _this.___slide[index],
1199                  "lg-complete"
1200                );
1201              }
1202
1203              if (rec === true) {
1204                if (
1205                  !_lgUtils2.default.hasClass(
1206                    _this.___slide[index],
1207                    "lg-complete"
1208                  )
1209                ) {
1210                  _lgUtils2.default.on(
1211                    _this.___slide[index].querySelector(".lg-object"),
1212                    "load.lg error.lg",
1213                    function () {
1214                      _this.preload(index);
1215                    }
1216                  );
1217                } else {
1218                  _this.preload(index);
1219                }
1220              }
1221
1222              //}
1223            };
1224
1225            /**
1226    *   @desc slide function for lightgallery
1227        ** Slide() gets call on start
1228        ** ** Set lg.on true once slide() function gets called.
1229        ** Call loadContent() on slide() function inside setTimeout
1230        ** ** On first slide we do not want any animation like slide of fade
1231        ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately
1232        ** ** Else loadContent() should wait for the transition to complete.
1233        ** ** So set timeout s.speed + 50
1234    <=> ** loadContent() will load slide content in to the particular slide
1235        ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function.
1236        ** ** preload will execute only when the previous slide is fully loaded (images iframe)
1237        ** ** avoid simultaneous image load
1238    <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value
1239        ** loadContent()  <====> Preload();
1240    
1241    *   @param {Number} index - index of the slide
1242    *   @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
1243    *   @param {Boolean} fromThumb - true if slide function called via thumbnail click
1244    */
1245            Plugin.prototype.slide = function (index, fromTouch, fromThumb) {
1246              var _prevIndex = 0;
1247              for (var i = 0; i < this.___slide.length; i++) {
1248                if (
1249                  _lgUtils2.default.hasClass(this.___slide[i], "lg-current")
1250                ) {
1251                  _prevIndex = i;
1252                  break;
1253                }
1254              }
1255
1256              var _this = this;
1257
1258              // Prevent if multiple call
1259              // Required for hsh plugin
1260              if (_this.lGalleryOn && _prevIndex === index) {
1261                return;
1262              }
1263
1264              var _length = this.___slide.length;
1265              var _time = _this.lGalleryOn ? this.s.speed : 0;
1266              var _next = false;
1267              var _prev = false;
1268
1269              if (!_this.lgBusy) {
1270                if (this.s.download) {
1271                  var _src;
1272                  if (_this.s.dynamic) {
1273                    _src =
1274                      _this.s.dynamicEl[index].downloadUrl !== false &&
1275                      (_this.s.dynamicEl[index].downloadUrl ||
1276                        _this.s.dynamicEl[index].src);
1277                  } else {
1278                    _src =
1279                      _this.items[index].getAttribute("data-download-url") !==
1280                        "false" &&
1281                      (_this.items[index].getAttribute("data-download-url") ||
1282                        _this.items[index].getAttribute("href") ||
1283                        _this.items[index].getAttribute("data-src"));
1284                  }
1285
1286                  if (_src) {
1287                    document
1288                      .getElementById("lg-download")
1289                      .setAttribute("href", _src);
1290                    _lgUtils2.default.removeClass(
1291                      _this.outer,
1292                      "lg-hide-download"
1293                    );
1294                  } else {
1295                    _lgUtils2.default.addClass(_this.outer, "lg-hide-download");
1296                  }
1297                }
1298
1299                _lgUtils2.default.trigger(_this.el, "onBeforeSlide", {
1300                  prevIndex: _prevIndex,
1301                  index: index,
1302                  fromTouch: fromTouch,
1303                  fromThumb: fromThumb,
1304                });
1305
1306                _this.lgBusy = true;
1307
1308                clearTimeout(_this.hideBartimeout);
1309
1310                // Add title if this.s.appendSubHtmlTo === lg-sub-html
1311                if (this.s.appendSubHtmlTo === ".lg-sub-html") {
1312                  // wait for slide animation to complete
1313                  setTimeout(function () {
1314                    _this.addHtml(index);
1315                  }, _time);
1316                }
1317
1318                this.arrowDisable(index);
1319
1320                if (!fromTouch) {
1321                  // remove all transitions
1322                  _lgUtils2.default.addClass(_this.outer, "lg-no-trans");
1323
1324                  for (var j = 0; j < this.___slide.length; j++) {
1325                    _lgUtils2.default.removeClass(
1326                      this.___slide[j],
1327                      "lg-prev-slide"
1328                    );
1329                    _lgUtils2.default.removeClass(
1330                      this.___slide[j],
1331                      "lg-next-slide"
1332                    );
1333                  }
1334
1335                  if (index < _prevIndex) {
1336                    _prev = true;
1337                    if (
1338                      index === 0 &&
1339                      _prevIndex === _length - 1 &&
1340                      !fromThumb
1341                    ) {
1342                      _prev = false;
1343                      _next = true;
1344                    }
1345                  } else if (index > _prevIndex) {
1346                    _next = true;
1347                    if (
1348                      index === _length - 1 &&
1349                      _prevIndex === 0 &&
1350                      !fromThumb
1351                    ) {
1352                      _prev = true;
1353                      _next = false;
1354                    }
1355                  }
1356
1357                  if (_prev) {
1358                    //prevslide
1359                    _lgUtils2.default.addClass(
1360                      this.___slide[index],
1361                      "lg-prev-slide"
1362                    );
1363                    _lgUtils2.default.addClass(
1364                      this.___slide[_prevIndex],
1365                      "lg-next-slide"
1366                    );
1367                  } else if (_next) {
1368                    // next slide
1369                    _lgUtils2.default.addClass(
1370                      this.___slide[index],
1371                      "lg-next-slide"
1372                    );
1373                    _lgUtils2.default.addClass(
1374                      this.___slide[_prevIndex],
1375                      "lg-prev-slide"
1376                    );
1377                  }
1378
1379                  // give 50 ms for browser to add/remove class
1380                  setTimeout(function () {
1381                    _lgUtils2.default.removeClass(
1382                      _this.outer.querySelector(".lg-current"),
1383                      "lg-current"
1384                    );
1385
1386                    //_this.$slide.eq(_prevIndex).removeClass('lg-current');
1387                    _lgUtils2.default.addClass(
1388                      _this.___slide[index],
1389                      "lg-current"
1390                    );
1391
1392                    // reset all transitions
1393                    _lgUtils2.default.removeClass(_this.outer, "lg-no-trans");
1394                  }, 50);
1395                } else {
1396                  var touchPrev = index - 1;
1397                  var touchNext = index + 1;
1398
1399                  if (index === 0 && _prevIndex === _length - 1) {
1400                    // next slide
1401                    touchNext = 0;
1402                    touchPrev = _length - 1;
1403                  } else if (index === _length - 1 && _prevIndex === 0) {
1404                    // prev slide
1405                    touchNext = 0;
1406                    touchPrev = _length - 1;
1407                  }
1408
1409                  _lgUtils2.default.removeClass(
1410                    _this.outer.querySelector(".lg-prev-slide"),
1411                    "lg-prev-slide"
1412                  );
1413                  _lgUtils2.default.removeClass(
1414                    _this.outer.querySelector(".lg-current"),
1415                    "lg-current"
1416                  );
1417                  _lgUtils2.default.removeClass(
1418                    _this.outer.querySelector(".lg-next-slide"),
1419                    "lg-next-slide"
1420                  );
1421                  _lgUtils2.default.addClass(
1422                    _this.___slide[touchPrev],
1423                    "lg-prev-slide"
1424                  );
1425                  _lgUtils2.default.addClass(
1426                    _this.___slide[touchNext],
1427                    "lg-next-slide"
1428                  );
1429                  _lgUtils2.default.addClass(
1430                    _this.___slide[index],
1431                    "lg-current"
1432                  );
1433                }
1434
1435                if (_this.lGalleryOn) {
1436                  setTimeout(function () {
1437                    _this.loadContent(index, true, 0);
1438                  }, this.s.speed + 50);
1439
1440                  setTimeout(function () {
1441                    _this.lgBusy = false;
1442                    _lgUtils2.default.trigger(_this.el, "onAfterSlide", {
1443                      prevIndex: _prevIndex,
1444                      index: index,
1445                      fromTouch: fromTouch,
1446                      fromThumb: fromThumb,
1447                    });
1448                  }, this.s.speed);
1449                } else {
1450                  _this.loadContent(index, true, _this.s.backdropDuration);
1451
1452                  _this.lgBusy = false;
1453                  _lgUtils2.default.trigger(_this.el, "onAfterSlide", {
1454                    prevIndex: _prevIndex,
1455                    index: index,
1456                    fromTouch: fromTouch,
1457                    fromThumb: fromThumb,
1458                  });
1459                }
1460
1461                _this.lGalleryOn = true;
1462
1463                if (this.s.counter) {
1464                  if (document.getElementById("lg-counter-current")) {
1465                    document.getElementById("lg-counter-current").innerHTML =
1466                      index + 1;
1467                  }
1468                }
1469              }
1470            };
1471
1472            /**
1473             *  @desc Go to next slide
1474             *  @param {Boolean} fromTouch - true if slide function called via touch event
1475             */
1476            Plugin.prototype.goToNextSlide = function (fromTouch) {
1477              var _this = this;
1478              if (!_this.lgBusy) {
1479                if (_this.index + 1 < _this.___slide.length) {
1480                  _this.index++;
1481                  _lgUtils2.default.trigger(_this.el, "onBeforeNextSlide", {
1482                    index: _this.index,
1483                  });
1484                  _this.slide(_this.index, fromTouch, false);
1485                } else {
1486                  if (_this.s.loop) {
1487                    _this.index = 0;
1488                    _lgUtils2.default.trigger(_this.el, "onBeforeNextSlide", {
1489                      index: _this.index,
1490                    });
1491                    _this.slide(_this.index, fromTouch, false);
1492                  } else if (_this.s.slideEndAnimatoin) {
1493                    _lgUtils2.default.addClass(_this.outer, "lg-right-end");
1494                    setTimeout(function () {
1495                      _lgUtils2.default.removeClass(
1496                        _this.outer,
1497                        "lg-right-end"
1498                      );
1499                    }, 400);
1500                  }
1501                }
1502              }
1503            };
1504
1505            /**
1506             *  @desc Go to previous slide
1507             *  @param {Boolean} fromTouch - true if slide function called via touch event
1508             */
1509            Plugin.prototype.goToPrevSlide = function (fromTouch) {
1510              var _this = this;
1511              if (!_this.lgBusy) {
1512                if (_this.index > 0) {
1513                  _this.index--;
1514                  _lgUtils2.default.trigger(_this.el, "onBeforePrevSlide", {
1515                    index: _this.index,
1516                    fromTouch: fromTouch,
1517                  });
1518                  _this.slide(_this.index, fromTouch, false);
1519                } else {
1520                  if (_this.s.loop) {
1521                    _this.index = _this.items.length - 1;
1522                    _lgUtils2.default.trigger(_this.el, "onBeforePrevSlide", {
1523                      index: _this.index,
1524                      fromTouch: fromTouch,
1525                    });
1526                    _this.slide(_this.index, fromTouch, false);
1527                  } else if (_this.s.slideEndAnimatoin) {
1528                    _lgUtils2.default.addClass(_this.outer, "lg-left-end");
1529                    setTimeout(function () {
1530                      _lgUtils2.default.removeClass(_this.outer, "lg-left-end");
1531                    }, 400);
1532                  }
1533                }
1534              }
1535            };
1536
1537            Plugin.prototype.keyPress = function () {
1538              var _this = this;
1539              if (this.items.length > 1) {
1540                _lgUtils2.default.on(window, "keyup.lg", function (e) {
1541                  if (_this.items.length > 1) {
1542                    if (e.keyCode === 37) {
1543                      e.preventDefault();
1544                      _this.goToPrevSlide();
1545                    }
1546
1547                    if (e.keyCode === 39) {
1548                      e.preventDefault();
1549                      _this.goToNextSlide();
1550                    }
1551                  }
1552                });
1553              }
1554
1555              _lgUtils2.default.on(window, "keydown.lg", function (e) {
1556                if (_this.s.escKey === true && e.keyCode === 27) {
1557                  e.preventDefault();
1558                  if (
1559                    !_lgUtils2.default.hasClass(_this.outer, "lg-thumb-open")
1560                  ) {
1561                    _this.destroy();
1562                  } else {
1563                    _lgUtils2.default.removeClass(_this.outer, "lg-thumb-open");
1564                  }
1565                }
1566              });
1567            };
1568
1569            Plugin.prototype.arrow = function () {
1570              var _this = this;
1571              _lgUtils2.default.on(
1572                this.outer.querySelector(".lg-prev"),
1573                "click.lg",
1574                function () {
1575                  _this.goToPrevSlide();
1576                }
1577              );
1578
1579              _lgUtils2.default.on(
1580                this.outer.querySelector(".lg-next"),
1581                "click.lg",
1582                function () {
1583                  _this.goToNextSlide();
1584                }
1585              );
1586            };
1587
1588            Plugin.prototype.arrowDisable = function (index) {
1589              // Disable arrows if s.hideControlOnEnd is true
1590              if (!this.s.loop && this.s.hideControlOnEnd) {
1591                var next = this.outer.querySelector(".lg-next");
1592                var prev = this.outer.querySelector(".lg-prev");
1593                if (index + 1 < this.___slide.length) {
1594                  next.removeAttribute("disabled");
1595                  _lgUtils2.default.removeClass(next, "disabled");
1596                } else {
1597                  next.setAttribute("disabled", "disabled");
1598                  _lgUtils2.default.addClass(next, "disabled");
1599                }
1600
1601                if (index > 0) {
1602                  prev.removeAttribute("disabled");
1603                  _lgUtils2.default.removeClass(prev, "disabled");
1604                } else {
1605                  prev.setAttribute("disabled", "disabled");
1606                  _lgUtils2.default.addClass(prev, "disabled");
1607                }
1608              }
1609            };
1610
1611            Plugin.prototype.setTranslate = function (el, xValue, yValue) {
1612              // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
1613              if (this.s.useLeft) {
1614                el.style.left = xValue;
1615              } else {
1616                _lgUtils2.default.setVendor(
1617                  el,
1618                  "Transform",
1619                  "translate3d(" + xValue + "px, " + yValue + "px, 0px)"
1620                );
1621              }
1622            };
1623
1624            Plugin.prototype.touchMove = function (startCoords, endCoords) {
1625              var distance = endCoords - startCoords;
1626
1627              if (Math.abs(distance) > 15) {
1628                // reset opacity and transition duration
1629                _lgUtils2.default.addClass(this.outer, "lg-dragging");
1630
1631                // move current slide
1632                this.setTranslate(this.___slide[this.index], distance, 0);
1633
1634                // move next and prev slide with current slide
1635                this.setTranslate(
1636                  document.querySelector(".lg-prev-slide"),
1637                  -this.___slide[this.index].clientWidth + distance,
1638                  0
1639                );
1640                this.setTranslate(
1641                  document.querySelector(".lg-next-slide"),
1642                  this.___slide[this.index].clientWidth + distance,
1643                  0
1644                );
1645              }
1646            };
1647
1648            Plugin.prototype.touchEnd = function (distance) {
1649              var _this = this;
1650
1651              // keep slide animation for any mode while dragg/swipe
1652              if (_this.s.mode !== "lg-slide") {
1653                _lgUtils2.default.addClass(_this.outer, "lg-slide");
1654              }
1655
1656              for (var i = 0; i < this.___slide.length; i++) {
1657                if (
1658                  !_lgUtils2.default.hasClass(this.___slide[i], "lg-current") &&
1659                  !_lgUtils2.default.hasClass(
1660                    this.___slide[i],
1661                    "lg-prev-slide"
1662                  ) &&
1663                  !_lgUtils2.default.hasClass(this.___slide[i], "lg-next-slide")
1664                ) {
1665                  this.___slide[i].style.opacity = "0";
1666                }
1667              }
1668
1669              // set transition duration
1670              setTimeout(function () {
1671                _lgUtils2.default.removeClass(_this.outer, "lg-dragging");
1672                if (
1673                  distance < 0 &&
1674                  Math.abs(distance) > _this.s.swipeThreshold
1675                ) {
1676                  _this.goToNextSlide(true);
1677                } else if (
1678                  distance > 0 &&
1679                  Math.abs(distance) > _this.s.swipeThreshold
1680                ) {
1681                  _this.goToPrevSlide(true);
1682                } else if (Math.abs(distance) < 5) {
1683                  // Trigger click if distance is less than 5 pix
1684                  _lgUtils2.default.trigger(_this.el, "onSlideClick");
1685                }
1686
1687                for (var i = 0; i < _this.___slide.length; i++) {
1688                  _this.___slide[i].removeAttribute("style");
1689                }
1690              });
1691
1692              // remove slide class once drag/swipe is completed if mode is not slide
1693              setTimeout(function () {
1694                if (
1695                  !_lgUtils2.default.hasClass(_this.outer, "lg-dragging") &&
1696                  _this.s.mode !== "lg-slide"
1697                ) {
1698                  _lgUtils2.default.removeClass(_this.outer, "lg-slide");
1699                }
1700              }, _this.s.speed + 100);
1701            };
1702
1703            Plugin.prototype.enableSwipe = function () {
1704              var _this = this;
1705              var startCoords = 0;
1706              var endCoords = 0;
1707              var isMoved = false;
1708
1709              if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) {
1710                for (var i = 0; i < _this.___slide.length; i++) {
1711                  /*jshint loopfunc: true */
1712                  _lgUtils2.default.on(
1713                    _this.___slide[i],
1714                    "touchstart.lg",
1715                    function (e) {
1716                      if (
1717                        !_lgUtils2.default.hasClass(_this.outer, "lg-zoomed") &&
1718                        !_this.lgBusy
1719                      ) {
1720                        e.preventDefault();
1721                        _this.manageSwipeClass();
1722                        startCoords = e.targetTouches[0].pageX;
1723                      }
1724                    }
1725                  );
1726                }
1727
1728                for (var j = 0; j < _this.___slide.length; j++) {
1729                  /*jshint loopfunc: true */
1730                  _lgUtils2.default.on(
1731                    _this.___slide[j],
1732                    "touchmove.lg",
1733                    function (e) {
1734                      if (
1735                        !_lgUtils2.default.hasClass(_this.outer, "lg-zoomed")
1736                      ) {
1737                        e.preventDefault();
1738                        endCoords = e.targetTouches[0].pageX;
1739                        _this.touchMove(startCoords, endCoords);
1740                        isMoved = true;
1741                      }
1742                    }
1743                  );
1744                }
1745
1746                for (var k = 0; k < _this.___slide.length; k++) {
1747                  /*jshint loopfunc: true */
1748                  _lgUtils2.default.on(
1749                    _this.___slide[k],
1750                    "touchend.lg",
1751                    function () {
1752                      if (
1753                        !_lgUtils2.default.hasClass(_this.outer, "lg-zoomed")
1754                      ) {
1755                        if (isMoved) {
1756                          isMoved = false;
1757                          _this.touchEnd(endCoords - startCoords);
1758                        } else {
1759                          _lgUtils2.default.trigger(_this.el, "onSlideClick");
1760                        }
1761                      }
1762                    }
1763                  );
1764                }
1765              }
1766            };
1767
1768            Plugin.prototype.enableDrag = function () {
1769              var _this = this;
1770              var startCoords = 0;
1771              var endCoords = 0;
1772              var isDraging = false;
1773              var isMoved = false;
1774              if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) {
1775                for (var i = 0; i < _this.___slide.length; i++) {
1776                  /*jshint loopfunc: true */
1777                  _lgUtils2.default.on(
1778                    _this.___slide[i],
1779                    "mousedown.lg",
1780                    function (e) {
1781                      // execute only on .lg-object
1782                      if (
1783                        !_lgUtils2.default.hasClass(_this.outer, "lg-zoomed")
1784                      ) {
1785                        if (
1786                          _lgUtils2.default.hasClass(e.target, "lg-object") ||
1787                          _lgUtils2.default.hasClass(e.target, "lg-video-play")
1788                        ) {
1789                          e.preventDefault();
1790
1791                          if (!_this.lgBusy) {
1792                            _this.manageSwipeClass();
1793                            startCoords = e.pageX;
1794                            isDraging = true;
1795
1796                            // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
1797                            _this.outer.scrollLeft += 1;
1798                            _this.outer.scrollLeft -= 1;
1799
1800                            // *
1801
1802                            _lgUtils2.default.removeClass(
1803                              _this.outer,
1804                              "lg-grab"
1805                            );
1806                            _lgUtils2.default.addClass(
1807                              _this.outer,
1808                              "lg-grabbing"
1809                            );
1810
1811                            _lgUtils2.default.trigger(_this.el, "onDragstart");
1812                          }
1813                        }
1814                      }
1815                    }
1816                  );
1817                }
1818
1819                _lgUtils2.default.on(window, "mousemove.lg", function (e) {
1820                  if (isDraging) {
1821                    isMoved = true;
1822                    endCoords = e.pageX;
1823                    _this.touchMove(startCoords, endCoords);
1824                    _lgUtils2.default.trigger(_this.el, "onDragmove");
1825                  }
1826                });
1827
1828                _lgUtils2.default.on(window, "mouseup.lg", function (e) {
1829                  if (isMoved) {
1830                    isMoved = false;
1831                    _this.touchEnd(endCoords - startCoords);
1832                    _lgUtils2.default.trigger(_this.el, "onDragend");
1833                  } else if (
1834                    _lgUtils2.default.hasClass(e.target, "lg-object") ||
1835                    _lgUtils2.default.hasClass(e.target, "lg-video-play")
1836                  ) {
1837                    _lgUtils2.default.trigger(_this.el, "onSlideClick");
1838                  }
1839
1840                  // Prevent execution on click
1841                  if (isDraging) {
1842                    isDraging = false;
1843                    _lgUtils2.default.removeClass(_this.outer, "lg-grabbing");
1844                    _lgUtils2.default.addClass(_this.outer, "lg-grab");
1845                  }
1846                });
1847              }
1848            };
1849
1850            Plugin.prototype.manageSwipeClass = function () {
1851              var touchNext = this.index + 1;
1852              var touchPrev = this.index - 1;
1853              var length = this.___slide.length;
1854              if (this.s.loop) {
1855                if (this.index === 0) {
1856                  touchPrev = length - 1;
1857                } else if (this.index === length - 1) {
1858                  touchNext = 0;
1859                }
1860              }
1861
1862              for (var i = 0; i < this.___slide.length; i++) {
1863                _lgUtils2.default.removeClass(
1864                  this.___slide[i],
1865                  "lg-next-slide"
1866                );
1867                _lgUtils2.default.removeClass(
1868                  this.___slide[i],
1869                  "lg-prev-slide"
1870                );
1871              }
1872
1873              if (touchPrev > -1) {
1874                _lgUtils2.default.addClass(
1875                  this.___slide[touchPrev],
1876                  "lg-prev-slide"
1877                );
1878              }
1879
1880              _lgUtils2.default.addClass(
1881                this.___slide[touchNext],
1882                "lg-next-slide"
1883              );
1884            };
1885
1886            Plugin.prototype.mousewheel = function () {
1887              var _this = this;
1888              _lgUtils2.default.on(_this.outer, "mousewheel.lg", function (e) {
1889                if (!e.deltaY) {
1890                  return;
1891                }
1892
1893                if (e.deltaY > 0) {
1894                  _this.goToPrevSlide();
1895                } else {
1896                  _this.goToNextSlide();
1897                }
1898
1899                e.preventDefault();
1900              });
1901            };
1902
1903            Plugin.prototype.closeGallery = function () {
1904              var _this = this;
1905              var mousedown = false;
1906              _lgUtils2.default.on(
1907                this.outer.querySelector(".lg-close"),
1908                "click.lg",
1909                function () {
1910                  _this.destroy();
1911                }
1912              );
1913
1914              if (_this.s.closable) {
1915                // If you drag the slide and release outside gallery gets close on chrome
1916                // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
1917                _lgUtils2.default.on(_this.outer, "mousedown.lg", function (e) {
1918                  if (
1919                    _lgUtils2.default.hasClass(e.target, "lg-outer") ||
1920                    _lgUtils2.default.hasClass(e.target, "lg-item") ||
1921                    _lgUtils2.default.hasClass(e.target, "lg-img-wrap")
1922                  ) {
1923                    mousedown = true;
1924                  } else {
1925                    mousedown = false;
1926                  }
1927                });
1928
1929                _lgUtils2.default.on(_this.outer, "mouseup.lg", function (e) {
1930                  if (
1931                    _lgUtils2.default.hasClass(e.target, "lg-outer") ||
1932                    _lgUtils2.default.hasClass(e.target, "lg-item") ||
1933                    (_lgUtils2.default.hasClass(e.target, "lg-img-wrap") &&
1934                      mousedown)
1935                  ) {
1936                    if (
1937                      !_lgUtils2.default.hasClass(_this.outer, "lg-dragging")
1938                    ) {
1939                      _this.destroy();
1940                    }
1941                  }
1942                });
1943              }
1944            };
1945
1946            Plugin.prototype.destroy = function (d) {
1947              var _this = this;
1948
1949              if (!d) {
1950                _lgUtils2.default.trigger(_this.el, "onBeforeClose");
1951              }
1952
1953              document.body.scrollTop = _this.prevScrollTop;
1954              document.documentElement.scrollTop = _this.prevScrollTop;
1955
1956              /**
1957               * if d is false or undefined destroy will only close the gallery
1958               * plugins instance remains with the element
1959               *
1960               * if d is true destroy will completely remove the plugin
1961               */
1962
1963              if (d) {
1964                if (!_this.s.dynamic) {
1965                  // only when not using dynamic mode is $items a jquery collection
1966
1967                  for (var i = 0; i < this.items.length; i++) {
1968                    _lgUtils2.default.off(this.items[i], ".lg");
1969                    _lgUtils2.default.off(this.items[i], ".lgcustom");
1970                  }
1971                }
1972
1973                var lguid = _this.el.getAttribute("lg-uid");
1974                delete window.lgData[lguid];
1975                _this.el.removeAttribute("lg-uid");
1976              }
1977
1978              // Unbind all events added by lightGallery
1979              _lgUtils2.default.off(this.el, ".lgtm");
1980
1981              // Distroy all lightGallery modules
1982              for (var key in window.lgModules) {
1983                if (_this.modules[key]) {
1984                  _this.modules[key].destroy(d);
1985                }
1986              }
1987
1988              this.lGalleryOn = false;
1989
1990              clearTimeout(_this.hideBartimeout);
1991              this.hideBartimeout = false;
1992              _lgUtils2.default.off(window, ".lg");
1993              _lgUtils2.default.removeClass(document.body, "lg-on");
1994              _lgUtils2.default.removeClass(document.body, "lg-from-hash");
1995
1996              if (_this.outer) {
1997                _lgUtils2.default.removeClass(_this.outer, "lg-visible");
1998              }
1999
2000              _lgUtils2.default.removeClass(
2001                document.querySelector(".lg-backdrop"),
2002                "in"
2003              );
2004              setTimeout(function () {
2005                try {
2006                  if (_this.outer) {
2007                    _this.outer.parentNode.removeChild(_this.outer);
2008                  }
2009
2010                  if (document.querySelector(".lg-backdrop")) {
2011                    document
2012                      .querySelector(".lg-backdrop")
2013                      .parentNode.removeChild(
2014                        document.querySelector(".lg-backdrop")
2015                      );
2016                  }
2017
2018                  if (!d) {
2019                    _lgUtils2.default.trigger(_this.el, "onCloseAfter");
2020                  }
2021                  _this.el.focus();
2022                } catch (err) {}
2023              }, _this.s.backdropDuration + 50);
2024            };
2025
2026            window.lightGallery = function (el, options) {
2027              if (!el) {
2028                return;
2029              }
2030
2031              try {
2032                if (!el.getAttribute("lg-uid")) {
2033                  var uid = "lg" + window.lgData.uid++;
2034                  window.lgData[uid] = new Plugin(el, options);
2035                  el.setAttribute("lg-uid", uid);
2036                } else {
2037                  window.lgData[el.getAttribute("lg-uid")].init();
2038                }
2039              } catch (err) {
2040                console.error("lightGallery has not initiated properly", err);
2041              }
2042            };
2043          });
2044        },
2045        { "./lg-utils": 1 },
2046      ],
2047    },
2048    {},
2049    [2]
2050  )(2);
2051});

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.