PageSourceSearch

https://kwbm.co.jp/data/common/c1001a016301/js/lightbox.min.js

js kwbm.co.jp collected 2026-10-06 08:12:05 UTC 11,922 bytes, 179 lines download raw bytes

vendor: 8,765 bytes, lines 1-137
1/*!
2 * Lightbox v2.9.0
3 * by Lokesh Dhakar
4 *
5 * More info:
6 * http://lokeshdhakar.com/projects/lightbox2/
7 *
8 * Copyright 2007, 2015 Lokesh Dhakar
9 * Released under the MIT license
10 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
11 */
12! function(a, b) {
13    "function" == typeof define && define.amd ? define(["jquery"], b) : "object" == typeof exports ? module.exports = b(require("jquery")) : a.lightbox = b(a.jQuery)
14}(this, function(a) {
15    function b(b) {
16        this.album = [], this.currentImageIndex = void 0, this.init(), this.options = a.extend({}, this.constructor.defaults), this.option(b)
17    }
18    return b.defaults = {
19        albumLabel: "Image %1 of %2",
20        alwaysShowNavOnTouchDevices: !1,
21        fadeDuration: 600,
22        fitImagesInViewport: !0,
23        imageFadeDuration: 600,
24        positionFromTop: 50,
25        resizeDuration: 700,
26        showImageNumberLabel: !0,
27        wrapAround: !1,
28        disableScrolling: !1,
29        sanitizeTitle: !1
30    }, b.prototype.option = function(b) {
31        a.extend(this.options, b)
32    }, b.prototype.imageCountLabel = function(a, b) {
33        return this.options.albumLabel.replace(/%1/g, a).replace(/%2/g, b)
34    }, b.prototype.init = function() {
35        var b = this;
36        a(document).ready(function() {
37            b.enable(), b.build()
38        })
39    }, b.prototype.enable = function() {
40        var b = this;
41        a("body").on("click", "a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]", function(c) {
42            return b.start(a(c.currentTarget)), !1
43        })
44    }, b.prototype.build = function() {
45        var b = this;
46        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 = {
47            top: parseInt(this.$container.css("padding-top"), 10),
48            right: parseInt(this.$container.css("padding-right"), 10),
49            bottom: parseInt(this.$container.css("padding-bottom"), 10),
50            left: parseInt(this.$container.css("padding-left"), 10)
51        }, this.imageBorderWidth = {
52            top: parseInt(this.$image.css("border-top-width"), 10),
53            right: parseInt(this.$image.css("border-right-width"), 10),
54            bottom: parseInt(this.$image.css("border-bottom-width"), 10),
55            left: parseInt(this.$image.css("border-left-width"), 10)
56        }, this.$overlay.hide().on("click", function() {
57            return b.end(), !1
58        }), this.$lightbox.hide().on("click", function(c) {
59            return "lightbox" === a(c.target).attr("id") && b.end(), !1
60        }), this.$outerContainer.on("click", function(c) {
61            return "lightbox" === a(c.target).attr("id") && b.end(), !1
62        }), this.$lightbox.find(".lb-prev").on("click", function() {
63            return 0 === b.currentImageIndex ? b.changeImage(b.album.length - 1) : b.changeImage(b.currentImageIndex - 1), !1
64        }), this.$lightbox.find(".lb-next").on("click", function() {
65            return b.currentImageIndex === b.album.length - 1 ? b.changeImage(0) : b.changeImage(b.currentImageIndex + 1), !1
66        }), this.$nav.on("mousedown", function(a) {
67            3 === a.which && (b.$nav.css("pointer-events", "none"), b.$lightbox.one("contextmenu", function() {
68                setTimeout(function() {
69                    this.$nav.css("pointer-events", "auto")
70                }.bind(b), 0)
71            }))
72        }), this.$lightbox.find(".lb-loader, .lb-close").on("click", function() {
73            return b.end(), !1
74        })
75    }, b.prototype.start = function(b) {
76        function c(a) {
77            d.album.push({
78                link: a.attr("href"),
79                title: a.attr("data-title") || a.attr("title")
80            })
81        }
82        var d = this,
83            e = a(window);
84        e.on("resize", a.proxy(this.sizeOverlay, this)), a("select, object, embed").css({
85            visibility: "hidden"
86        }), this.sizeOverlay(), this.album = [];
87        var f, g = 0,
88            h = b.attr("data-lightbox");
89        if (h) {
90            f = a(b.prop("tagName") + '[data-lightbox="' + h + '"]');
91            for (var i = 0; i < f.length; i = ++i) c(a(f[i])), f[i] === b[0] && (g = i)
92        } else if ("lightbox" === b.attr("rel")) c(b);
93        else {
94            f = a(b.prop("tagName") + '[rel="' + b.attr("rel") + '"]');
95            for (var j = 0; j < f.length; j = ++j) c(a(f[j])), f[j] === b[0] && (g = j)
96        }
97        var k = e.scrollTop() + this.options.positionFromTop,
98            l = e.scrollLeft();
99        this.$lightbox.css({
100            top: k + "px",
101            left: l + "px"
102        }).fadeIn(this.options.fadeDuration), this.options.disableScrolling && a("body").addClass("lb-disable-scrolling"), this.changeImage(g)
103    }, b.prototype.changeImage = function(b) {
104        var c = this;
105        this.disableKeyboardNav();
106        var d = this.$lightbox.find(".lb-image");
107        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");
108        var e = new Image;
109        e.onload = function() {
110            var f, g, h, i, j, k, l;
111            d.attr("src", c.album[b].link), f = a(e), d.width(e.width), d.height(e.height), c.options.fitImagesInViewport && (l = a(window).width(), k = a(window).height(), j = l - c.containerPadding.left - c.containerPadding.right - c.imageBorderWidth.left - c.imageBorderWidth.right - 20, i = k - c.containerPadding.top - c.containerPadding.bottom - c.imageBorderWidth.top - c.imageBorderWidth.bottom - 120, c.options.maxWidth && c.options.maxWidth < j && (j = c.options.maxWidth), c.options.maxHeight && c.options.maxHeight < j && (i = c.options.maxHeight), (e.width > j || e.height > i) && (e.width / j > e.height / i ? (h = j, g = parseInt(e.height / (e.width / h), 10), d.width(h), d.height(g)) : (g = i, h = parseInt(e.width / (e.height / g), 10), d.width(h), d.height(g)))), c.sizeContainer(d.width(), d.height())
112        }, e.src = this.album[b].link, this.currentImageIndex = b
113    }, b.prototype.sizeOverlay = function() {
114        this.$overlay.width(a(document).width()).height(a(document).height())
115    }, b.prototype.sizeContainer = function(a, b) {
116        function c() {
117            d.$lightbox.find(".lb-dataContainer").width(g), d.$lightbox.find(".lb-prevLink").height(h), d.$lightbox.find(".lb-nextLink").height(h), d.showImage()
118        }
119        var d = this,
120            e = this.$outerContainer.outerWidth(),
121            f = this.$outerContainer.outerHeight(),
122            g = a + this.containerPadding.left + this.containerPadding.right + this.imageBorderWidth.left + this.imageBorderWidth.right,
123            h = b + this.containerPadding.top + this.containerPadding.bottom + this.imageBorderWidth.top + this.imageBorderWidth.bottom;
124        e !== g || f !== h ? this.$outerContainer.animate({
125            width: g,
126            height: h
127        }, this.options.resizeDuration, "swing", function() {
128            c()
129        }) : c()
130    }, b.prototype.showImage = function() {
131        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()
132    }, b.prototype.updateNav = function() {
133        var a = !1;
134        try {
135            document.createEvent("TouchEvent"), a = this.options.alwaysShowNavOnTouchDevices ? !0 : !1
136        } catch (b) {}
137        this.$lightbox.find(".lb-nav").show(), this.album.length > 1 && (this.options.wrapAround ? (a && this.$lightbox.find(".lb-prev, .lb-next").
137css("opacity", "1"), this.$lightbox.find(".lb-prev, .lb-next").show()) : (this.currentImageIndex > 0 && (this.$lightbox.find(".lb-prev").show(), a && this.$lightbox.find(".lb-prev").css("opacity", "1")), this.currentImageIndex < this.album.length - 1 && (this.$lightbox.find(".lb-next").show(), a && this.$lightbox.find(".lb-next").css("opacity", "1"))))
138    }, b.prototype.updateDetails = function() {
139        var b = this;
140        if ("undefined" != typeof this.album[this.currentImageIndex].title && "" !== this.album[this.currentImageIndex].title) {
141            var c = this.$lightbox.find(".lb-caption");
142            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) {
143                void 0 !== a(this).attr("target") ? window.open(a(this).attr("href"), a(this).attr("target")) : location.href = a(this).attr("href")
144            })
145        }
146        if (this.album.length > 1 && this.options.showImageNumberLabel) {
147            var d = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
148            this.$lightbox.find(".lb-number").text(d).fadeIn("fast")
149        } else this.$lightbox.find(".lb-number").hide();
150        this.$outerContainer.removeClass("animating"), this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration, function() {
151            return b.sizeOverlay()
152        })
153    }, b.prototype.preloadNeighboringImages = function() {
154        if (this.album.length > this.currentImageIndex + 1) {
155            var a = new Image;
156            a.src = this.album[this.currentImageIndex + 1].link
157        }
158        if (this.currentImageIndex > 0) {
159            var b = new Image;
160            b.src = this.album[this.currentImageIndex - 1].link
161        }
162    }, b.prototype.enableKeyboardNav = function() {
163        a(document).on("keyup.keyboard", a.proxy(this.keyboardAction, this))
164    }, b.prototype.disableKeyboardNav = function() {
165        a(document).off(".keyboard")
166    }, b.prototype.keyboardAction = function(a) {
167        var b = 27,
168            c = 37,
169            d = 39,
170            e = a.keyCode,
171            f = String.fromCharCode(e).toLowerCase();
172        e === b || f.match(/x|o|c/) ? this.end() : "p" === f || e === c ? 0 !== this.currentImageIndex ? this.changeImage(this.currentImageIndex - 1) : this.options.wrapAround && this.album.length > 1 && this.changeImage(this.album.length - 1) : ("n" === f || e === d) && (this.currentImageIndex !== this.album.length - 1 ? this.changeImage(this.currentImageIndex + 1) : this.options.wrapAround && this.album.length > 1 && this.changeImage(0))
173    }, b.prototype.end = function() {
174        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({
175            visibility: "visible"
176        }), this.options.disableScrolling && a("body").removeClass("lb-disable-scrolling")
177    }, new b
178});
179//# sourceMappingURL=lightbox.min.map

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.