1(function ($, window, document, undefined) { 2 'use strict'; var defaults = { mode: 'lg-slide', cssEasing: 'cubic-bezier(0.25, 0, 0.25, 1)', easing: 'linear', speed: 600, height: '100%', width: '100%', addClass: '', startClass: 'lg-start-zoom', backdropDuration: 150, hideBarsDelay: 6000, useLeft: !1, closable: !0, loop: !0, escKey: !0, keyPress: !0, controls: !0, slideEndAnimatoin: !0, hideControlOnEnd: !1, mousewheel: !0, appendSubHtmlTo: '.lg-sub-html', preload: 0, showAfterLoad: !0, selector: '', nextHtml: '', prevHtml: '', index: !1, iframeMaxWidth: '100%', download: !0, counter: !0, appendCounterTo: '.lg-toolbar', swipeThreshold: 50, enableSwipe: !0, enableDrag: !0, dynamic: !1, dynamicEl: [], galleryId: 1 }; function Plugin(element, options) { 3 this.el = element; this.$el = $(element); this.s = $.extend({}, defaults, options); this.modules = {}; this.lGalleryOn = !1; this.lgBusy = !1; this.hideBartimeout = !1; this.isTouch = ('ontouchstart' in document.documentElement); if (this.s.slideEndAnimatoin) { this.s.hideControlOnEnd = !1 } 4 if (this.s.dynamic) { this.$items = this.s.dynamicEl } else { if (this.s.selector === 'this') { this.$items = this.$el } else if (this.s.selector !== '') { this.$items = this.$el.find($(this.s.selector)) } else { this.$items = this.$el.children() } } 5 this.$slide = ''; this.$outer = ''; this.init(); return this 6 } 7 Plugin.prototype.init = function () { 8 var _this = this; if (_this.s.preload > _this.$items.length) { _this.s.preload = _this.$items.length } 9 var _hash = window.location.hash; if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { _this.index = parseInt(_hash.split('&slide=')[1], 10); $('body').addClass('lg-from-hash'); if (!$('body').hasClass('lg-on')) { setTimeout(function () { _this.build(_this.index); $('body').addClass('lg-on') }) } } 10 if (_this.s.dynamic) { _this.$el.trigger('onBeforeOpen.lg'); _this.index = _this.s.index || 0; if (!$('body').hasClass('lg-on')) { setTimeout(function () { _this.build(_this.index); $('body').addClass('lg-on') }) } } else { 11 _this.$items.on('click.lgcustom', function (event) { 12 try { event.preventDefault(); event.preventDefault() } catch (er) { event.returnValue = !1 } 13 _this.$el.trigger('onBeforeOpen.lg'); _this.index = _this.s.index || _this.$items.index(this); if (!$('body').hasClass('lg-on')) { _this.build(_this.index); $('body').addClass('lg-on') } 14 }) 15 } 16 }; Plugin.prototype.build = function (index) { 17 var _this = this; _this.structure(); $.each($.fn.lightGallery.modules, function (key) { _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el) }); _this.slide(index, !1, !1); if (_this.s.keyPress) { _this.keyPress() } 18 if (_this.$items.length > 1) { _this.arrow(); setTimeout(function () { _this.enableDrag(); _this.enableSwipe() }, 50); if (_this.s.mousewheel) { _this.mousewheel() } } 19 _this.counter(); _this.closeGallery(); _this.$el.trigger('onAfterOpen.lg'); _this.$outer.on('mousemove.lg click.lg touchstart.lg', function () { _this.$outer.removeClass('lg-hide-items'); clearTimeout(_this.hideBartimeout); _this.hideBartimeout = setTimeout(function () { _this.$outer.addClass('lg-hide-items') }, _this.s.hideBarsDelay) }) 20 }; Plugin.prototype.structure = function () { 21 var list = ''; var controls = ''; var i = 0; var subHtmlCont = ''; var template; var _this = this; $('body').append('<div class="lg-backdrop"></div>'); $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); for (i = 0; i < this.$items.length; i++) { list += '<div class="lg-item"></div>' } 22 if (this.s.controls && this.$items.length > 1) { controls = '<div class="lg-actions">' + '<div class="lg-prev lg-icon">' + this.s.prevHtml + '</div>' + '<div class="lg-next lg-icon">' + this.s.nextHtml + '</div>' + '</div>' } 23 if (this.s.appendSubHtmlTo === '.lg-sub-html') { subHtmlCont = '<div class="lg-sub-html"></div>' } 24 template = '<div class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' + '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' + '<div class="lg-inner">
24' + list + '</div>' + '<div class="lg-toolbar group">' + '<span class="lg-close lg-icon"></span>' + '</div>' + controls + subHtmlCont + '</div>' + '</div>'; $('body').append(template); this.$outer = $('.lg-outer'); this.$slide = this.$outer.find('.lg-item'); if (this.s.useLeft) { this.$outer.addClass('lg-use-left'); this.s.mode = 'lg-slide' } else { this.$outer.addClass('lg-use-css3') } 25 _this.setTop(); $(window).on('resize.lg orientationchange.lg', function () { setTimeout(function () { _this.setTop() }, 100) }); this.$slide.eq(this.index).addClass('lg-current'); if (this.doCss()) { this.$outer.addClass('lg-css3') } else { this.$outer.addClass('lg-css'); this.s.speed = 0 } 26 this.$outer.addClass(this.s.mode); if (this.s.enableDrag && this.$items.length > 1) { this.$outer.addClass('lg-grab') } 27 if (this.s.showAfterLoad) { this.$outer.addClass('lg-show-after-load') } 28 if (this.doCss()) { var $inner = this.$outer.find('.lg-inner'); $inner.css('transition-timing-function', this.s.cssEasing); $inner.css('transition-duration', this.s.speed + 'ms') } 29 $('.lg-backdrop').addClass('in'); setTimeout(function () { _this.$outer.addClass('lg-visible') }, this.s.backdropDuration); if (this.s.download) { this.$outer.find('.lg-toolbar').append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>') } 30 this.prevScrollTop = $(window).scrollTop() 31 }; Plugin.prototype.setTop = function () { if (this.s.height !== '100%') { var wH = $(window).height(); var top = (wH - parseInt(this.s.height, 10)) / 2; var $lGallery = this.$outer.find('.lg'); if (wH >= parseInt(this.s.height, 10)) { $lGallery.css('top', top + 'px') } else { $lGallery.css('top', '0px') } } }; Plugin.prototype.doCss = function () { 32 var support = function () { var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; var root = document.documentElement; var i = 0; for (i = 0; i < transition.length; i++) { if (transition[i] in root.style) { return !0 } } }; if (support()) { return !0 } 33 return !1 34 }; Plugin.prototype.isVideo = function (src, index) { 35 var html; if (this.s.dynamic) { html = this.s.dynamicEl[index].html } else { html = this.$items.eq(index).attr('data-html') } 36 if (!src && html) { return { html5: !0 } } 37 var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); if (youtube) { return { youtube: youtube } } else if (vimeo) { return { vimeo: vimeo } } else if (dailymotion) { return { dailymotion: dailymotion } } 38 }; Plugin.prototype.counter = function () { if (this.s.counter) { $(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>') } }; Plugin.prototype.addHtml = function (index) { 39 var subHtml = null; var subHtmlUrl; if (this.s.dynamic) { if (this.s.dynamicEl[index].subHtmlUrl) { subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl } else { subHtml = this.s.dynamicEl[index].subHtml } } else { if (this.$items.eq(index).attr('data-sub-html-url')) { subHtmlUrl = this.$items.eq(index).attr('data-sub-html-url') } else { subHtml = this.$items.eq(index).attr('data-sub-html') } } 40 if (!subHtmlUrl) { if (typeof subHtml !== 'undefined' && subHtml !== null) { var fL = subHtml.substring(0, 1); if (fL === '.' || fL === '#') { subHtml = $(subHtml).html() } else { subHtml = subHtml } } else { subHtml = '' } } 41 if (this.s.appendSubHtmlTo === '.lg-sub-html') { if (subHtmlUrl) { this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl) } else { this.$outer.find(this.s.appendSubHtmlTo).html(subHtml) } } else { if (subHtmlUrl) { this.$slide.eq(index).load(subHtmlUrl) } else { this.$slide.eq(index).append(subHtml) } } 42 if (typeof subHtml !== 'undefined' && subHtml !== null) { if (subHtml === '') { this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html') } else { this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html') } } 43 this.$el.trigger('onAfterAppendSubHtml.lg', [index]) 44 }; Plugin.prototype.preload = function (index) { 45 var i = 1; var j = 1; for (i = 1; i <= this.s.preload; i++) { 46 if (i >= this.$items.length - index) { break } 47 this.loadContent(index + i, !1, 0) 48 } 49 for (j = 1; j <= this.s.preload; j++) { 50 if (index - j < 0) { break } 51 this.loadContent(index - j, !1, 0) 52 } 53 }; Plugin.prototype.loadContent = function (index, rec, delay) { 54 if (document.getElementById("adguru_side_right")) { document.getElementById("adguru_side_right").style.display = 'none' } 55 if (document.getElementById("adguru_side_left")) { document.getElementById("adguru_side_left").style.display = 'none' } 56 if (document.getElementById("sticky-anchor")) { document.getElementById("sticky-anchor").style.display = 'none' } 57 if (document.getElementById("sticky")) { document.getElementById("sticky").style.display = 'none' } 58 var _this = this; var _hasPoster = !1; var _$img; var _src; var _poster; var _srcset; var _sizes; var _html; var getResponsiveSrc = function (srcItms) { 59 var rsWidth = []; var rsSrc = []; for (var i = 0; i < srcItms.length; i++) { 60 var __src = srcItms[i].split(' '); if (__src[0] === '') { __src.splice(0, 1) } 61 rsSrc.push(__src[0]); rsWidth.push(__src[1]) 62 } 63 var wWidth = $(window).width(); for (var j = 0; j < rsWidth.length; j++) { if (parseInt(rsWidth[j], 10) >
63 wWidth) { _src = rsSrc[j]; break } } 64 }; if (_this.s.dynamic) { 65 if (_this.s.dynamicEl[index].poster) { _hasPoster = !0; _poster = _this.s.dynamicEl[index].poster } 66 _html = _this.s.dynamicEl[index].html; _src = _this.s.dynamicEl[index].src; if (_this.s.dynamicEl[index].responsive) { var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); getResponsiveSrc(srcDyItms) } 67 _srcset = _this.s.dynamicEl[index].srcset; _sizes = _this.s.dynamicEl[index].sizes 68 } else { 69 if (_this.$items.eq(index).attr('data-poster')) { _hasPoster = !0; _poster = _this.$items.eq(index).attr('data-poster') } 70 _html = _this.$items.eq(index).attr('data-html'); _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'); if (_this.$items.eq(index).attr('data-responsive')) { var srcItms = _this.$items.eq(index).attr('data-responsive').split(','); getResponsiveSrc(srcItms) } 71 _srcset = _this.$items.eq(index).attr('data-srcset'); _sizes = _this.$items.eq(index).attr('data-sizes') 72 } 73 var iframe = !1; if (_this.s.dynamic) { if (_this.s.dynamicEl[index].iframe) { iframe = !0 } } else { if (_this.$items.eq(index).attr('data-iframe') === 'true') { iframe = !0 } } 74 var _isVideo = _this.isVideo(_src, index); if (!_this.$slide.eq(index).hasClass('lg-loaded')) { 75 if (iframe) { _this.$slide.eq(index).prepend('<div class="lg-video-cont" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '" allowfullscreen="true"></iframe></div></div>') } else if (_hasPoster) { 76 var videoClass = ''; if (_isVideo && _isVideo.youtube) { videoClass = 'lg-has-youtube' } else if (_isVideo && _isVideo.vimeo) { videoClass = 'lg-has-vimeo' } else { videoClass = 'lg-has-html5' } 77 _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>') 78 } else if (_isVideo) { _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>'); _this.$el.trigger('hasVideo.lg', [index, _src, _html]) } else { _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="' + _src + '" /></div>') } 79 _this.$el.trigger('onAferAppendSlide.lg', [index]); _$img = _this.$slide.eq(index).find('.lg-object'); if (_sizes) { _$img.attr('sizes', _sizes) } 80 if (_srcset) { _$img.attr('srcset', _srcset); try { picturefill({ elements: [_$img[0]] }) } catch (e) { console.error('Make sure you have included Picturefill version 2') } } 81 if (this.s.appendSubHtmlTo !== '.lg-sub-html') { _this.addHtml(index) } 82 _this.$slide.eq(index).addClass('lg-loaded') 83 } 84 _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function () { 85 var _speed = 0; if (delay && !$('body').hasClass('lg-from-hash')) { _speed = delay } 86 setTimeout(function () { _this.$slide.eq(index).addClass('lg-complete'); _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]) }, _speed) 87 }); if (_isVideo && _isVideo.html5 && !_hasPoster) { _this.$slide.eq(index).addClass('lg-complete') } 88 if (rec === !0) { if (!_this.$slide.eq(index).hasClass('lg-complete')) { _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function () { _this.preload(index) }) } else { _this.preload(index) } } 89 }; Plugin.prototype.slide = function (index, fromTouch, fromThumb) { 90 var _prevIndex = this.$outer.find('.lg-current').index(); var _this = this; if (_this.lGalleryOn && (_prevIndex === index)) { return } 91 var _length = this.$slide.length; var _time = _this.lGalleryOn ? this.s.speed : 0; var _next = !1; var _prev = !1; if (!_this.lgBusy) { 92 this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); _this.lgBusy = !0; clearTimeout(_this.hideBartimeout); if (this.s.appendSubHtmlTo === '.lg-sub-html') { setTimeout(function () { _this.addHtml(index) }, _time) } 93 this.arrowDisable(index); if (!fromTouch) { 94 _this.$outer.addClass('lg-no-trans'); this.$slide.removeClass('lg-prev-slide lg-next-slide'); if (index < _prevIndex) { _prev = !0; if ((index === 0) && (_prevIndex === _length - 1) && !fromThumb) { _prev = !1; _next = !0 } } else if (index > _prevIndex) { _next = !0; if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) { _prev = !0; _next = !1 } } 95 if (_prev) { this.$slide.eq(index).addClass('lg-prev-slide'); this.$slide.eq(_prevIndex).addClass('lg-next-slide') } else if (_next) { this.$slide.eq(index).addClass('lg-next-slide'); this.$slide.eq(_prevIndex).addClass('lg-prev-slide') } 96 setTimeout(function () { _this.$slide.removeClass('lg-current'); _this.$slide.eq(index).addClass('lg-current'); _this.$outer.removeClass('lg-no-trans') }, 50) 97 } else { 98 var touchPrev = index - 1; var touchNext = index + 1; if ((index === 0) && (_prevIndex === _length - 1)) { touchNext = 0; touchPrev = _length - 1 } else if ((index === _length - 1) && (_prevIndex === 0)) { touchNext = 0; touchPrev = _length - 1 } 99 this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); _this.$slide.eq(touchNext).addClass('lg-next-slide'); _this.$slide.eq(index).addClass('lg-current') 100 } 101 if (_this.lGalleryOn) { setTimeout(function () { _this.loadContent(index, !0, 0) }, this.s.speed + 50); setTimeout(function () { _this.lgBusy = !1; _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]) }, this.s.speed) } else { _this.loadContent(index, !0, _this.s.backdropDuration); _this.lgBusy = !1; _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]) } 102 if (this.s.download) { 103 var _src; if (_this.s.dynamic) { _src = _this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src } else { _src = _this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src') } 104 $('#lg-download').attr('href', _src) 105 } 106 _this.lGalleryOn = !0; if (this.s.counter) { $('#lg-counter-current').text(index + 1) } 107 } 108 }; Plugin.prototype.goToNextSlide = function (fromTouch) { var _this = this; if (!_this.lgBusy) { if ((_this.index + 1) < _this.$slide.length) { _this.index++; _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); _this.slide(_this.index, fromTouch, !1) } else { if (_this.s.loop) { _this.index = 0; _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); _this.slide(_this.index, fromTouch, !1) } else if (_this.s.slideEndAnimatoin) { _this.$outer.addClass('lg-right-end'); setTimeout(function () { _this.$outer.removeClass('lg-right-end') }, 400) } } } }; Plugin.prototype.goToPrevSlide = function (fromTouch) { var _this = this; if (!_this.lgBusy) { if (_this.index > 0) { _this.index--; _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); _this.slide(_this.index, fromTouch, !1) } else { if (_this.s.loop) { _this.index = _this.$items.length - 1; _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); _this.slide(_this.index, fromTouch, !1) } else if (_this.s.slideEndAnimatoin) { _this.$outer.addClass('lg-left-end'); setTimeout(function () { _this.$outer.removeClass('lg-left-end') }, 400) } } } }; Plugin.prototype.keyPress = function () { 109 var _this = this; if (this.$items.length > 1) { 110 $(window).on('keyup.lg', function (e) { 111 if (_this.$items.length > 1) { 112 if (e.keyCode === 37) { e.preventDefault(); _this.goToPrevSlide() } 113 if (e.keyCode === 39) { e.preventDefault(); _this.goToNextSlide() } 114 } 115 }) 116 } 117 $(window).on('keydown.lg', function (e) { if (_this.s.escKey === !0 && e.keyCode === 27) { e.preventDefault(); if (!_this.$outer.hasClass('lg-thumb-open')) { _this.destroy() } else { _this.$outer.removeClass('lg-thumb-open') } } }) 118 }; Plugin.prototype.arrow = function () { var _this = this; this.$outer.find('.lg-prev').on('click.lg', function () { _this.goToPrevSlide() }); this.$outer.find('.lg-next').on('click.lg', function () { _this.goToNextSlide() }) }; Plugin.prototype.arrowDisable = function (index) { 119 if (!this.s.loop && this.s.hideControlOnEnd) { 120 if ((index + 1) < this.$slide.length) { this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled') } else { this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled') } 121 if (index > 0) { this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled') } else { this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled') } 122 } 123 }; Plugin.prototype.setTranslate = function ($el, xValue, yValue) { if (this.s.useLeft) { $el.css('left', xValue) } else { $el.css({ transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' }) } }; Plugin.prototype.touchMove = function (startCoords, endCoords) { var distance = endCoords - startCoords; this.$outer.addClass('lg-dragging'); this.setTranslate(this.$slide.eq(this.index), distance, 0); this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0) }; Plugin.prototype.touchEnd = function (distance) { 124 var _this = this; if (_this.s.mode !== 'lg-slide') { _this.$outer.addClass('lg-slide') } 125 this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); setTimeout(function () { 126 _this.$outer.removeClass('lg-dragging'); if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { _this.goToNextSlide(!0) } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { _this.goToPrevSlide(!0) } else if (Math.abs(distance) < 5) { _this.$el.trigger('onSlideClick.lg') } 127 _this.$slide.removeAttr('style') 128 }); setTimeout(function () { if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { _this.$outer.removeClass('lg-slide') } }, _this.s.speed + 100) 129 }; Plugin.prototype.enableSwipe = function () { var _this = this; var startCoords = 0; var endCoords = 0; var isMoved = !1; if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) { _this.$slide.on('touchstart.lg', function (e) { if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { e.preventDefault(); _this.manageSwipeClass(); startCoords = e.originalEvent.targetTouches[0].pageX } }); _this.$slide.on('touchmove.lg', function (e) { if (!_this.$outer.hasClass('lg-zoomed')) { e.preventDefault(); endCoords = e.originalEvent.targetTouches[0].pageX; _this.touchMove(startCoords, endCoords); isMoved = !0 } }); _this.$slide.on('touchend.lg', function () { if (!_this.$outer.hasClass('lg-zoomed')) { if (isMoved) { isMoved = !1; _this.touchEnd(endCoords - startCoords) } else { _this.$el.trigger('onSlideClick.lg') } } }) } }; Plugin.prototype.enableDrag = function () { 130 var _this = this; var startCoords = 0; var endCoords = 0; var isDraging = !1; var isMoved = !1; if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) { 131 _this.$slide.on('mousedown.lg', function (e) { if (!_this.$outer.hasClass('lg-zoomed')) { if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { e.preventDefault(); if (!_this.lgBusy) { _this.manageSwipeClass(); startCoords = e.pageX; isDraging = !0; _this.$outer.scrollLeft += 1; _this.$outer.scrollLeft -= 1; _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); _this.$el.trigger('onDragstart.lg') } } } }); $(window).on('mousemove.lg', function (e) { if (isDraging) { isMoved = !0; endCoords = e.pageX; _this.touchMove(startCoords, endCoords); _this.$el.trigger('onDragmove.lg') } }); $(window).on('mouseup.lg', function (e) { 132 if (isMoved) { isMoved = !1; _this.touchEnd(endCoords - startCoords); _this.$el.trigger('onDragend.lg') } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { _this.$el.trigger('onSlideClick.lg') } 133 if (isDraging) { isDraging = !1; _this.$outer.removeClass('lg-grabbing').addClass('lg-grab') } 134 }) 135 } 136 }; Plugin.prototype.manageSwipeClass = function () { 137 var touchNext = this.index + 1; var touchPrev = this.index - 1; var length = this.$slide.length; if (this.s.loop) { if (this.index === 0) { touchPrev = length - 1 } else if (this.index === length - 1) { touchNext = 0 } } 138 this.$slide.removeClass('lg-next-slide lg-prev-slide'); if (touchPrev > -1) { this.$slide.eq(touchPrev).addClass('lg-prev-slide') } 139 this.$slide.eq(touchNext).addClass('lg-next-slide') 140 }; Plugin.prototype.mousewheel = function () { 141 var _this = this; _this.$outer.on('mousewheel.lg', function (e) { 142 if (!e.deltaY) { return } 143 if (e.deltaY > 0) { _this.goToPrevSlide() } else { _this.goToNextSlide() } 144 e.preventDefault() 145 }) 146 }; Plugin.prototype.closeGallery = function () { var _this = this; var mousedown = !1; this.$outer.find('.lg-close').on('click.lg', function () { _this.destroy() }); if (_this.s.closable) { _this.$outer.on('mousedown.lg', function (e) { if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { mousedown = !0 } else { mousedown = !1 } }); _this.$outer.on('mouseup.lg', function (e) { if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { if (!_this.$outer.hasClass('lg-dragging')) { _this.destroy() } } }) } }; Plugin.prototype.destroy = function (d) { 147 var _this = this; _this.$el.trigger('onBeforeClose.lg'); $(window).scrollTop(_this.prevScrollTop); if (d) { this.$items.off('click.lg click.lgcustom'); $.removeData(_this.el, 'lightGallery') } 148 this.$el.off('.lg.tm'); $.each($.fn.lightGallery.modules, function (key) { if (_this.modules[key]) { _this.modules[key].destroy() } }); this.lGalleryOn = !1; clearTimeout(_this.hideBartimeout); this.hideBartimeout = !1; $(window).off('.lg'); $('body').removeClass('lg-on lg-from-hash'); if (_this.$outer) { _this.$outer.removeClass('lg-visible') } 149 $('.lg-backdrop').removeClass('in'); setTimeout(function () { 150 if (_this.$outer) { _this.$outer.remove() } 151 $('.lg-backdrop').remove(); _this.$el.trigger('onCloseAfter.lg') 152 }, _this.s.backdropDuration + 50) 153 }; $.fn.lightGallery = function (options) { return this.each(function () { if (!$.data(this, 'lightGallery')) { $.data(this, 'lightGallery', new Plugin(this, options)) } else { try { $(this).data('lightGallery').init() } catch (err) { console.error('lightGallery has not initiated properly') } } }) }; $.fn.lightGallery.modules = {} 154})(jQuery, window, document)
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.