/*! * baguetteBox.js * @author feimosi * @version 1.1.1 * @url https://github.com/feimosi/baguetteBox.js */ var baguetteBox = function() { function t(t, n) { L.transforms = f(), L.svg = p(), e(), D = document.querySelectorAll(t), [].forEach.call(D, function(t) { var e = t.getElementsByTagName("a"); e = [].filter.call(e, function(t) { return j.test(t.getAttribute("data-img")) }); var o = S.length; S.push(e), S[o].options = n, [].forEach.call(S[o], function(t, e) { h(t, "click", function(t) { t.preventDefault ? t.preventDefault() : t.returnValue = !1, i(o), a(e) $(".garltex").show(); }) }) }) } function e() { return (b = v("baguetteBox-overlay")) ? (k = v("baguetteBox-slider"), w = v("previous-button"), C = v("next-button"), void(T = v("close-button"))) : (b = y("div"), b.id = "baguetteBox-overlay", document.getElementsByTagName("body")[0].appendChild(b), k = y("div"), k.id = "baguetteBox-slider", b.appendChild(k), w = y("button"), w.id = "previous-button", w.innerHTML = L.svg ? E: "<", b.appendChild(w), C = y("button"), C.id = "next-button", C.innerHTML = L.svg ? x: ">", b.appendChild(C), T = y("button"), T.id = "close-button", T.innerHTML = L.svg ? B: "X", b.appendChild(T), w.className = C.className = T.className = "baguetteBox-button", void n()) } function n() { h(b, "click", function(t) { t.target && "IMG" !== t.target.nodeName && "FIGCAPTION" !== t.target.nodeName && s() }), h(w, "click", function(t) { t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0, c() }), h(C, "click", function(t) { t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0, u() }), h(T, "click", function(t) { t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0, s() }), h(b, "touchstart", function(t) { N = t.changedTouches[0].pageX }), h(b, "touchmove", function(t) { H || (t.preventDefault ? t.preventDefault() : t.returnValue = !1, touch = t.touches[0] || t.changedTouches[0], touch.pageX - N > 40 ? (H = !0, c()) : touch.pageX - N < -40 && (H = !0, u())) }), h(b, "touchend", function() { H = !1 }), h(document, "keydown", function(t) { switch (t.keyCode) { case 37: c(); break; case 39: u(); break; case 27: s() } }) } function i(t) { if (A !== t) { for (A = t, o(S[t].options); k.firstChild;) k.removeChild(k.firstChild); X.length = 0; for (var e, n = 0; n < S[t].length; n++) e = y("div"), e.className = "full-image", e.id = "baguette-img-" + n, X.push(e), k.appendChild(X[n]) } } function o(t) { t || (t = {}); for (var e in P) I[e] = P[e], "undefined" != typeof t[e] && (I[e] = t[e]); k.style.transition = k.style.webkitTransition = "fadeIn" === I.animation ? "opacity .4s ease": "slideIn" === I.animation ? "": "none", "auto" === I.buttons && ("ontouchstart" in window || 1 === S[A].length) && (I.buttons = !1), w.style.display = C.style.display = I.buttons ? "": "none" } function a(t) { "block" !== b.style.display && (M = t, r(M, function() { g(M), m(M) }), d(), b.style.display = "block", setTimeout(function() { b.className = "visible" }, 50)) } function s() { $(".garltex").hide(); "none" !== b.style.display && (b.className = "", setTimeout(function() { b.style.display = "none" }, 500)) } function r(t, e) { var n = X[t]; if ("undefined" != typeof n) { if (n.getElementsByTagName("img")[0]) return void(e && e()); imageElement = S[A][t], imageCaption = imageElement.getAttribute("data-caption") || imageElement.title, imageSrc = l(imageElement); var i = y("figure"), o = y("img"), a = y("figcaption"); n.appendChild(i), i.innerHTML = '