Вход Регистрация
Файл: public/assets/plugins/light-box/lightbox.min.js
Строк: 445
<?php
/*!
 * Lightbox v2.10.0
 * by Lokesh Dhakar
 *
 * More info:
 * http://lokeshdhakar.com/projects/lightbox2/
 *
 * Copyright 2007, 2018 Lokesh Dhakar
 * Released under the MIT license
 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
 *
 * @preserve
 */
! function(ab) {
    
"function" == typeof define && define.amd define(["jquery"], b) : "object" == typeof exports module.exports b(require("jquery")) : a.lightbox b(a.jQuery)
}(
this, function(a) {
    function 
b(b) {
        
this.album = [], this.currentImageIndex void 0this.init(), this.options a.extend({}, this.constructor.defaults), this.option(b)
    }
    return 
b.defaults = {
        
albumLabel"Image %1 of %2",
        
alwaysShowNavOnTouchDevices: !1,
        
fadeDuration600,
        
fitImagesInViewport: !0,
        
imageFadeDuration600,
        
positionFromTop50,
        
resizeDuration700,
        
showImageNumberLabel: !0,
        
wrapAround: !1,
        
disableScrolling: !1,
        
sanitizeTitle: !1
    
}, b.prototype.option = function(b) {
        
a.extend(this.optionsb)
    }, 
b.prototype.imageCountLabel = function(ab) {
        return 
this.options.albumLabel.replace(/%1/ga).replace(/%2/gb)
    }, 
b.prototype.init = function() {
        var 
this;
        
a(document).ready(function() {
            
b.enable(), b.build()
        })
    }, 
b.prototype.enable = function() {
        var 
this;
        
a("body").on("click""a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]", function(c) {
            return 
b.start(a(c.currentTarget)), !1
        
})
    }, 
b.prototype.build = function() {
        if (!(
a("#lightbox").length 0)) {
            var 
this;
            
a('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo(a("body")), this.$lightbox a("#lightbox"), this.$overlay a("#lightboxOverlay"), this.$outerContainer this.$lightbox.find(".lb-outerContainer"), this.$container this.$lightbox.find(".lb-container"), this.$image this.$lightbox.find(".lb-image"), this.$nav this.$lightbox.find(".lb-nav"), this.containerPadding = {
                
topparseInt(this.$container.css("padding-top"), 10),
                
rightparseInt(this.$container.css("padding-right"), 10),
                
bottomparseInt(this.$container.css("padding-bottom"), 10),
                
leftparseInt(this.$container.css("padding-left"), 10)
            }, 
this.imageBorderWidth = {
                
topparseInt(this.$image.css("border-top-width"), 10),
                
rightparseInt(this.$image.css("border-right-width"), 10),
                
bottomparseInt(this.$image.css("border-bottom-width"), 10),
                
leftparseInt(this.$image.css("border-left-width"), 10)
            }, 
this.$overlay.hide().on("click", function() {
                return 
b.end(), !1
            
}), this.$lightbox.hide().on("click", function(c) {
                return 
"lightbox" === a(c.target).attr("id") && b.end(), !1
            
}), this.$outerContainer.on("click", function(c) {
                return 
"lightbox" === a(c.target).attr("id") && b.end(), !1
            
}), this.$lightbox.find(".lb-prev").on("click", function() {
                return 
=== b.currentImageIndex b.changeImage(b.album.length 1) : b.changeImage(b.currentImageIndex 1), !1
            
}), this.$lightbox.find(".lb-next").on("click", function() {
                return 
b.currentImageIndex === b.album.length b.changeImage(0) : b.changeImage(b.currentImageIndex 1), !1
            
}), this.$nav.on("mousedown", function(a) {
                
=== a.which && (b.$nav.css("pointer-events""none"), b.$lightbox.one("contextmenu", function() {
                    
setTimeout(function() {
                        
this.$nav.css("pointer-events""auto")
                    }.
bind(b), 0)
                }))
            }), 
this.$lightbox.find(".lb-loader, .lb-close").on("click", function() {
                return 
b.end(), !1
            
})
        }
    }, 
b.prototype.start = function(b) {
        function 
c(a) {
            
d.album.push({
                
alta.attr("data-alt"),
                
linka.attr("href"),
                
titlea.attr("data-title") || a.attr("title")
            })
        }
        var 
this,
            
a(window);
        
e.on("resize"a.proxy(this.sizeOverlaythis)), a("select, object, embed").css({
            
visibility"hidden"
        
}), this.sizeOverlay(), this.album = [];
        var 
f0,
            
b.attr("data-lightbox");
        if (
h) {
            
a(b.prop("tagName") + '[data-lightbox="' '"]');
            for (var 
0f.length= ++ic(a(f[i])), f[i] === b[0] && (i)
        } else if (
"lightbox" === b.attr("rel")) c(b);
        else {
            
a(b.prop("tagName") + '[rel="' b.attr("rel") + '"]');
            for (var 
0f.length= ++jc(a(f[j])), f[j] === b[0] && (j)
        }
        var 
e.scrollTop() + this.options.positionFromTop,
            
e.scrollLeft();
        
this.$lightbox.css({
            
top"px",
            
left"px"
        
}).fadeIn(this.options.fadeDuration), this.options.disableScrolling && a("html").addClass("lb-disable-scrolling"), this.changeImage(g)
    }, 
b.prototype.changeImage = function(b) {
        var 
this;
        
this.disableKeyboardNav();
        var 
this.$lightbox.find(".lb-image");
        
this.$overlay.fadeIn(this.options.fadeDuration), a(".lb-loader").fadeIn("slow"), this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(), this.$outerContainer.addClass("animating");
        var 
= new Image;
        
e.onload = function() {
            var 
fghijk;
            
d.attr({
                
altc.album[b].alt,
                
srcc.album[b].link
            
}), a(e), d.width(e.width), d.height(e.height), c.options.fitImagesInViewport && (a(window).width(), a(window).height(), c.containerPadding.left c.containerPadding.right c.imageBorderWidth.left c.imageBorderWidth.right 20c.containerPadding.top c.containerPadding.bottom c.imageBorderWidth.top c.imageBorderWidth.bottom 120c.options.maxWidth && c.options.maxWidth && (c.options.maxWidth), c.options.maxHeight && c.options.maxHeight && (c.options.maxHeight), (e.width || e.height h) && (e.width e.height ? (iparseInt(e.height / (e.width g), 10), d.width(g), d.height(f)) : (hparseInt(e.width / (e.height f), 10), d.width(g), d.height(f)))), c.sizeContainer(d.width(), d.height())
        }, 
e.src this.album[b].linkthis.currentImageIndex b
    
}, b.prototype.sizeOverlay = function() {
        
this.$overlay.width(a(document).width()).height(a(document).height())
    }, 
b.prototype.sizeContainer = function(ab) {
        function 
c() {
            
d.$lightbox.find(".lb-dataContainer").width(g), d.$lightbox.find(".lb-prevLink").height(h), d.$lightbox.find(".lb-nextLink").height(h), d.showImage()
        }
        var 
this,
            
this.$outerContainer.outerWidth(),
            
this.$outerContainer.outerHeight(),
            
this.containerPadding.left this.containerPadding.right this.imageBorderWidth.left this.imageBorderWidth.right,
            
this.containerPadding.top this.containerPadding.bottom this.imageBorderWidth.top this.imageBorderWidth.bottom;
        
!== || !== this.$outerContainer.animate({
            
widthg,
            
heighth
        
}, this.options.resizeDuration"swing", function() {
            
c()
        }) : 
c()
    }, 
b.prototype.showImage = function() {
        
this.$lightbox.find(".lb-loader").stop(!0).hide(), this.$lightbox.find(".lb-image").fadeIn(this.options.imageFadeDuration), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav()
    }, 
b.prototype.updateNav = function() {
        var 
= !1;
        try {
            
document.createEvent("TouchEvent"), = !!this.options.alwaysShowNavOnTouchDevices
        
} catch (a) {}
        
this.$lightbox.find(".lb-nav").show(), this.album.length && (this.options.wrapAround ? (&& this.$lightbox.find(".lb-prev, .lb-next").css("opacity""1"), this.$lightbox.find(".lb-prev, .lb-next").show()) : (this.currentImageIndex && (this.$lightbox.find(".lb-prev").show(), && this.$lightbox.find(".lb-prev").css("opacity""1")), this.currentImageIndex this.album.length && (this.$lightbox.find(".lb-next").show(), && this.$lightbox.find(".lb-next").css("opacity""1"))))
    }, 
b.prototype.updateDetails = function() {
        var 
this;
        if (
void 0 !== this.album[this.currentImageIndex].title && "" !== this.album[this.currentImageIndex].title) {
            var 
this.$lightbox.find(".lb-caption");
            
this.options.sanitizeTitle c.text(this.album[this.currentImageIndex].title) : c.html(this.album[this.currentImageIndex].title), c.fadeIn("fast").find("a").on("click", function(b) {
                
void 0 !== a(this).attr("target") ? window.open(a(this).attr("href"), a(this).attr("target")) : location.href a(this).attr("href")
            })
        }
        if (
this.album.length && this.options.showImageNumberLabel) {
            var 
this.imageCountLabel(this.currentImageIndex 1this.album.length);
            
this.$lightbox.find(".lb-number").text(d).fadeIn("fast")
        } else 
this.$lightbox.find(".lb-number").hide();
        
this.$outerContainer.removeClass("animating"), this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration, function() {
            return 
b.sizeOverlay()
        })
    }, 
b.prototype.preloadNeighboringImages = function() {
        if (
this.album.length this.currentImageIndex 1) {
            (new 
Image).src this.album[this.currentImageIndex 1].link
        
}
        if (
this.currentImageIndex 0) {
            (new 
Image).src this.album[this.currentImageIndex 1].link
        
}
    }, 
b.prototype.enableKeyboardNav = function() {
        
a(document).on("keyup.keyboard"a.proxy(this.keyboardActionthis))
    }, 
b.prototype.disableKeyboardNav = function() {
        
a(document).off(".keyboard")
    }, 
b.prototype.keyboardAction = function(a) {
        var 
a.keyCode,
            
String.fromCharCode(b).toLowerCase();
        
27 === || c.match(/x|o|c/) ? this.end() : "p" === || 37 === !== this.currentImageIndex this.changeImage(this.currentImageIndex 1) : this.options.wrapAround && this.album.length && this.changeImage(this.album.length 1) : "n" !== && 39 !== || (this.currentImageIndex !== this.album.length this.changeImage(this.currentImageIndex 1) : this.options.wrapAround && this.album.length && this.changeImage(0))
    }, 
b.prototype.end = function() {
        
this.disableKeyboardNav(), a(window).off("resize"this.sizeOverlay), this.$lightbox.fadeOut(this.options.fadeDuration), this.$overlay.fadeOut(this.options.fadeDuration), a("select, object, embed").css({
            
visibility"visible"
        
}), this.options.disableScrolling && a("html").removeClass("lb-disable-scrolling")
    }, new 
b
});
//# sourceMappingURL=lightbox.min.map
?>
Онлайн: 1
Реклама