jquery.magnific-popup.min.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. /*! Magnific Popup - v0.9.9 - 2013-12-27
  2. * http://dimsemenov.com/plugins/magnific-popup/
  3. * Copyright (c) 2013 Dmitry Semenov; */
  4. (function (e) {
  5. var t, n, i, o, r, a, s, l = "Close", c = "BeforeClose", d = "AfterClose", u = "BeforeAppend", p = "MarkupParse", f = "Open", m = "Change", g = "mfp", h = "." + g, v = "mfp-ready", C = "mfp-removing", y = "mfp-prevent-close", w = function () {
  6. }, b = !!window.jQuery, I = e(window), x = function (e, n) {
  7. t.ev.on(g + e + h, n)
  8. }, k = function (t, n, i, o) {
  9. var r = document.createElement("div");
  10. return r.className = "mfp-" + t, i && (r.innerHTML = i), o ? n && n.appendChild(r) : (r = e(r), n && r.appendTo(n)), r
  11. }, T = function (n, i) {
  12. t.ev.triggerHandler(g + n, i), t.st.callbacks && (n = n.charAt(0).toLowerCase() + n.slice(1), t.st.callbacks[n] && t.st.callbacks[n].apply(t, e.isArray(i) ? i : [i]))
  13. }, E = function (n) {
  14. return n === s && t.currTemplate.closeBtn || (t.currTemplate.closeBtn = e(t.st.closeMarkup.replace("%title%", t.st.tClose)), s = n), t.currTemplate.closeBtn
  15. }, _ = function () {
  16. e.magnificPopup.instance || (t = new w, t.init(), e.magnificPopup.instance = t)
  17. }, S = function () {
  18. var e = document.createElement("p").style, t = ["ms", "O", "Moz", "Webkit"];
  19. if (void 0 !== e.transition)return !0;
  20. for (; t.length;)if (t.pop() + "Transition"in e)return !0;
  21. return !1
  22. };
  23. w.prototype = {
  24. constructor: w, init: function () {
  25. var n = navigator.appVersion;
  26. t.isIE7 = -1 !== n.indexOf("MSIE 7."), t.isIE8 = -1 !== n.indexOf("MSIE 8."), t.isLowIE = t.isIE7 || t.isIE8, t.isAndroid = /android/gi.test(n), t.isIOS = /iphone|ipad|ipod/gi.test(n), t.supportsTransition = S(), t.probablyMobile = t.isAndroid || t.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent), o = e(document), t.popupsCache = {}
  27. }, open: function (n) {
  28. i || (i = e(document.body));
  29. var r;
  30. if (n.isObj === !1) {
  31. t.items = n.items.toArray(), t.index = 0;
  32. var s, l = n.items;
  33. for (r = 0; l.length > r; r++)if (s = l[r], s.parsed && (s = s.el[0]), s === n.el[0]) {
  34. t.index = r;
  35. break
  36. }
  37. } else t.items = e.isArray(n.items) ? n.items : [n.items], t.index = n.index || 0;
  38. if (t.isOpen)return t.updateItemHTML(), void 0;
  39. t.types = [], a = "", t.ev = n.mainEl && n.mainEl.length ? n.mainEl.eq(0) : o, n.key ? (t.popupsCache[n.key] || (t.popupsCache[n.key] = {}), t.currTemplate = t.popupsCache[n.key]) : t.currTemplate = {}, t.st = e.extend(!0, {}, e.magnificPopup.defaults, n), t.fixedContentPos = "auto" === t.st.fixedContentPos ? !t.probablyMobile : t.st.fixedContentPos, t.st.modal && (t.st.closeOnContentClick = !1, t.st.closeOnBgClick = !1, t.st.showCloseBtn = !1, t.st.enableEscapeKey = !1), t.bgOverlay || (t.bgOverlay = k("bg").on("click" + h, function () {
  40. t.close()
  41. }), t.wrap = k("wrap").attr("tabindex", -1).on("click" + h, function (e) {
  42. t._checkIfClose(e.target) && t.close()
  43. }), t.container = k("container", t.wrap)), t.contentContainer = k("content"), t.st.preloader && (t.preloader = k("preloader", t.container, t.st.tLoading));
  44. var c = e.magnificPopup.modules;
  45. for (r = 0; c.length > r; r++) {
  46. var d = c[r];
  47. d = d.charAt(0).toUpperCase() + d.slice(1), t["init" + d].call(t)
  48. }
  49. T("BeforeOpen"), t.st.showCloseBtn && (t.st.closeBtnInside ? (x(p, function (e, t, n, i) {
  50. n.close_replaceWith = E(i.type)
  51. }), a += " mfp-close-btn-in") : t.wrap.append(E())), t.st.alignTop && (a += " mfp-align-top"), t.fixedContentPos ? t.wrap.css({
  52. overflow: t.st.overflowY,
  53. overflowX: "hidden",
  54. overflowY: t.st.overflowY
  55. }) : t.wrap.css({
  56. top: I.scrollTop(),
  57. position: "absolute"
  58. }), (t.st.fixedBgPos === !1 || "auto" === t.st.fixedBgPos && !t.fixedContentPos) && t.bgOverlay.css({
  59. height: o.height(),
  60. position: "absolute"
  61. }), t.st.enableEscapeKey && o.on("keyup" + h, function (e) {
  62. 27 === e.keyCode && t.close()
  63. }), I.on("resize" + h, function () {
  64. t.updateSize()
  65. }), t.st.closeOnContentClick || (a += " mfp-auto-cursor"), a && t.wrap.addClass(a);
  66. var u = t.wH = I.height(), m = {};
  67. if (t.fixedContentPos && t._hasScrollBar(u)) {
  68. var g = t._getScrollbarSize();
  69. g && (m.marginRight = g)
  70. }
  71. t.fixedContentPos && (t.isIE7 ? e("body, html").css("overflow", "hidden") : m.overflow = "hidden");
  72. var C = t.st.mainClass;
  73. return t.isIE7 && (C += " mfp-ie7"), C && t._addClassToMFP(C), t.updateItemHTML(), T("BuildControls"), e("html").css(m), t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo || i), t._lastFocusedEl = document.activeElement, setTimeout(function () {
  74. t.content ? (t._addClassToMFP(v), t._setFocus()) : t.bgOverlay.addClass(v), o.on("focusin" + h, t._onFocusIn)
  75. }, 16), t.isOpen = !0, t.updateSize(u), T(f), n
  76. }, close: function () {
  77. t.isOpen && (T(c), t.isOpen = !1, t.st.removalDelay && !t.isLowIE && t.supportsTransition ? (t._addClassToMFP(C), setTimeout(function () {
  78. t._close()
  79. }, t.st.removalDelay)) : t._close())
  80. }, _close: function () {
  81. T(l);
  82. var n = C + " " + v + " ";
  83. if (t.bgOverlay.detach(), t.wrap.detach(), t.container.empty(), t.st.mainClass && (n += t.st.mainClass + " "), t._removeClassFromMFP(n), t.fixedContentPos) {
  84. var i = {marginRight: ""};
  85. t.isIE7 ? e("body, html").css("overflow", "") : i.overflow = "", e("html").css(i)
  86. }
  87. o.off("keyup" + h + " focusin" + h), t.ev.off(h), t.wrap.attr("class", "mfp-wrap").removeAttr("style"), t.bgOverlay.attr("class", "mfp-bg"), t.container.attr("class", "mfp-container"), !t.st.showCloseBtn || t.st.closeBtnInside && t.currTemplate[t.currItem.type] !== !0 || t.currTemplate.closeBtn && t.currTemplate.closeBtn.detach(), t._lastFocusedEl && e(t._lastFocusedEl).focus(), t.currItem = null, t.content = null, t.currTemplate = null, t.prevHeight = 0, T(d)
  88. }, updateSize: function (e) {
  89. if (t.isIOS) {
  90. var n = document.documentElement.clientWidth / window.innerWidth, i = window.innerHeight * n;
  91. t.wrap.css("height", i), t.wH = i
  92. } else t.wH = e || I.height();
  93. t.fixedContentPos || t.wrap.css("height", t.wH), T("Resize")
  94. }, updateItemHTML: function () {
  95. var n = t.items[t.index];
  96. t.contentContainer.detach(), t.content && t.content.detach(), n.parsed || (n = t.parseEl(t.index));
  97. var i = n.type;
  98. if (T("BeforeChange", [t.currItem ? t.currItem.type : "", i]), t.currItem = n, !t.currTemplate[i]) {
  99. var o = t.st[i] ? t.st[i].markup : !1;
  100. T("FirstMarkupParse", o), t.currTemplate[i] = o ? e(o) : !0
  101. }
  102. r && r !== n.type && t.container.removeClass("mfp-" + r + "-holder");
  103. var a = t["get" + i.charAt(0).toUpperCase() + i.slice(1)](n, t.currTemplate[i]);
  104. t.appendContent(a, i), n.preloaded = !0, T(m, n), r = n.type, t.container.prepend(t.contentContainer), T("AfterChange")
  105. }, appendContent: function (e, n) {
  106. t.content = e, e ? t.st.showCloseBtn && t.st.closeBtnInside && t.currTemplate[n] === !0 ? t.content.find(".mfp-close").length || t.content.append(E()) : t.content = e : t.content = "", T(u), t.container.addClass("mfp-" + n + "-holder"), t.contentContainer.append(t.content)
  107. }, parseEl: function (n) {
  108. var i, o = t.items[n];
  109. if (o.tagName ? o = {el: e(o)} : (i = o.type, o = {data: o, src: o.src}), o.el) {
  110. for (var r = t.types, a = 0; r.length > a; a++)if (o.el.hasClass("mfp-" + r[a])) {
  111. i = r[a];
  112. break
  113. }
  114. o.src = o.el.attr("data-mfp-src"), o.src || (o.src = o.el.attr("href"))
  115. }
  116. return o.type = i || t.st.type || "inline", o.index = n, o.parsed = !0, t.items[n] = o, T("ElementParse", o), t.items[n]
  117. }, addGroup: function (e, n) {
  118. var i = function (i) {
  119. i.mfpEl = this, t._openClick(i, e, n)
  120. };
  121. n || (n = {});
  122. var o = "click.magnificPopup";
  123. n.mainEl = e, n.items ? (n.isObj = !0, e.off(o).on(o, i)) : (n.isObj = !1, n.delegate ? e.off(o).on(o, n.delegate, i) : (n.items = e, e.off(o).on(o, i)))
  124. }, _openClick: function (n, i, o) {
  125. var r = void 0 !== o.midClick ? o.midClick : e.magnificPopup.defaults.midClick;
  126. if (r || 2 !== n.which && !n.ctrlKey && !n.metaKey) {
  127. var a = void 0 !== o.disableOn ? o.disableOn : e.magnificPopup.defaults.disableOn;
  128. if (a)if (e.isFunction(a)) {
  129. if (!a.call(t))return !0
  130. } else if (a > I.width())return !0;
  131. n.type && (n.preventDefault(), t.isOpen && n.stopPropagation()), o.el = e(n.mfpEl), o.delegate && (o.items = i.find(o.delegate)), t.open(o)
  132. }
  133. }, updateStatus: function (e, i) {
  134. if (t.preloader) {
  135. n !== e && t.container.removeClass("mfp-s-" + n), i || "loading" !== e || (i = t.st.tLoading);
  136. var o = {status: e, text: i};
  137. T("UpdateStatus", o), e = o.status, i = o.text, t.preloader.html(i), t.preloader.find("a").on("click", function (e) {
  138. e.stopImmediatePropagation()
  139. }), t.container.addClass("mfp-s-" + e), n = e
  140. }
  141. }, _checkIfClose: function (n) {
  142. if (!e(n).hasClass(y)) {
  143. var i = t.st.closeOnContentClick, o = t.st.closeOnBgClick;
  144. if (i && o)return !0;
  145. if (!t.content || e(n).hasClass("mfp-close") || t.preloader && n === t.preloader[0])return !0;
  146. if (n === t.content[0] || e.contains(t.content[0], n)) {
  147. if (i)return !0
  148. } else if (o && e.contains(document, n))return !0;
  149. return !1
  150. }
  151. }, _addClassToMFP: function (e) {
  152. t.bgOverlay.addClass(e), t.wrap.addClass(e)
  153. }, _removeClassFromMFP: function (e) {
  154. this.bgOverlay.removeClass(e), t.wrap.removeClass(e)
  155. }, _hasScrollBar: function (e) {
  156. return (t.isIE7 ? o.height() : document.body.scrollHeight) > (e || I.height())
  157. }, _setFocus: function () {
  158. (t.st.focus ? t.content.find(t.st.focus).eq(0) : t.wrap).focus()
  159. }, _onFocusIn: function (n) {
  160. return n.target === t.wrap[0] || e.contains(t.wrap[0], n.target) ? void 0 : (t._setFocus(), !1)
  161. }, _parseMarkup: function (t, n, i) {
  162. var o;
  163. i.data && (n = e.extend(i.data, n)), T(p, [t, n, i]), e.each(n, function (e, n) {
  164. if (void 0 === n || n === !1)return !0;
  165. if (o = e.split("_"), o.length > 1) {
  166. var i = t.find(h + "-" + o[0]);
  167. if (i.length > 0) {
  168. var r = o[1];
  169. "replaceWith" === r ? i[0] !== n[0] && i.replaceWith(n) : "img" === r ? i.is("img") ? i.attr("src", n) : i.replaceWith('<img src="' + n + '" class="' + i.attr("class") + '" />') : i.attr(o[1], n)
  170. }
  171. } else t.find(h + "-" + e).html(n)
  172. })
  173. }, _getScrollbarSize: function () {
  174. if (void 0 === t.scrollbarSize) {
  175. var e = document.createElement("div");
  176. e.id = "mfp-sbm", e.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;", document.body.appendChild(e), t.scrollbarSize = e.offsetWidth - e.clientWidth, document.body.removeChild(e)
  177. }
  178. return t.scrollbarSize
  179. }
  180. }, e.magnificPopup = {
  181. instance: null,
  182. proto: w.prototype,
  183. modules: [],
  184. open: function (t, n) {
  185. return _(), t = t ? e.extend(!0, {}, t) : {}, t.isObj = !0, t.index = n || 0, this.instance.open(t)
  186. },
  187. close: function () {
  188. return e.magnificPopup.instance && e.magnificPopup.instance.close()
  189. },
  190. registerModule: function (t, n) {
  191. n.options && (e.magnificPopup.defaults[t] = n.options), e.extend(this.proto, n.proto), this.modules.push(t)
  192. },
  193. defaults: {
  194. disableOn: 0,
  195. key: null,
  196. midClick: !1,
  197. mainClass: "",
  198. preloader: !0,
  199. focus: "",
  200. closeOnContentClick: !1,
  201. closeOnBgClick: !0,
  202. closeBtnInside: !0,
  203. showCloseBtn: !0,
  204. enableEscapeKey: !0,
  205. modal: !1,
  206. alignTop: !1,
  207. removalDelay: 0,
  208. prependTo: null,
  209. fixedContentPos: "auto",
  210. fixedBgPos: "auto",
  211. overflowY: "auto",
  212. closeMarkup: '<button title="%title%" type="button" class="mfp-close">&times;</button>',
  213. tClose: "Close (Esc)",
  214. tLoading: "Loading..."
  215. }
  216. }, e.fn.magnificPopup = function (n) {
  217. _();
  218. var i = e(this);
  219. if ("string" == typeof n)if ("open" === n) {
  220. var o, r = b ? i.data("magnificPopup") : i[0].magnificPopup, a = parseInt(arguments[1], 10) || 0;
  221. r.items ? o = r.items[a] : (o = i, r.delegate && (o = o.find(r.delegate)), o = o.eq(a)), t._openClick({mfpEl: o}, i, r)
  222. } else t.isOpen && t[n].apply(t, Array.prototype.slice.call(arguments, 1)); else n = e.extend(!0, {}, n), b ? i.data("magnificPopup", n) : i[0].magnificPopup = n, t.addGroup(i, n);
  223. return i
  224. };
  225. var P, O, z, M = "inline", B = function () {
  226. z && (O.after(z.addClass(P)).detach(), z = null)
  227. };
  228. e.magnificPopup.registerModule(M, {
  229. options: {hiddenClass: "hide", markup: "", tNotFound: "Content not found"},
  230. proto: {
  231. initInline: function () {
  232. t.types.push(M), x(l + "." + M, function () {
  233. B()
  234. })
  235. }, getInline: function (n, i) {
  236. if (B(), n.src) {
  237. var o = t.st.inline, r = e(n.src);
  238. if (r.length) {
  239. var a = r[0].parentNode;
  240. a && a.tagName && (O || (P = o.hiddenClass, O = k(P), P = "mfp-" + P), z = r.after(O).detach().removeClass(P)), t.updateStatus("ready")
  241. } else t.updateStatus("error", o.tNotFound), r = e("<div>");
  242. return n.inlineElement = r, r
  243. }
  244. return t.updateStatus("ready"), t._parseMarkup(i, {}, n), i
  245. }
  246. }
  247. });
  248. var F, H = "ajax", L = function () {
  249. F && i.removeClass(F)
  250. }, A = function () {
  251. L(), t.req && t.req.abort()
  252. };
  253. e.magnificPopup.registerModule(H, {
  254. options: {
  255. settings: null,
  256. cursor: "mfp-ajax-cur",
  257. tError: '<a href="%url%">The content</a> could not be loaded.'
  258. }, proto: {
  259. initAjax: function () {
  260. t.types.push(H), F = t.st.ajax.cursor, x(l + "." + H, A), x("BeforeChange." + H, A)
  261. }, getAjax: function (n) {
  262. F && i.addClass(F), t.updateStatus("loading");
  263. var o = e.extend({
  264. url: n.src, success: function (i, o, r) {
  265. var a = {data: i, xhr: r};
  266. T("ParseAjax", a), t.appendContent(e(a.data), H), n.finished = !0, L(), t._setFocus(), setTimeout(function () {
  267. t.wrap.addClass(v)
  268. }, 16), t.updateStatus("ready"), T("AjaxContentAdded")
  269. }, error: function () {
  270. L(), n.finished = n.loadError = !0, t.updateStatus("error", t.st.ajax.tError.replace("%url%", n.src))
  271. }
  272. }, t.st.ajax.settings);
  273. return t.req = e.ajax(o), ""
  274. }
  275. }
  276. });
  277. var j, N = function (n) {
  278. if (n.data && void 0 !== n.data.title)return n.data.title;
  279. var i = t.st.image.titleSrc;
  280. if (i) {
  281. if (e.isFunction(i))return i.call(t, n);
  282. if (n.el)return n.el.attr(i) || ""
  283. }
  284. return ""
  285. };
  286. e.magnificPopup.registerModule("image", {
  287. options: {
  288. markup: '<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',
  289. cursor: "mfp-zoom-out-cur",
  290. titleSrc: "title",
  291. verticalFit: !0,
  292. tError: '<a href="%url%">The image</a> could not be loaded.'
  293. }, proto: {
  294. initImage: function () {
  295. var e = t.st.image, n = ".image";
  296. t.types.push("image"), x(f + n, function () {
  297. "image" === t.currItem.type && e.cursor && i.addClass(e.cursor)
  298. }), x(l + n, function () {
  299. e.cursor && i.removeClass(e.cursor), I.off("resize" + h)
  300. }), x("Resize" + n, t.resizeImage), t.isLowIE && x("AfterChange", t.resizeImage)
  301. }, resizeImage: function () {
  302. var e = t.currItem;
  303. if (e && e.img && t.st.image.verticalFit) {
  304. var n = 0;
  305. t.isLowIE && (n = parseInt(e.img.css("padding-top"), 10) + parseInt(e.img.css("padding-bottom"), 10)), e.img.css("max-height", t.wH - n)
  306. }
  307. }, _onImageHasSize: function (e) {
  308. e.img && (e.hasSize = !0, j && clearInterval(j), e.isCheckingImgSize = !1, T("ImageHasSize", e), e.imgHidden && (t.content && t.content.removeClass("mfp-loading"), e.imgHidden = !1))
  309. }, findImageSize: function (e) {
  310. var n = 0, i = e.img[0], o = function (r) {
  311. j && clearInterval(j), j = setInterval(function () {
  312. return i.naturalWidth > 0 ? (t._onImageHasSize(e), void 0) : (n > 200 && clearInterval(j), n++, 3 === n ? o(10) : 40 === n ? o(50) : 100 === n && o(500), void 0)
  313. }, r)
  314. };
  315. o(1)
  316. }, getImage: function (n, i) {
  317. var o = 0, r = function () {
  318. n && (n.img[0].complete ? (n.img.off(".mfploader"), n === t.currItem && (t._onImageHasSize(n), t.updateStatus("ready")), n.hasSize = !0, n.loaded = !0, T("ImageLoadComplete")) : (o++, 200 > o ? setTimeout(r, 100) : a()))
  319. }, a = function () {
  320. n && (n.img.off(".mfploader"), n === t.currItem && (t._onImageHasSize(n), t.updateStatus("error", s.tError.replace("%url%", n.src))), n.hasSize = !0, n.loaded = !0, n.loadError = !0)
  321. }, s = t.st.image, l = i.find(".mfp-img");
  322. if (l.length) {
  323. var c = document.createElement("img");
  324. c.className = "mfp-img", n.img = e(c).on("load.mfploader", r).on("error.mfploader", a), c.src = n.src, l.is("img") && (n.img = n.img.clone()), c = n.img[0], c.naturalWidth > 0 ? n.hasSize = !0 : c.width || (n.hasSize = !1)
  325. }
  326. return t._parseMarkup(i, {
  327. title: N(n),
  328. img_replaceWith: n.img
  329. }, n), t.resizeImage(), n.hasSize ? (j && clearInterval(j), n.loadError ? (i.addClass("mfp-loading"), t.updateStatus("error", s.tError.replace("%url%", n.src))) : (i.removeClass("mfp-loading"), t.updateStatus("ready")), i) : (t.updateStatus("loading"), n.loading = !0, n.hasSize || (n.imgHidden = !0, i.addClass("mfp-loading"), t.findImageSize(n)), i)
  330. }
  331. }
  332. });
  333. var W, R = function () {
  334. return void 0 === W && (W = void 0 !== document.createElement("p").style.MozTransform), W
  335. };
  336. e.magnificPopup.registerModule("zoom", {
  337. options: {
  338. enabled: !1,
  339. easing: "ease-in-out",
  340. duration: 300,
  341. opener: function (e) {
  342. return e.is("img") ? e : e.find("img")
  343. }
  344. }, proto: {
  345. initZoom: function () {
  346. var e, n = t.st.zoom, i = ".zoom";
  347. if (n.enabled && t.supportsTransition) {
  348. var o, r, a = n.duration, s = function (e) {
  349. var t = e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"), i = "all " + n.duration / 1e3 + "s " + n.easing, o = {
  350. position: "fixed",
  351. zIndex: 9999,
  352. left: 0,
  353. top: 0,
  354. "-webkit-backface-visibility": "hidden"
  355. }, r = "transition";
  356. return o["-webkit-" + r] = o["-moz-" + r] = o["-o-" + r] = o[r] = i, t.css(o), t
  357. }, d = function () {
  358. t.content.css("visibility", "visible")
  359. };
  360. x("BuildControls" + i, function () {
  361. if (t._allowZoom()) {
  362. if (clearTimeout(o), t.content.css("visibility", "hidden"), e = t._getItemToZoom(), !e)return d(), void 0;
  363. r = s(e), r.css(t._getOffset()), t.wrap.append(r), o = setTimeout(function () {
  364. r.css(t._getOffset(!0)), o = setTimeout(function () {
  365. d(), setTimeout(function () {
  366. r.remove(), e = r = null, T("ZoomAnimationEnded")
  367. }, 16)
  368. }, a)
  369. }, 16)
  370. }
  371. }), x(c + i, function () {
  372. if (t._allowZoom()) {
  373. if (clearTimeout(o), t.st.removalDelay = a, !e) {
  374. if (e = t._getItemToZoom(), !e)return;
  375. r = s(e)
  376. }
  377. r.css(t._getOffset(!0)), t.wrap.append(r), t.content.css("visibility", "hidden"), setTimeout(function () {
  378. r.css(t._getOffset())
  379. }, 16)
  380. }
  381. }), x(l + i, function () {
  382. t._allowZoom() && (d(), r && r.remove(), e = null)
  383. })
  384. }
  385. }, _allowZoom: function () {
  386. return "image" === t.currItem.type
  387. }, _getItemToZoom: function () {
  388. return t.currItem.hasSize ? t.currItem.img : !1
  389. }, _getOffset: function (n) {
  390. var i;
  391. i = n ? t.currItem.img : t.st.zoom.opener(t.currItem.el || t.currItem);
  392. var o = i.offset(), r = parseInt(i.css("padding-top"), 10), a = parseInt(i.css("padding-bottom"), 10);
  393. o.top -= e(window).scrollTop() - r;
  394. var s = {width: i.width(), height: (b ? i.innerHeight() : i[0].offsetHeight) - a - r};
  395. return R() ? s["-moz-transform"] = s.transform = "translate(" + o.left + "px," + o.top + "px)" : (s.left = o.left, s.top = o.top), s
  396. }
  397. }
  398. });
  399. var Z = "iframe", q = "//about:blank", D = function (e) {
  400. if (t.currTemplate[Z]) {
  401. var n = t.currTemplate[Z].find("iframe");
  402. n.length && (e || (n[0].src = q), t.isIE8 && n.css("display", e ? "block" : "none"))
  403. }
  404. };
  405. e.magnificPopup.registerModule(Z, {
  406. options: {
  407. markup: '<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',
  408. srcAction: "iframe_src",
  409. patterns: {
  410. youtube: {index: "youtube.com", id: "v=", src: "//www.youtube.com/embed/%id%?autoplay=1"},
  411. vimeo: {index: "vimeo.com/", id: "/", src: "//player.vimeo.com/video/%id%?autoplay=1"},
  412. gmaps: {index: "//maps.google.", src: "%id%&output=embed"}
  413. }
  414. }, proto: {
  415. initIframe: function () {
  416. t.types.push(Z), x("BeforeChange", function (e, t, n) {
  417. t !== n && (t === Z ? D() : n === Z && D(!0))
  418. }), x(l + "." + Z, function () {
  419. D()
  420. })
  421. }, getIframe: function (n, i) {
  422. var o = n.src, r = t.st.iframe;
  423. e.each(r.patterns, function () {
  424. return o.indexOf(this.index) > -1 ? (this.id && (o = "string" == typeof this.id ? o.substr(o.lastIndexOf(this.id) + this.id.length, o.length) : this.id.call(this, o)), o = this.src.replace("%id%", o), !1) : void 0
  425. });
  426. var a = {};
  427. return r.srcAction && (a[r.srcAction] = o), t._parseMarkup(i, a, n), t.updateStatus("ready"), i
  428. }
  429. }
  430. });
  431. var K = function (e) {
  432. var n = t.items.length;
  433. return e > n - 1 ? e - n : 0 > e ? n + e : e
  434. }, Y = function (e, t, n) {
  435. return e.replace(/%curr%/gi, t + 1).replace(/%total%/gi, n)
  436. };
  437. e.magnificPopup.registerModule("gallery", {
  438. options: {
  439. enabled: !1,
  440. arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
  441. preload: [0, 2],
  442. navigateByImgClick: !0,
  443. arrows: !0,
  444. tPrev: "Previous (Left arrow key)",
  445. tNext: "Next (Right arrow key)",
  446. tCounter: "%curr% of %total%"
  447. }, proto: {
  448. initGallery: function () {
  449. var n = t.st.gallery, i = ".mfp-gallery", r = Boolean(e.fn.mfpFastClick);
  450. return t.direction = !0, n && n.enabled ? (a += " mfp-gallery", x(f + i, function () {
  451. n.navigateByImgClick && t.wrap.on("click" + i, ".mfp-img", function () {
  452. return t.items.length > 1 ? (t.next(), !1) : void 0
  453. }), o.on("keydown" + i, function (e) {
  454. 37 === e.keyCode ? t.prev() : 39 === e.keyCode && t.next()
  455. })
  456. }), x("UpdateStatus" + i, function (e, n) {
  457. n.text && (n.text = Y(n.text, t.currItem.index, t.items.length))
  458. }), x(p + i, function (e, i, o, r) {
  459. var a = t.items.length;
  460. o.counter = a > 1 ? Y(n.tCounter, r.index, a) : ""
  461. }), x("BuildControls" + i, function () {
  462. if (t.items.length > 1 && n.arrows && !t.arrowLeft) {
  463. var i = n.arrowMarkup, o = t.arrowLeft = e(i.replace(/%title%/gi, n.tPrev).replace(/%dir%/gi, "left")).addClass(y), a = t.arrowRight = e(i.replace(/%title%/gi, n.tNext).replace(/%dir%/gi, "right")).addClass(y), s = r ? "mfpFastClick" : "click";
  464. o[s](function () {
  465. t.prev()
  466. }), a[s](function () {
  467. t.next()
  468. }), t.isIE7 && (k("b", o[0], !1, !0), k("a", o[0], !1, !0), k("b", a[0], !1, !0), k("a", a[0], !1, !0)), t.container.append(o.add(a))
  469. }
  470. }), x(m + i, function () {
  471. t._preloadTimeout && clearTimeout(t._preloadTimeout), t._preloadTimeout = setTimeout(function () {
  472. t.preloadNearbyImages(), t._preloadTimeout = null
  473. }, 16)
  474. }), x(l + i, function () {
  475. o.off(i), t.wrap.off("click" + i), t.arrowLeft && r && t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(), t.arrowRight = t.arrowLeft = null
  476. }), void 0) : !1
  477. }, next: function () {
  478. t.direction = !0, t.index = K(t.index + 1), t.updateItemHTML()
  479. }, prev: function () {
  480. t.direction = !1, t.index = K(t.index - 1), t.updateItemHTML()
  481. }, goTo: function (e) {
  482. t.direction = e >= t.index, t.index = e, t.updateItemHTML()
  483. }, preloadNearbyImages: function () {
  484. var e, n = t.st.gallery.preload, i = Math.min(n[0], t.items.length), o = Math.min(n[1], t.items.length);
  485. for (e = 1; (t.direction ? o : i) >= e; e++)t._preloadItem(t.index + e);
  486. for (e = 1; (t.direction ? i : o) >= e; e++)t._preloadItem(t.index - e)
  487. }, _preloadItem: function (n) {
  488. if (n = K(n), !t.items[n].preloaded) {
  489. var i = t.items[n];
  490. i.parsed || (i = t.parseEl(n)), T("LazyLoad", i), "image" === i.type && (i.img = e('<img class="mfp-img" />').on("load.mfploader", function () {
  491. i.hasSize = !0
  492. }).on("error.mfploader", function () {
  493. i.hasSize = !0, i.loadError = !0, T("LazyLoadError", i)
  494. }).attr("src", i.src)), i.preloaded = !0
  495. }
  496. }
  497. }
  498. });
  499. var U = "retina";
  500. e.magnificPopup.registerModule(U, {
  501. options: {
  502. replaceSrc: function (e) {
  503. return e.src.replace(/\.\w+$/, function (e) {
  504. return "@2x" + e
  505. })
  506. }, ratio: 1
  507. }, proto: {
  508. initRetina: function () {
  509. if (window.devicePixelRatio > 1) {
  510. var e = t.st.retina, n = e.ratio;
  511. n = isNaN(n) ? n() : n, n > 1 && (x("ImageHasSize." + U, function (e, t) {
  512. t.img.css({"max-width": t.img[0].naturalWidth / n, width: "100%"})
  513. }), x("ElementParse." + U, function (t, i) {
  514. i.src = e.replaceSrc(i, n)
  515. }))
  516. }
  517. }
  518. }
  519. }), function () {
  520. var t = 1e3, n = "ontouchstart"in window, i = function () {
  521. I.off("touchmove" + r + " touchend" + r)
  522. }, o = "mfpFastClick", r = "." + o;
  523. e.fn.mfpFastClick = function (o) {
  524. return e(this).each(function () {
  525. var a, s = e(this);
  526. if (n) {
  527. var l, c, d, u, p, f;
  528. s.on("touchstart" + r, function (e) {
  529. u = !1, f = 1, p = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0], c = p.clientX, d = p.clientY, I.on("touchmove" + r, function (e) {
  530. p = e.originalEvent ? e.originalEvent.touches : e.touches, f = p.length, p = p[0], (Math.abs(p.clientX - c) > 10 || Math.abs(p.clientY - d) > 10) && (u = !0, i())
  531. }).on("touchend" + r, function (e) {
  532. i(), u || f > 1 || (a = !0, e.preventDefault(), clearTimeout(l), l = setTimeout(function () {
  533. a = !1
  534. }, t), o())
  535. })
  536. })
  537. }
  538. s.on("click" + r, function () {
  539. a || o()
  540. })
  541. })
  542. }, e.fn.destroyMfpFastClick = function () {
  543. e(this).off("touchstart" + r + " click" + r), n && I.off("touchmove" + r + " touchend" + r)
  544. }
  545. }(), _()
  546. })(window.jQuery || window.Zepto);