jquery.blueimp-gallery.min.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. !function (t) {
  2. "use strict";
  3. "function" == typeof define && define.amd ? define(["./blueimp-helper"], t) : (window.blueimp = window.blueimp || {}, window.blueimp.Gallery = t(window.blueimp.helper || window.jQuery))
  4. }(function (d) {
  5. "use strict";
  6. function i(t, e) {
  7. return void 0 === document.body.style.maxHeight ? null : this && this.options === i.prototype.options ? void (t && t.length ? (this.list = t, this.num = t.length, this.initOptions(e), this.initialize()) : this.console.log("blueimp Gallery: No or empty list provided as first argument.", t)) : new i(t, e)
  8. }
  9. return d.extend(i.prototype, {
  10. options: {
  11. container: "#blueimp-gallery",
  12. slidesContainer: "div",
  13. titleElement: "h3",
  14. displayClass: "blueimp-gallery-display",
  15. controlsClass: "blueimp-gallery-controls",
  16. singleClass: "blueimp-gallery-single",
  17. leftEdgeClass: "blueimp-gallery-left",
  18. rightEdgeClass: "blueimp-gallery-right",
  19. playingClass: "blueimp-gallery-playing",
  20. slideClass: "slide",
  21. slideLoadingClass: "slide-loading",
  22. slideErrorClass: "slide-error",
  23. slideContentClass: "slide-content",
  24. toggleClass: "toggle",
  25. prevClass: "prev",
  26. nextClass: "next",
  27. closeClass: "close",
  28. playPauseClass: "play-pause",
  29. typeProperty: "type",
  30. titleProperty: "title",
  31. altTextProperty: "alt",
  32. urlProperty: "href",
  33. srcsetProperty: "urlset",
  34. displayTransition: !0,
  35. clearSlides: !0,
  36. stretchImages: !1,
  37. toggleControlsOnReturn: !0,
  38. toggleControlsOnSlideClick: !0,
  39. toggleSlideshowOnSpace: !0,
  40. enableKeyboardNavigation: !0,
  41. closeOnEscape: !0,
  42. closeOnSlideClick: !0,
  43. closeOnSwipeUpOrDown: !0,
  44. emulateTouchEvents: !0,
  45. stopTouchEventsPropagation: !1,
  46. hidePageScrollbars: !0,
  47. disableScroll: !0,
  48. carousel: !1,
  49. continuous: !0,
  50. unloadElements: !0,
  51. startSlideshow: !1,
  52. slideshowInterval: 5e3,
  53. index: 0,
  54. preloadRange: 2,
  55. transitionSpeed: 400,
  56. slideshowTransitionSpeed: void 0,
  57. event: void 0,
  58. onopen: void 0,
  59. onopened: void 0,
  60. onslide: void 0,
  61. onslideend: void 0,
  62. onslidecomplete: void 0,
  63. onclose: void 0,
  64. onclosed: void 0
  65. },
  66. carouselOptions: {
  67. hidePageScrollbars: !1,
  68. toggleControlsOnReturn: !1,
  69. toggleSlideshowOnSpace: !1,
  70. enableKeyboardNavigation: !1,
  71. closeOnEscape: !1,
  72. closeOnSlideClick: !1,
  73. closeOnSwipeUpOrDown: !1,
  74. disableScroll: !1,
  75. startSlideshow: !0
  76. },
  77. console: window.console && "function" == typeof window.console.log ? window.console : {
  78. log: function () {
  79. }
  80. },
  81. support: function (s) {
  82. var t, o = {touch: void 0 !== window.ontouchstart || window.DocumentTouch && document instanceof DocumentTouch},
  83. e = {
  84. webkitTransition: {end: "webkitTransitionEnd", prefix: "-webkit-"},
  85. MozTransition: {end: "transitionend", prefix: "-moz-"},
  86. OTransition: {end: "otransitionend", prefix: "-o-"},
  87. transition: {end: "transitionend", prefix: ""}
  88. };
  89. for (t in e) if (Object.prototype.hasOwnProperty.call(e, t) && void 0 !== s.style[t]) {
  90. o.transition = e[t], o.transition.name = t;
  91. break
  92. }
  93. function i() {
  94. var t, e, i = o.transition;
  95. document.body.appendChild(s), i && (t = i.name.slice(0, -9) + "ransform", void 0 !== s.style[t] && (s.style[t] = "translateZ(0)", e = window.getComputedStyle(s).getPropertyValue(i.prefix + "transform"), o.transform = {
  96. prefix: i.prefix,
  97. name: t,
  98. translate: !0,
  99. translateZ: !!e && "none" !== e
  100. })), void 0 !== s.style.backgroundSize && (o.backgroundSize = {}, s.style.backgroundSize = "contain", o.backgroundSize.contain = "contain" === window.getComputedStyle(s).getPropertyValue("background-size"), s.style.backgroundSize = "cover", o.backgroundSize.cover = "cover" === window.getComputedStyle(s).getPropertyValue("background-size")), document.body.removeChild(s)
  101. }
  102. return document.body ? i() : d(document).on("DOMContentLoaded", i), o
  103. }(document.createElement("div")),
  104. requestAnimationFrame: window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame,
  105. cancelAnimationFrame: window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame,
  106. initialize: function () {
  107. if (this.initStartIndex(), !1 === this.initWidget()) return !1;
  108. this.initEventListeners(), this.onslide(this.index), this.ontransitionend(), this.options.startSlideshow && this.play()
  109. },
  110. slide: function (t, e) {
  111. window.clearTimeout(this.timeout);
  112. var i, s, o, n = this.index;
  113. if (n !== t && 1 !== this.num) {
  114. if (e = e || this.options.transitionSpeed, this.support.transform) {
  115. for (this.options.continuous || (t = this.circle(t)), i = Math.abs(n - t) / (n - t), this.options.continuous && (s = i, (i = -this.positions[this.circle(t)] / this.slideWidth) !== s && (t = -i * this.num + t)), o = Math.abs(n - t) - 1; o;) o -= 1, this.move(this.circle((n < t ? t : n) - o - 1), this.slideWidth * i, 0);
  116. t = this.circle(t), this.move(n, this.slideWidth * i, e), this.move(t, 0, e), this.options.continuous && this.move(this.circle(t - i), -this.slideWidth * i, 0)
  117. } else t = this.circle(t), this.animate(n * -this.slideWidth, t * -this.slideWidth, e);
  118. this.onslide(t)
  119. }
  120. },
  121. getIndex: function () {
  122. return this.index
  123. },
  124. getNumber: function () {
  125. return this.num
  126. },
  127. prev: function () {
  128. (this.options.continuous || this.index) && this.slide(this.index - 1)
  129. },
  130. next: function () {
  131. (this.options.continuous || this.index < this.num - 1) && this.slide(this.index + 1)
  132. },
  133. play: function (t) {
  134. var i = this;
  135. window.clearTimeout(this.timeout), this.interval = t || this.options.slideshowInterval, 1 < this.elements[this.index] && (this.timeout = this.setTimeout(!this.requestAnimationFrame && this.slide || function (t, e) {
  136. i.animationFrameId = i.requestAnimationFrame.call(window, function () {
  137. i.slide(t, e)
  138. })
  139. }, [this.index + 1, this.options.slideshowTransitionSpeed], this.interval)), this.container.addClass(this.options.playingClass)
  140. },
  141. pause: function () {
  142. window.clearTimeout(this.timeout), this.interval = null, this.cancelAnimationFrame && (this.cancelAnimationFrame.call(window, this.animationFrameId), this.animationFrameId = null), this.container.removeClass(this.options.playingClass)
  143. },
  144. add: function (t) {
  145. var e;
  146. for (t.concat || (t = Array.prototype.slice.call(t)), this.list.concat || (this.list = Array.prototype.slice.call(this.list)), this.list = this.list.concat(t), this.num = this.list.length, 2 < this.num && null === this.options.continuous && (this.options.continuous = !0, this.container.removeClass(this.options.leftEdgeClass)), this.container.removeClass(this.options.rightEdgeClass).removeClass(this.options.singleClass), e = this.num - t.length; e < this.num; e += 1) this.addSlide(e), this.positionSlide(e);
  147. this.positions.length = this.num, this.initSlides(!0)
  148. },
  149. resetSlides: function () {
  150. this.slidesContainer.empty(), this.unloadAllSlides(), this.slides = []
  151. },
  152. handleClose: function () {
  153. var t = this.options;
  154. this.destroyEventListeners(), this.pause(), this.container[0].style.display = "none", this.container.removeClass(t.displayClass).removeClass(t.singleClass).removeClass(t.leftEdgeClass).removeClass(t.rightEdgeClass), t.hidePageScrollbars && (document.body.style.overflow = this.bodyOverflowStyle), this.options.clearSlides && this.resetSlides(), this.options.onclosed && this.options.onclosed.call(this)
  155. },
  156. close: function () {
  157. var i = this;
  158. this.options.onclose && this.options.onclose.call(this), this.support.transition && this.options.displayTransition ? (this.container.on(this.support.transition.end, function t(e) {
  159. e.target === i.container[0] && (i.container.off(i.support.transition.end, t), i.handleClose())
  160. }), this.container.removeClass(this.options.displayClass)) : this.handleClose()
  161. },
  162. circle: function (t) {
  163. return (this.num + t % this.num) % this.num
  164. },
  165. move: function (t, e, i) {
  166. this.translateX(t, e, i), this.positions[t] = e
  167. },
  168. translate: function (t, e, i, s) {
  169. if (this.slides[t]) {
  170. var o = this.slides[t].style, n = this.support.transition, a = this.support.transform;
  171. o[n.name + "Duration"] = s + "ms", o[a.name] = "translate(" + e + "px, " + i + "px)" + (a.translateZ ? " translateZ(0)" : "")
  172. }
  173. },
  174. translateX: function (t, e, i) {
  175. this.translate(t, e, 0, i)
  176. },
  177. translateY: function (t, e, i) {
  178. this.translate(t, 0, e, i)
  179. },
  180. animate: function (e, i, s) {
  181. if (s) var o = this, n = (new Date).getTime(), a = window.setInterval(function () {
  182. var t = (new Date).getTime() - n;
  183. if (s < t) return o.slidesContainer[0].style.left = i + "px", o.ontransitionend(), void window.clearInterval(a);
  184. o.slidesContainer[0].style.left = (i - e) * (Math.floor(t / s * 100) / 100) + e + "px"
  185. }, 4); else this.slidesContainer[0].style.left = i + "px"
  186. },
  187. preventDefault: function (t) {
  188. t.preventDefault ? t.preventDefault() : t.returnValue = !1
  189. },
  190. stopPropagation: function (t) {
  191. t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0
  192. },
  193. onresize: function () {
  194. this.initSlides(!0)
  195. },
  196. onmousedown: function (t) {
  197. t.which && 1 === t.which && "VIDEO" !== t.target.nodeName && "AUDIO" !== t.target.nodeName && (t.preventDefault(), (t.originalEvent || t).touches = [{
  198. pageX: t.pageX,
  199. pageY: t.pageY
  200. }], this.ontouchstart(t))
  201. },
  202. onmousemove: function (t) {
  203. this.touchStart && ((t.originalEvent || t).touches = [{pageX: t.pageX, pageY: t.pageY}], this.ontouchmove(t))
  204. },
  205. onmouseup: function (t) {
  206. this.touchStart && (this.ontouchend(t), delete this.touchStart)
  207. },
  208. onmouseout: function (t) {
  209. if (this.touchStart) {
  210. var e = t.target, i = t.relatedTarget;
  211. i && (i === e || d.contains(e, i)) || this.onmouseup(t)
  212. }
  213. },
  214. ontouchstart: function (t) {
  215. this.options.stopTouchEventsPropagation && this.stopPropagation(t);
  216. var e = (t.originalEvent || t).touches[0];
  217. this.touchStart = {x: e.pageX, y: e.pageY, time: Date.now()}, this.isScrolling = void 0, this.touchDelta = {}
  218. },
  219. ontouchmove: function (t) {
  220. this.options.stopTouchEventsPropagation && this.stopPropagation(t);
  221. var e, i, s = (t.originalEvent || t).touches[0], o = (t.originalEvent || t).scale, n = this.index;
  222. if (!(1 < s.length || o && 1 !== o)) if (this.options.disableScroll && t.preventDefault(), this.touchDelta = {
  223. x: s.pageX - this.touchStart.x,
  224. y: s.pageY - this.touchStart.y
  225. }, e = this.touchDelta.x, void 0 === this.isScrolling && (this.isScrolling = this.isScrolling || Math.abs(e) < Math.abs(this.touchDelta.y)), this.isScrolling) this.translateY(n, this.touchDelta.y + this.positions[n], 0); else for (t.preventDefault(), window.clearTimeout(this.timeout), this.options.continuous ? i = [this.circle(n + 1), n, this.circle(n - 1)] : (this.touchDelta.x = e /= !n && 0 < e || n === this.num - 1 && e < 0 ? Math.abs(e) / this.slideWidth + 1 : 1, i = [n], n && i.push(n - 1), n < this.num - 1 && i.unshift(n + 1)); i.length;) n = i.pop(), this.translateX(n, e + this.positions[n], 0)
  226. },
  227. ontouchend: function (t) {
  228. this.options.stopTouchEventsPropagation && this.stopPropagation(t);
  229. var e, i, s, o, n, a = this.index, l = this.options.transitionSpeed, r = this.slideWidth,
  230. h = Number(Date.now() - this.touchStart.time) < 250,
  231. d = h && 20 < Math.abs(this.touchDelta.x) || Math.abs(this.touchDelta.x) > r / 2,
  232. c = !a && 0 < this.touchDelta.x || a === this.num - 1 && this.touchDelta.x < 0,
  233. p = !d && this.options.closeOnSwipeUpOrDown && (h && 20 < Math.abs(this.touchDelta.y) || Math.abs(this.touchDelta.y) > this.slideHeight / 2);
  234. this.options.continuous && (c = !1), e = this.touchDelta.x < 0 ? -1 : 1, this.isScrolling ? p ? this.close() : this.translateY(a, 0, l) : d && !c ? (i = a + e, s = a - e, o = r * e, n = -r * e, this.options.continuous ? (this.move(this.circle(i), o, 0), this.move(this.circle(a - 2 * e), n, 0)) : 0 <= i && i < this.num && this.move(i, o, 0), this.move(a, this.positions[a] + o, l), this.move(this.circle(s), this.positions[this.circle(s)] + o, l), a = this.circle(s), this.onslide(a)) : this.options.continuous ? (this.move(this.circle(a - 1), -r, l), this.move(a, 0, l), this.move(this.circle(a + 1), r, l)) : (a && this.move(a - 1, -r, l), this.move(a, 0, l), a < this.num - 1 && this.move(a + 1, r, l))
  235. },
  236. ontouchcancel: function (t) {
  237. this.touchStart && (this.ontouchend(t), delete this.touchStart)
  238. },
  239. ontransitionend: function (t) {
  240. var e = this.slides[this.index];
  241. t && e !== t.target || (this.interval && this.play(), this.setTimeout(this.options.onslideend, [this.index, e]))
  242. },
  243. oncomplete: function (t) {
  244. var e, i = t.target || t.srcElement, s = i && i.parentNode;
  245. i && s && (e = this.getNodeIndex(s), d(s).removeClass(this.options.slideLoadingClass), "error" === t.type ? (d(s).addClass(this.options.slideErrorClass), this.elements[e] = 3) : this.elements[e] = 2, i.clientHeight > this.container[0].clientHeight && (i.style.maxHeight = this.container[0].clientHeight), this.interval && this.slides[this.index] === s && this.play(), this.setTimeout(this.options.onslidecomplete, [e, s]))
  246. },
  247. onload: function (t) {
  248. this.oncomplete(t)
  249. },
  250. onerror: function (t) {
  251. this.oncomplete(t)
  252. },
  253. onkeydown: function (t) {
  254. switch (t.which || t.keyCode) {
  255. case 13:
  256. this.options.toggleControlsOnReturn && (this.preventDefault(t), this.toggleControls());
  257. break;
  258. case 27:
  259. this.options.closeOnEscape && (this.close(), t.stopImmediatePropagation());
  260. break;
  261. case 32:
  262. this.options.toggleSlideshowOnSpace && (this.preventDefault(t), this.toggleSlideshow());
  263. break;
  264. case 37:
  265. this.options.enableKeyboardNavigation && (this.preventDefault(t), this.prev());
  266. break;
  267. case 39:
  268. this.options.enableKeyboardNavigation && (this.preventDefault(t), this.next())
  269. }
  270. },
  271. handleClick: function (t) {
  272. var e = this.options, i = t.target || t.srcElement, s = i.parentNode;
  273. function o(t) {
  274. return d(i).hasClass(t) || d(s).hasClass(t)
  275. }
  276. o(e.toggleClass) ? (this.preventDefault(t), this.toggleControls()) : o(e.prevClass) ? (this.preventDefault(t), this.prev()) : o(e.nextClass) ? (this.preventDefault(t), this.next()) : o(e.closeClass) ? (this.preventDefault(t), this.close()) : o(e.playPauseClass) ? (this.preventDefault(t), this.toggleSlideshow()) : s === this.slidesContainer[0] ? e.closeOnSlideClick ? (this.preventDefault(t), this.close()) : e.toggleControlsOnSlideClick && (this.preventDefault(t), this.toggleControls()) : s.parentNode && s.parentNode === this.slidesContainer[0] && e.toggleControlsOnSlideClick && (this.preventDefault(t), this.toggleControls())
  277. },
  278. onclick: function (t) {
  279. if (!(this.options.emulateTouchEvents && this.touchDelta && (20 < Math.abs(this.touchDelta.x) || 20 < Math.abs(this.touchDelta.y)))) return this.handleClick(t);
  280. delete this.touchDelta
  281. },
  282. updateEdgeClasses: function (t) {
  283. t ? this.container.removeClass(this.options.leftEdgeClass) : this.container.addClass(this.options.leftEdgeClass), t === this.num - 1 ? this.container.addClass(this.options.rightEdgeClass) : this.container.removeClass(this.options.rightEdgeClass)
  284. },
  285. handleSlide: function (t) {
  286. this.options.continuous || this.updateEdgeClasses(t), this.loadElements(t), this.options.unloadElements && this.unloadElements(t), this.setTitle(t)
  287. },
  288. onslide: function (t) {
  289. this.index = t, this.handleSlide(t), this.setTimeout(this.options.onslide, [t, this.slides[t]])
  290. },
  291. setTitle: function (t) {
  292. var e = this.slides[t].firstChild, i = e.title || e.alt, s = this.titleElement;
  293. s.length && (this.titleElement.empty(), i && s[0].appendChild(document.createTextNode(i)))
  294. },
  295. setTimeout: function (t, e, i) {
  296. var s = this;
  297. return t && window.setTimeout(function () {
  298. t.apply(s, e || [])
  299. }, i || 0)
  300. },
  301. imageFactory: function (t, i) {
  302. var s, o, e, n, a = this, l = this.imagePrototype.cloneNode(!1), r = t, h = this.options.stretchImages;
  303. return "string" != typeof r && (r = this.getItemProperty(t, this.options.urlProperty), e = this.getItemProperty(t, this.options.titleProperty), n = this.getItemProperty(t, this.options.altTextProperty) || e), !0 === h && (h = "contain"), (h = this.support.backgroundSize && this.support.backgroundSize[h] && h) ? o = this.elementPrototype.cloneNode(!1) : (o = l).draggable = !1, e && (o.title = e), n && (o.alt = n), d(l).on("load error", function t(e) {
  304. if (!s) {
  305. if (e = {type: e.type, target: o}, !o.parentNode) return a.setTimeout(t, [e]);
  306. s = !0, d(l).off("load error", t), h && "load" === e.type && (o.style.background = 'url("' + r + '") center no-repeat', o.style.backgroundSize = h), i(e)
  307. }
  308. }), l.src = r, o
  309. },
  310. createElement: function (t, e) {
  311. var i = t && this.getItemProperty(t, this.options.typeProperty),
  312. s = i && this[i.split("/")[0] + "Factory"] || this.imageFactory, o = t && s.call(this, t, e),
  313. n = this.getItemProperty(t, this.options.srcsetProperty);
  314. return o || (o = this.elementPrototype.cloneNode(!1), this.setTimeout(e, [{
  315. type: "error",
  316. target: o
  317. }])), n && o.setAttribute("srcset", n), d(o).addClass(this.options.slideContentClass), o
  318. },
  319. loadElement: function (t) {
  320. this.elements[t] || (this.slides[t].firstChild ? this.elements[t] = d(this.slides[t]).hasClass(this.options.slideErrorClass) ? 3 : 2 : (this.elements[t] = 1, d(this.slides[t]).addClass(this.options.slideLoadingClass), this.slides[t].appendChild(this.createElement(this.list[t], this.proxyListener))))
  321. },
  322. loadElements: function (t) {
  323. var e, i = Math.min(this.num, 2 * this.options.preloadRange + 1), s = t;
  324. for (e = 0; e < i; e += 1) s += e * (e % 2 == 0 ? -1 : 1), s = this.circle(s), this.loadElement(s)
  325. },
  326. unloadElements: function (t) {
  327. var e, i;
  328. for (e in this.elements) Object.prototype.hasOwnProperty.call(this.elements, e) && (i = Math.abs(t - e)) > this.options.preloadRange && i + this.options.preloadRange < this.num && (this.unloadSlide(e), delete this.elements[e])
  329. },
  330. addSlide: function (t) {
  331. var e = this.slidePrototype.cloneNode(!1);
  332. e.setAttribute("data-index", t), this.slidesContainer[0].appendChild(e), this.slides.push(e)
  333. },
  334. positionSlide: function (t) {
  335. var e = this.slides[t];
  336. e.style.width = this.slideWidth + "px", this.support.transform && (e.style.left = t * -this.slideWidth + "px", this.move(t, this.index > t ? -this.slideWidth : this.index < t ? this.slideWidth : 0, 0))
  337. },
  338. initSlides: function (t) {
  339. var e, i;
  340. for (t || (this.positions = [], this.positions.length = this.num, this.elements = {}, this.imagePrototype = document.createElement("img"), this.elementPrototype = document.createElement("div"), this.slidePrototype = document.createElement("div"), d(this.slidePrototype).addClass(this.options.slideClass), this.slides = this.slidesContainer[0].children, e = this.options.clearSlides || this.slides.length !== this.num), this.slideWidth = this.container[0].clientWidth, this.slideHeight = this.container[0].clientHeight, this.slidesContainer[0].style.width = this.num * this.slideWidth + "px", e && this.resetSlides(), i = 0; i < this.num; i += 1) e && this.addSlide(i), this.positionSlide(i);
  341. this.options.continuous && this.support.transform && (this.move(this.circle(this.index - 1), -this.slideWidth, 0), this.move(this.circle(this.index + 1), this.slideWidth, 0)), this.support.transform || (this.slidesContainer[0].style.left = this.index * -this.slideWidth + "px")
  342. },
  343. unloadSlide: function (t) {
  344. var e, i;
  345. null !== (i = (e = this.slides[t]).firstChild) && e.removeChild(i)
  346. },
  347. unloadAllSlides: function () {
  348. var t, e;
  349. for (t = 0, e = this.slides.length; t < e; t++) this.unloadSlide(t)
  350. },
  351. toggleControls: function () {
  352. var t = this.options.controlsClass;
  353. this.container.hasClass(t) ? this.container.removeClass(t) : this.container.addClass(t)
  354. },
  355. toggleSlideshow: function () {
  356. this.interval ? this.pause() : this.play()
  357. },
  358. getNodeIndex: function (t) {
  359. return parseInt(t.getAttribute("data-index"), 10)
  360. },
  361. getNestedProperty: function (a, t) {
  362. return t.replace(/\[(?:'([^']+)'|"([^"]+)"|(\d+))\]|(?:(?:^|\.)([^\.\[]+))/g, function (t, e, i, s, o) {
  363. var n = o || e || i || s && parseInt(s, 10);
  364. t && a && (a = a[n])
  365. }), a
  366. },
  367. getDataProperty: function (t, e) {
  368. var i, s;
  369. if (t.dataset ? (i = e.replace(/-([a-z])/g, function (t, e) {
  370. return e.toUpperCase()
  371. }), s = t.dataset[i]) : t.getAttribute && (s = t.getAttribute("data-" + e.replace(/([A-Z])/g, "-$1").toLowerCase())), "string" == typeof s) {
  372. if (/^(true|false|null|-?\d+(\.\d+)?|\{[\s\S]*\}|\[[\s\S]*\])$/.test(s)) try {
  373. return d.parseJSON(s)
  374. } catch (t) {
  375. }
  376. return s
  377. }
  378. },
  379. getItemProperty: function (t, e) {
  380. var i = this.getDataProperty(t, e);
  381. return void 0 === i && (i = t[e]), void 0 === i && (i = this.getNestedProperty(t, e)), i
  382. },
  383. initStartIndex: function () {
  384. var t, e = this.options.index, i = this.options.urlProperty;
  385. if (e && "number" != typeof e) for (t = 0; t < this.num; t += 1) if (this.list[t] === e || this.getItemProperty(this.list[t], i) === this.getItemProperty(e, i)) {
  386. e = t;
  387. break
  388. }
  389. this.index = this.circle(parseInt(e, 10) || 0)
  390. },
  391. initEventListeners: function () {
  392. var i = this, t = this.slidesContainer;
  393. function e(t) {
  394. var e = i.support.transition && i.support.transition.end === t.type ? "transitionend" : t.type;
  395. i["on" + e](t)
  396. }
  397. d(window).on("resize", e), d(document.body).on("keydown", e), this.container.on("click", e), this.support.touch ? t.on("touchstart touchmove touchend touchcancel", e) : this.options.emulateTouchEvents && this.support.transition && t.on("mousedown mousemove mouseup mouseout", e), this.support.transition && t.on(this.support.transition.end, e), this.proxyListener = e
  398. },
  399. destroyEventListeners: function () {
  400. var t = this.slidesContainer, e = this.proxyListener;
  401. d(window).off("resize", e), d(document.body).off("keydown", e), this.container.off("click", e), this.support.touch ? t.off("touchstart touchmove touchend touchcancel", e) : this.options.emulateTouchEvents && this.support.transition && t.off("mousedown mousemove mouseup mouseout", e), this.support.transition && t.off(this.support.transition.end, e)
  402. },
  403. handleOpen: function () {
  404. this.options.onopened && this.options.onopened.call(this)
  405. },
  406. initWidget: function () {
  407. var i = this;
  408. return this.container = d(this.options.container), this.container.length ? (this.slidesContainer = this.container.find(this.options.slidesContainer).first(), this.slidesContainer.length ? (this.titleElement = this.container.find(this.options.titleElement).first(), 1 === this.num && this.container.addClass(this.options.singleClass), this.options.onopen && this.options.onopen.call(this), this.support.transition && this.options.displayTransition ? this.container.on(this.support.transition.end, function t(e) {
  409. e.target === i.container[0] && (i.container.off(i.support.transition.end, t), i.handleOpen())
  410. }) : this.handleOpen(), this.options.hidePageScrollbars && (this.bodyOverflowStyle = document.body.style.overflow, document.body.style.overflow = "hidden"), this.container[0].style.display = "block", this.initSlides(), void this.container.addClass(this.options.displayClass)) : (this.console.log("blueimp Gallery: Slides container not found.", this.options.slidesContainer), !1)) : (this.console.log("blueimp Gallery: Widget container not found.", this.options.container), !1)
  411. },
  412. initOptions: function (t) {
  413. this.options = d.extend({}, this.options), (t && t.carousel || this.options.carousel && (!t || !1 !== t.carousel)) && d.extend(this.options, this.carouselOptions), d.extend(this.options, t), this.num < 3 && (this.options.continuous = !!this.options.continuous && null), this.support.transition || (this.options.emulateTouchEvents = !1), this.options.event && this.preventDefault(this.options.event)
  414. }
  415. }), i
  416. }), function (t) {
  417. "use strict";
  418. "function" == typeof define && define.amd ? define(["./blueimp-helper", "./blueimp-gallery"], t) : t(window.blueimp.helper || window.jQuery, window.blueimp.Gallery)
  419. }(function (t, e) {
  420. "use strict";
  421. t.extend(e.prototype.options, {fullScreen: !1});
  422. var i = e.prototype.initialize, s = e.prototype.close;
  423. return t.extend(e.prototype, {
  424. getFullScreenElement: function () {
  425. return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement
  426. }, requestFullScreen: function (t) {
  427. t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.mozRequestFullScreen ? t.mozRequestFullScreen() : t.msRequestFullscreen && t.msRequestFullscreen()
  428. }, exitFullScreen: function () {
  429. document.exitFullscreen ? document.exitFullscreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen()
  430. }, initialize: function () {
  431. i.call(this), this.options.fullScreen && !this.getFullScreenElement() && this.requestFullScreen(this.container[0])
  432. }, close: function () {
  433. this.getFullScreenElement() === this.container[0] && this.exitFullScreen(), s.call(this)
  434. }
  435. }), e
  436. }), function (t) {
  437. "use strict";
  438. "function" == typeof define && define.amd ? define(["./blueimp-helper", "./blueimp-gallery"], t) : t(window.blueimp.helper || window.jQuery, window.blueimp.Gallery)
  439. }(function (a, t) {
  440. "use strict";
  441. a.extend(t.prototype.options, {
  442. indicatorContainer: "ol",
  443. activeIndicatorClass: "active",
  444. thumbnailProperty: "thumbnail",
  445. thumbnailIndicators: !0
  446. });
  447. var e = t.prototype.initSlides, i = t.prototype.addSlide, s = t.prototype.resetSlides, o = t.prototype.handleClick,
  448. n = t.prototype.handleSlide, l = t.prototype.handleClose;
  449. return a.extend(t.prototype, {
  450. createIndicator: function (t) {
  451. var e, i, s = this.indicatorPrototype.cloneNode(!1), o = this.getItemProperty(t, this.options.titleProperty),
  452. n = this.options.thumbnailProperty;
  453. return this.options.thumbnailIndicators && (n && (e = this.getItemProperty(t, n)), void 0 === e && (i = t.getElementsByTagName && a(t).find("img")[0]) && (e = i.src), e && (s.style.backgroundImage = 'url("' + e + '")')), o && (s.title = o), s
  454. }, addIndicator: function (t) {
  455. if (this.indicatorContainer.length) {
  456. var e = this.createIndicator(this.list[t]);
  457. e.setAttribute("data-index", t), this.indicatorContainer[0].appendChild(e), this.indicators.push(e)
  458. }
  459. }, setActiveIndicator: function (t) {
  460. this.indicators && (this.activeIndicator && this.activeIndicator.removeClass(this.options.activeIndicatorClass), this.activeIndicator = a(this.indicators[t]), this.activeIndicator.addClass(this.options.activeIndicatorClass))
  461. }, initSlides: function (t) {
  462. t || (this.indicatorContainer = this.container.find(this.options.indicatorContainer), this.indicatorContainer.length && (this.indicatorPrototype = document.createElement("li"), this.indicators = this.indicatorContainer[0].children)), e.call(this, t)
  463. }, addSlide: function (t) {
  464. i.call(this, t), this.addIndicator(t)
  465. }, resetSlides: function () {
  466. s.call(this), this.indicatorContainer.empty(), this.indicators = []
  467. }, handleClick: function (t) {
  468. var e = t.target || t.srcElement, i = e.parentNode;
  469. if (i === this.indicatorContainer[0]) this.preventDefault(t), this.slide(this.getNodeIndex(e)); else {
  470. if (i.parentNode !== this.indicatorContainer[0]) return o.call(this, t);
  471. this.preventDefault(t), this.slide(this.getNodeIndex(i))
  472. }
  473. }, handleSlide: function (t) {
  474. n.call(this, t), this.setActiveIndicator(t)
  475. }, handleClose: function () {
  476. this.activeIndicator && this.activeIndicator.removeClass(this.options.activeIndicatorClass), l.call(this)
  477. }
  478. }), t
  479. }), function (t) {
  480. "use strict";
  481. "function" == typeof define && define.amd ? define(["./blueimp-helper", "./blueimp-gallery"], t) : t(window.blueimp.helper || window.jQuery, window.blueimp.Gallery)
  482. }(function (w, t) {
  483. "use strict";
  484. w.extend(t.prototype.options, {
  485. videoContentClass: "video-content",
  486. videoLoadingClass: "video-loading",
  487. videoPlayingClass: "video-playing",
  488. videoPosterProperty: "poster",
  489. videoSourcesProperty: "sources"
  490. });
  491. var e = t.prototype.handleSlide;
  492. return w.extend(t.prototype, {
  493. handleSlide: function (t) {
  494. e.call(this, t), this.playingVideo && this.playingVideo.pause()
  495. }, videoFactory: function (t, e, i) {
  496. var s, o, n, a, l, r = this, h = this.options, d = this.elementPrototype.cloneNode(!1), c = w(d),
  497. p = [{type: "error", target: d}], u = i || document.createElement("video"),
  498. m = this.getItemProperty(t, h.urlProperty), y = this.getItemProperty(t, h.typeProperty),
  499. f = this.getItemProperty(t, h.titleProperty), g = this.getItemProperty(t, this.options.altTextProperty) || f,
  500. v = this.getItemProperty(t, h.videoPosterProperty), C = this.getItemProperty(t, h.videoSourcesProperty);
  501. if (c.addClass(h.videoContentClass), f && (d.title = f), u.canPlayType) if (m && y && u.canPlayType(y)) u.src = m; else if (C) for (; C.length;) if (o = C.shift(), m = this.getItemProperty(o, h.urlProperty), y = this.getItemProperty(o, h.typeProperty), m && y && u.canPlayType(y)) {
  502. u.src = m;
  503. break
  504. }
  505. return v && (u.poster = v, s = this.imagePrototype.cloneNode(!1), w(s).addClass(h.toggleClass), s.src = v, s.draggable = !1, s.alt = g, d.appendChild(s)), (n = document.createElement("a")).setAttribute("target", "_blank"), i || n.setAttribute("download", f), n.href = m, u.src && (u.controls = !0, (i || w(u)).on("error", function () {
  506. r.setTimeout(e, p)
  507. }).on("pause", function () {
  508. u.seeking || (a = !1, c.removeClass(r.options.videoLoadingClass).removeClass(r.options.videoPlayingClass), l && r.container.addClass(r.options.controlsClass), delete r.playingVideo, r.interval && r.play())
  509. }).on("playing", function () {
  510. a = !1, c.removeClass(r.options.videoLoadingClass).addClass(r.options.videoPlayingClass), r.container.hasClass(r.options.controlsClass) ? (l = !0, r.container.removeClass(r.options.controlsClass)) : l = !1
  511. }).on("play", function () {
  512. window.clearTimeout(r.timeout), a = !0, c.addClass(r.options.videoLoadingClass), r.playingVideo = u
  513. }), w(n).on("click", function (t) {
  514. r.preventDefault(t), a ? u.pause() : u.play()
  515. }), d.appendChild(i && i.element || u)), d.appendChild(n), this.setTimeout(e, [{type: "load", target: d}]), d
  516. }
  517. }), t
  518. }), function (t) {
  519. "use strict";
  520. "function" == typeof define && define.amd ? define(["./blueimp-helper", "./blueimp-gallery-video"], t) : t(window.blueimp.helper || window.jQuery, window.blueimp.Gallery)
  521. }(function (l, t) {
  522. "use strict";
  523. if (!window.postMessage) return t;
  524. l.extend(t.prototype.options, {
  525. vimeoVideoIdProperty: "vimeo",
  526. vimeoPlayerUrl: "//player.vimeo.com/video/VIDEO_ID?api=1&player_id=PLAYER_ID",
  527. vimeoPlayerIdPrefix: "vimeo-player-",
  528. vimeoClickToPlay: !0
  529. });
  530. function o(t, e, i, s) {
  531. this.url = t, this.videoId = e, this.playerId = i, this.clickToPlay = s, this.element = document.createElement("div"), this.listeners = {}
  532. }
  533. var n = t.prototype.textFactory || t.prototype.imageFactory, a = 0;
  534. return l.extend(o.prototype, {
  535. canPlayType: function () {
  536. return !0
  537. }, on: function (t, e) {
  538. return this.listeners[t] = e, this
  539. }, loadAPI: function () {
  540. var t, e, i = this, s = "//f.vimeocdn.com/js/froogaloop2.min.js", o = document.getElementsByTagName("script"),
  541. n = o.length;
  542. function a() {
  543. !e && i.playOnReady && i.play(), e = !0
  544. }
  545. for (; n;) if (o[n -= 1].src === s) {
  546. t = o[n];
  547. break
  548. }
  549. t || ((t = document.createElement("script")).src = s), l(t).on("load", a), o[0].parentNode.insertBefore(t, o[0]), /loaded|complete/.test(t.readyState) && a()
  550. }, onReady: function () {
  551. var t = this;
  552. this.ready = !0, this.player.addEvent("play", function () {
  553. t.hasPlayed = !0, t.onPlaying()
  554. }), this.player.addEvent("pause", function () {
  555. t.onPause()
  556. }), this.player.addEvent("finish", function () {
  557. t.onPause()
  558. }), this.playOnReady && this.play()
  559. }, onPlaying: function () {
  560. this.playStatus < 2 && (this.listeners.playing(), this.playStatus = 2)
  561. }, onPause: function () {
  562. this.listeners.pause(), delete this.playStatus
  563. }, insertIframe: function () {
  564. var t = document.createElement("iframe");
  565. t.src = this.url.replace("VIDEO_ID", this.videoId).replace("PLAYER_ID", this.playerId), t.id = this.playerId, this.element.parentNode.replaceChild(t, this.element), this.element = t
  566. }, play: function () {
  567. var t = this;
  568. this.playStatus || (this.listeners.play(), this.playStatus = 1), this.ready ? !this.hasPlayed && (this.clickToPlay || window.navigator && /iP(hone|od|ad)/.test(window.navigator.platform)) ? this.onPlaying() : this.player.api("play") : (this.playOnReady = !0, window.$f ? this.player || (this.insertIframe(), this.player = $f(this.element), this.player.addEvent("ready", function () {
  569. t.onReady()
  570. })) : this.loadAPI())
  571. }, pause: function () {
  572. this.ready ? this.player.api("pause") : this.playStatus && (delete this.playOnReady, this.listeners.pause(), delete this.playStatus)
  573. }
  574. }), l.extend(t.prototype, {
  575. VimeoPlayer: o, textFactory: function (t, e) {
  576. var i = this.options, s = this.getItemProperty(t, i.vimeoVideoIdProperty);
  577. return s ? (void 0 === this.getItemProperty(t, i.urlProperty) && (t[i.urlProperty] = "//vimeo.com/" + s), a += 1, this.videoFactory(t, e, new o(i.vimeoPlayerUrl, s, i.vimeoPlayerIdPrefix + a, i.vimeoClickToPlay))) : n.call(this, t, e)
  578. }
  579. }), t
  580. }), function (t) {
  581. "use strict";
  582. "function" == typeof define && define.amd ? define(["./blueimp-helper", "./blueimp-gallery-video"], t) : t(window.blueimp.helper || window.jQuery, window.blueimp.Gallery)
  583. }(function (t, e) {
  584. "use strict";
  585. if (!window.postMessage) return e;
  586. t.extend(e.prototype.options, {
  587. youTubeVideoIdProperty: "youtube",
  588. youTubePlayerVars: {wmode: "transparent"},
  589. youTubeClickToPlay: !0
  590. });
  591. function o(t, e, i) {
  592. this.videoId = t, this.playerVars = e, this.clickToPlay = i, this.element = document.createElement("div"), this.listeners = {}
  593. }
  594. var n = e.prototype.textFactory || e.prototype.imageFactory;
  595. return t.extend(o.prototype, {
  596. canPlayType: function () {
  597. return !0
  598. }, on: function (t, e) {
  599. return this.listeners[t] = e, this
  600. }, loadAPI: function () {
  601. var t, e = this, i = window.onYouTubeIframeAPIReady, s = "//www.youtube.com/iframe_api",
  602. o = document.getElementsByTagName("script"), n = o.length;
  603. for (window.onYouTubeIframeAPIReady = function () {
  604. i && i.apply(this), e.playOnReady && e.play()
  605. }; n;) if (o[n -= 1].src === s) return;
  606. (t = document.createElement("script")).src = s, o[0].parentNode.insertBefore(t, o[0])
  607. }, onReady: function () {
  608. this.ready = !0, this.playOnReady && this.play()
  609. }, onPlaying: function () {
  610. this.playStatus < 2 && (this.listeners.playing(), this.playStatus = 2)
  611. }, onPause: function () {
  612. e.prototype.setTimeout.call(this, this.checkSeek, null, 2e3)
  613. }, checkSeek: function () {
  614. this.stateChange !== YT.PlayerState.PAUSED && this.stateChange !== YT.PlayerState.ENDED || (this.listeners.pause(), delete this.playStatus)
  615. }, onStateChange: function (t) {
  616. switch (t.data) {
  617. case YT.PlayerState.PLAYING:
  618. this.hasPlayed = !0, this.onPlaying();
  619. break;
  620. case YT.PlayerState.PAUSED:
  621. case YT.PlayerState.ENDED:
  622. this.onPause()
  623. }
  624. this.stateChange = t.data
  625. }, onError: function (t) {
  626. this.listeners.error(t)
  627. }, play: function () {
  628. var e = this;
  629. this.playStatus || (this.listeners.play(), this.playStatus = 1), this.ready ? !this.hasPlayed && (this.clickToPlay || window.navigator && /iP(hone|od|ad)/.test(window.navigator.platform)) ? this.onPlaying() : this.player.playVideo() : (this.playOnReady = !0, window.YT && YT.Player ? this.player || (this.player = new YT.Player(this.element, {
  630. videoId: this.videoId,
  631. playerVars: this.playerVars,
  632. events: {
  633. onReady: function () {
  634. e.onReady()
  635. }, onStateChange: function (t) {
  636. e.onStateChange(t)
  637. }, onError: function (t) {
  638. e.onError(t)
  639. }
  640. }
  641. })) : this.loadAPI())
  642. }, pause: function () {
  643. this.ready ? this.player.pauseVideo() : this.playStatus && (delete this.playOnReady, this.listeners.pause(), delete this.playStatus)
  644. }
  645. }), t.extend(e.prototype, {
  646. YouTubePlayer: o, textFactory: function (t, e) {
  647. var i = this.options, s = this.getItemProperty(t, i.youTubeVideoIdProperty);
  648. return s ? (void 0 === this.getItemProperty(t, i.urlProperty) && (t[i.urlProperty] = "//www.youtube.com/watch?v=" + s), void 0 === this.getItemProperty(t, i.videoPosterProperty) && (t[i.videoPosterProperty] = "//img.youtube.com/vi/" + s + "/maxresdefault.jpg"), this.videoFactory(t, e, new o(s, i.youTubePlayerVars, i.youTubeClickToPlay))) : n.call(this, t, e)
  649. }
  650. }), e
  651. }), function (t) {
  652. "use strict";
  653. "function" == typeof define && define.amd ? define(["jquery", "./blueimp-gallery"], t) : t(window.jQuery, window.blueimp.Gallery)
  654. }(function (l, r) {
  655. "use strict";
  656. l(document).on("click", "[data-gallery]", function (t) {
  657. var e = l(this).data("gallery"), i = l(e), s = i.length && i || l(r.prototype.options.container), o = {
  658. onopen: function () {
  659. s.data("gallery", this).trigger("open")
  660. }, onopened: function () {
  661. s.trigger("opened")
  662. }, onslide: function () {
  663. s.trigger("slide", arguments)
  664. }, onslideend: function () {
  665. s.trigger("slideend", arguments)
  666. }, onslidecomplete: function () {
  667. s.trigger("slidecomplete", arguments)
  668. }, onclose: function () {
  669. s.trigger("close")
  670. }, onclosed: function () {
  671. s.trigger("closed").removeData("gallery")
  672. }
  673. }, n = l.extend(s.data(), {container: s[0], index: this, event: t}, o),
  674. a = l(this).closest("[data-gallery-group], body").find('[data-gallery="' + e + '"]');
  675. return n.filter && (a = a.filter(n.filter)), new r(a, n)
  676. })
  677. });
  678. //# sourceMappingURL=jquery.blueimp-gallery.min.js.map