/*! Magnific Popup - v0.9.9 - 2013-12-27 * http://dimsemenov.com/plugins/magnific-popup/ * Copyright (c) 2013 Dmitry Semenov; */ (function(e) { 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() {}, b = !!window.jQuery, I = e(window), x = function(e, n) { t.ev.on(g + e + h, n) }, k = function(t, n, i, o) { var r = document.createElement("div"); return r.className = "mfp-" + t, i && (r.innerHTML = i), o ? n && n.appendChild(r) : (r = e(r), n && r.appendTo(n)), r }, T = function(n, i) { 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])) }, E = function(n) { return n === s && t.currTemplate.closeBtn || (t.currTemplate.closeBtn = e(t.st.closeMarkup.replace("%title%", t.st.tClose)), s = n), t.currTemplate.closeBtn }, _ = function() { e.magnificPopup.instance || (t = new w, t.init(), e.magnificPopup.instance = t) }, S = function() { var e = document.createElement("p").style, t = ["ms", "O", "Moz", "Webkit"]; if (void 0 !== e.transition) return !0; for (; t.length;) if (t.pop() + "Transition" in e) return !0; return !1 }; w.prototype = { constructor: w, init: function() { var n = navigator.appVersion; 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 = {} }, open: function(n) { i || (i = e(document.body)); var r; if (n.isObj === !1) { t.items = n.items.toArray(), t.index = 0; var s, l = n.items; for (r = 0; l.length > r; r++) if (s = l[r], s.parsed && (s = s.el[0]), s === n.el[0]) { t.index = r; break } } else t.items = e.isArray(n.items) ? n.items : [n.items], t.index = n.index || 0; if (t.isOpen) return t.updateItemHTML(), void 0; 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() { t.close() }), t.wrap = k("wrap").attr("tabindex", -1).on("click" + h, function(e) { t._checkIfClose(e.target) && t.close() }), t.container = k("container", t.wrap)), t.contentContainer = k("content"), t.st.preloader && (t.preloader = k("preloader", t.container, t.st.tLoading)); var c = e.magnificPopup.modules; for (r = 0; c.length > r; r++) { var d = c[r]; d = d.charAt(0).toUpperCase() + d.slice(1), t["init" + d].call(t) } T("BeforeOpen"), t.st.showCloseBtn && (t.st.closeBtnInside ? (x(p, function(e, t, n, i) { n.close_replaceWith = E(i.type) }), a += " mfp-close-btn-in") : t.wrap.append(E())), t.st.alignTop && (a += " mfp-align-top"), t.fixedContentPos ? t.wrap.css({ overflow: t.st.overflowY, overflowX: "hidden", overflowY: t.st.overflowY }) : t.wrap.css({ top: I.scrollTop(), position: "absolute" }), (t.st.fixedBgPos === !1 || "auto" === t.st.fixedBgPos && !t.fixedContentPos) && t.bgOverlay.css({ height: o.height(), position: "absolute" }), t.st.enableEscapeKey && o.on("keyup" + h, function(e) { 27 === e.keyCode && t.close() }), I.on("resize" + h, function() { t.updateSize() }), t.st.closeOnContentClick || (a += " mfp-auto-cursor"), a && t.wrap.addClass(a); var u = t.wH = I.height(), m = {}; if (t.fixedContentPos && t._hasScrollBar(u)) { var g = t._getScrollbarSize(); g && (m.marginRight = g) } t.fixedContentPos && (t.isIE7 ? e("body, html").css("overflow", "hidden") : m.overflow = "hidden"); var C = t.st.mainClass; 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() { t.content ? (t._addClassToMFP(v), t._setFocus()) : t.bgOverlay.addClass(v), o.on("focusin" + h, t._onFocusIn) }, 16), t.isOpen = !0, t.updateSize(u), T(f), n }, close: function() { t.isOpen && (T(c), t.isOpen = !1, t.st.removalDelay && !t.isLowIE && t.supportsTransition ? (t._addClassToMFP(C), setTimeout(function() { t._close() }, t.st.removalDelay)) : t._close()) }, _close: function() { T(l); var n = C + " " + v + " "; if (t.bgOverlay.detach(), t.wrap.detach(), t.container.empty(), t.st.mainClass && (n += t.st.mainClass + " "), t._removeClassFromMFP(n), t.fixedContentPos) { var i = { marginRight: "" }; t.isIE7 ? e("body, html").css("overflow", "") : i.overflow = "", e("html").css(i) } 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) }, updateSize: function(e) { if (t.isIOS) { var n = document.documentElement.clientWidth / window.innerWidth, i = window.innerHeight * n; t.wrap.css("height", i), t.wH = i } else t.wH = e || I.height(); t.fixedContentPos || t.wrap.css("height", t.wH), T("Resize") }, updateItemHTML: function() { var n = t.items[t.index]; t.contentContainer.detach(), t.content && t.content.detach(), n.parsed || (n = t.parseEl(t.index)); var i = n.type; if (T("BeforeChange", [t.currItem ? t.currItem.type : "", i]), t.currItem = n, !t.currTemplate[i]) { var o = t.st[i] ? t.st[i].markup : !1; T("FirstMarkupParse", o), t.currTemplate[i] = o ? e(o) : !0 } r && r !== n.type && t.container.removeClass("mfp-" + r + "-holder"); var a = t["get" + i.charAt(0).toUpperCase() + i.slice(1)](n, t.currTemplate[i]); t.appendContent(a, i), n.preloaded = !0, T(m, n), r = n.type, t.container.prepend(t.contentContainer), T("AfterChange") }, appendContent: function(e, n) { 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) }, parseEl: function(n) { var i, o = t.items[n]; if (o.tagName ? o = { el: e(o) } : (i = o.type, o = { data: o, src: o.src }), o.el) { for (var r = t.types, a = 0; r.length > a; a++) if (o.el.hasClass("mfp-" + r[a])) { i = r[a]; break } o.src = o.el.attr("data-mfp-src"), o.src || (o.src = o.el.attr("href")) } return o.type = i || t.st.type || "inline", o.index = n, o.parsed = !0, t.items[n] = o, T("ElementParse", o), t.items[n] }, addGroup: function(e, n) { var i = function(i) { i.mfpEl = this, t._openClick(i, e, n) }; n || (n = {}); var o = "click.magnificPopup"; 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))) }, _openClick: function(n, i, o) { var r = void 0 !== o.midClick ? o.midClick : e.magnificPopup.defaults.midClick; if (r || 2 !== n.which && !n.ctrlKey && !n.metaKey) { var a = void 0 !== o.disableOn ? o.disableOn : e.magnificPopup.defaults.disableOn; if (a) if (e.isFunction(a)) { if (!a.call(t)) return !0 } else if (a > I.width()) return !0; n.type && (n.preventDefault(), t.isOpen && n.stopPropagation()), o.el = e(n.mfpEl), o.delegate && (o.items = i.find(o.delegate)), t.open(o) } }, updateStatus: function(e, i) { if (t.preloader) { n !== e && t.container.removeClass("mfp-s-" + n), i || "loading" !== e || (i = t.st.tLoading); var o = { status: e, text: i }; T("UpdateStatus", o), e = o.status, i = o.text, t.preloader.html(i), t.preloader.find("a").on("click", function(e) { e.stopImmediatePropagation() }), t.container.addClass("mfp-s-" + e), n = e } }, _checkIfClose: function(n) { if (!e(n).hasClass(y)) { var i = t.st.closeOnContentClick, o = t.st.closeOnBgClick; if (i && o) return !0; if (!t.content || e(n).hasClass("mfp-close") || t.preloader && n === t.preloader[0]) return !0; if (n === t.content[0] || e.contains(t.content[0], n)) { if (i) return !0 } else if (o && e.contains(document, n)) return !0; return !1 } }, _addClassToMFP: function(e) { t.bgOverlay.addClass(e), t.wrap.addClass(e) }, _removeClassFromMFP: function(e) { this.bgOverlay.removeClass(e), t.wrap.removeClass(e) }, _hasScrollBar: function(e) { return (t.isIE7 ? o.height() : document.body.scrollHeight) > (e || I.height()) }, _setFocus: function() { (t.st.focus ? t.content.find(t.st.focus).eq(0) : t.wrap).focus() }, _onFocusIn: function(n) { return n.target === t.wrap[0] || e.contains(t.wrap[0], n.target) ? void 0 : (t._setFocus(), !1) }, _parseMarkup: function(t, n, i) { var o; i.data && (n = e.extend(i.data, n)), T(p, [t, n, i]), e.each(n, function(e, n) { if (void 0 === n || n === !1) return !0; if (o = e.split("_"), o.length > 1) { var i = t.find(h + "-" + o[0]); if (i.length > 0) { var r = o[1]; "replaceWith" === r ? i[0] !== n[0] && i.replaceWith(n) : "img" === r ? i.is("img") ? i.attr("src", n) : i.replaceWith('') : i.attr(o[1], n) } } else t.find(h + "-" + e).html(n) }) }, _getScrollbarSize: function() { if (void 0 === t.scrollbarSize) { var e = document.createElement("div"); 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) } return t.scrollbarSize } }, e.magnificPopup = { instance: null, proto: w.prototype, modules: [], open: function(t, n) { return _(), t = t ? e.extend(!0, {}, t) : {}, t.isObj = !0, t.index = n || 0, this.instance.open(t) }, close: function() { return e.magnificPopup.instance && e.magnificPopup.instance.close() }, registerModule: function(t, n) { n.options && (e.magnificPopup.defaults[t] = n.options), e.extend(this.proto, n.proto), this.modules.push(t) }, defaults: { disableOn: 0, key: null, midClick: !1, mainClass: "", preloader: !0, focus: "", closeOnContentClick: !1, closeOnBgClick: !0, closeBtnInside: !0, showCloseBtn: !0, enableEscapeKey: !0, modal: !1, alignTop: !1, removalDelay: 0, prependTo: null, fixedContentPos: "auto", fixedBgPos: "auto", overflowY: "auto", closeMarkup: '', tClose: "Close (Esc)", tLoading: "Loading..." } }, e.fn.magnificPopup = function(n) { _(); var i = e(this); if ("string" == typeof n) if ("open" === n) { var o, r = b ? i.data("magnificPopup") : i[0].magnificPopup, a = parseInt(arguments[1], 10) || 0; 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) } 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); return i }; var P, O, z, M = "inline", B = function() { z && (O.after(z.addClass(P)).detach(), z = null) }; e.magnificPopup.registerModule(M, { options: { hiddenClass: "hide", markup: "", tNotFound: "Content not found" }, proto: { initInline: function() { t.types.push(M), x(l + "." + M, function() { B() }) }, getInline: function(n, i) { if (B(), n.src) { var o = t.st.inline, r = e(n.src); if (r.length) { var a = r[0].parentNode; a && a.tagName && (O || (P = o.hiddenClass, O = k(P), P = "mfp-" + P), z = r.after(O).detach().removeClass(P)), t.updateStatus("ready") } else t.updateStatus("error", o.tNotFound), r = e("
"); return n.inlineElement = r, r } return t.updateStatus("ready"), t._parseMarkup(i, {}, n), i } } }); var F, H = "ajax", L = function() { F && i.removeClass(F) }, A = function() { L(), t.req && t.req.abort() }; e.magnificPopup.registerModule(H, { options: { settings: null, cursor: "mfp-ajax-cur", tError: 'The content could not be loaded.' }, proto: { initAjax: function() { t.types.push(H), F = t.st.ajax.cursor, x(l + "." + H, A), x("BeforeChange." + H, A) }, getAjax: function(n) { F && i.addClass(F), t.updateStatus("loading"); var o = e.extend({ url: n.src, success: function(i, o, r) { var a = { data: i, xhr: r }; T("ParseAjax", a), t.appendContent(e(a.data), H), n.finished = !0, L(), t._setFocus(), setTimeout(function() { t.wrap.addClass(v) }, 16), t.updateStatus("ready"), T("AjaxContentAdded") }, error: function() { L(), n.finished = n.loadError = !0, t.updateStatus("error", t.st.ajax.tError.replace("%url%", n.src)) } }, t.st.ajax.settings); return t.req = e.ajax(o), "" } } }); var j, N = function(n) { if (n.data && void 0 !== n.data.title) return n.data.title; var i = t.st.image.titleSrc; if (i) { if (e.isFunction(i)) return i.call(t, n); if (n.el) return n.el.attr(i) || "" } return "" }; e.magnificPopup.registerModule("image", { options: { markup: '
', cursor: "mfp-zoom-out-cur", titleSrc: "title", verticalFit: !0, tError: 'The image could not be loaded.' }, proto: { initImage: function() { var e = t.st.image, n = ".image"; t.types.push("image"), x(f + n, function() { "image" === t.currItem.type && e.cursor && i.addClass(e.cursor) }), x(l + n, function() { e.cursor && i.removeClass(e.cursor), I.off("resize" + h) }), x("Resize" + n, t.resizeImage), t.isLowIE && x("AfterChange", t.resizeImage) }, resizeImage: function() { var e = t.currItem; if (e && e.img && t.st.image.verticalFit) { var n = 0; 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) } }, _onImageHasSize: function(e) { 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)) }, findImageSize: function(e) { var n = 0, i = e.img[0], o = function(r) { j && clearInterval(j), j = setInterval(function() { 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) }, r) }; o(1) }, getImage: function(n, i) { var o = 0, r = function() { 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())) }, a = function() { 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) }, s = t.st.image, l = i.find(".mfp-img"); if (l.length) { var c = document.createElement("img"); 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) } return t._parseMarkup(i, { title: N(n), img_replaceWith: n.img }, 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) } } }); var W, R = function() { return void 0 === W && (W = void 0 !== document.createElement("p").style.MozTransform), W }; e.magnificPopup.registerModule("zoom", { options: { enabled: !1, easing: "ease-in-out", duration: 300, opener: function(e) { return e.is("img") ? e : e.find("img") } }, proto: { initZoom: function() { var e, n = t.st.zoom, i = ".zoom"; if (n.enabled && t.supportsTransition) { var o, r, a = n.duration, s = function(e) { var t = e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"), i = "all " + n.duration / 1e3 + "s " + n.easing, o = { position: "fixed", zIndex: 9999, left: 0, top: 0, "-webkit-backface-visibility": "hidden" }, r = "transition"; return o["-webkit-" + r] = o["-moz-" + r] = o["-o-" + r] = o[r] = i, t.css(o), t }, d = function() { t.content.css("visibility", "visible") }; x("BuildControls" + i, function() { if (t._allowZoom()) { if (clearTimeout(o), t.content.css("visibility", "hidden"), e = t._getItemToZoom(), !e) return d(), void 0; r = s(e), r.css(t._getOffset()), t.wrap.append(r), o = setTimeout(function() { r.css(t._getOffset(!0)), o = setTimeout(function() { d(), setTimeout(function() { r.remove(), e = r = null, T("ZoomAnimationEnded") }, 16) }, a) }, 16) } }), x(c + i, function() { if (t._allowZoom()) { if (clearTimeout(o), t.st.removalDelay = a, !e) { if (e = t._getItemToZoom(), !e) return; r = s(e) } r.css(t._getOffset(!0)), t.wrap.append(r), t.content.css("visibility", "hidden"), setTimeout(function() { r.css(t._getOffset()) }, 16) } }), x(l + i, function() { t._allowZoom() && (d(), r && r.remove(), e = null) }) } }, _allowZoom: function() { return "image" === t.currItem.type }, _getItemToZoom: function() { return t.currItem.hasSize ? t.currItem.img : !1 }, _getOffset: function(n) { var i; i = n ? t.currItem.img : t.st.zoom.opener(t.currItem.el || t.currItem); var o = i.offset(), r = parseInt(i.css("padding-top"), 10), a = parseInt(i.css("padding-bottom"), 10); o.top -= e(window).scrollTop() - r; var s = { width: i.width(), height: (b ? i.innerHeight() : i[0].offsetHeight) - a - r }; return R() ? s["-moz-transform"] = s.transform = "translate(" + o.left + "px," + o.top + "px)" : (s.left = o.left, s.top = o.top), s } } }); var Z = "iframe", q = "//about:blank", D = function(e) { if (t.currTemplate[Z]) { var n = t.currTemplate[Z].find("iframe"); n.length && (e || (n[0].src = q), t.isIE8 && n.css("display", e ? "block" : "none")) } }; e.magnificPopup.registerModule(Z, { options: { markup: '
', srcAction: "iframe_src", patterns: { youtube: { index: "youtube.com", id: "v=", src: "//www.youtube.com/embed/%id%?autoplay=1" }, vimeo: { index: "vimeo.com/", id: "/", src: "//player.vimeo.com/video/%id%?autoplay=1" }, gmaps: { index: "//maps.google.", src: "%id%&output=embed" } } }, proto: { initIframe: function() { t.types.push(Z), x("BeforeChange", function(e, t, n) { t !== n && (t === Z ? D() : n === Z && D(!0)) }), x(l + "." + Z, function() { D() }) }, getIframe: function(n, i) { var o = n.src, r = t.st.iframe; e.each(r.patterns, function() { 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 }); var a = {}; return r.srcAction && (a[r.srcAction] = o), t._parseMarkup(i, a, n), t.updateStatus("ready"), i } } }); var K = function(e) { var n = t.items.length; return e > n - 1 ? e - n : 0 > e ? n + e : e }, Y = function(e, t, n) { return e.replace(/%curr%/gi, t + 1).replace(/%total%/gi, n) }; e.magnificPopup.registerModule("gallery", { options: { enabled: !1, arrowMarkup: '', preload: [0, 2], navigateByImgClick: !0, arrows: !0, tPrev: "Previous (Left arrow key)", tNext: "Next (Right arrow key)", tCounter: "%curr% of %total%" }, proto: { initGallery: function() { var n = t.st.gallery, i = ".mfp-gallery", r = Boolean(e.fn.mfpFastClick); return t.direction = !0, n && n.enabled ? (a += " mfp-gallery", x(f + i, function() { n.navigateByImgClick && t.wrap.on("click" + i, ".mfp-img", function() { return t.items.length > 1 ? (t.next(), !1) : void 0 }), o.on("keydown" + i, function(e) { 37 === e.keyCode ? t.prev() : 39 === e.keyCode && t.next() }) }), x("UpdateStatus" + i, function(e, n) { n.text && (n.text = Y(n.text, t.currItem.index, t.items.length)) }), x(p + i, function(e, i, o, r) { var a = t.items.length; o.counter = a > 1 ? Y(n.tCounter, r.index, a) : "" }), x("BuildControls" + i, function() { if (t.items.length > 1 && n.arrows && !t.arrowLeft) { 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"; o[s](function() { t.prev() }), a[s](function() { t.next() }), 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)) } }), x(m + i, function() { t._preloadTimeout && clearTimeout(t._preloadTimeout), t._preloadTimeout = setTimeout(function() { t.preloadNearbyImages(), t._preloadTimeout = null }, 16) }), x(l + i, function() { o.off(i), t.wrap.off("click" + i), t.arrowLeft && r && t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(), t.arrowRight = t.arrowLeft = null }), void 0) : !1 }, next: function() { t.direction = !0, t.index = K(t.index + 1), t.updateItemHTML() }, prev: function() { t.direction = !1, t.index = K(t.index - 1), t.updateItemHTML() }, goTo: function(e) { t.direction = e >= t.index, t.index = e, t.updateItemHTML() }, preloadNearbyImages: function() { var e, n = t.st.gallery.preload, i = Math.min(n[0], t.items.length), o = Math.min(n[1], t.items.length); for (e = 1; (t.direction ? o : i) >= e; e++) t._preloadItem(t.index + e); for (e = 1; (t.direction ? i : o) >= e; e++) t._preloadItem(t.index - e) }, _preloadItem: function(n) { if (n = K(n), !t.items[n].preloaded) { var i = t.items[n]; i.parsed || (i = t.parseEl(n)), T("LazyLoad", i), "image" === i.type && (i.img = e('').on("load.mfploader", function() { i.hasSize = !0 }).on("error.mfploader", function() { i.hasSize = !0, i.loadError = !0, T("LazyLoadError", i) }).attr("src", i.src)), i.preloaded = !0 } } } }); var U = "retina"; e.magnificPopup.registerModule(U, { options: { replaceSrc: function(e) { return e.src.replace(/\.\w+$/, function(e) { return "@2x" + e }) }, ratio: 1 }, proto: { initRetina: function() { if (window.devicePixelRatio > 1) { var e = t.st.retina, n = e.ratio; n = isNaN(n) ? n() : n, n > 1 && (x("ImageHasSize." + U, function(e, t) { t.img.css({ "max-width": t.img[0].naturalWidth / n, width: "100%" }) }), x("ElementParse." + U, function(t, i) { i.src = e.replaceSrc(i, n) })) } } } }), function() { var t = 1e3, n = "ontouchstart" in window, i = function() { I.off("touchmove" + r + " touchend" + r) }, o = "mfpFastClick", r = "." + o; e.fn.mfpFastClick = function(o) { return e(this).each(function() { var a, s = e(this); if (n) { var l, c, d, u, p, f; s.on("touchstart" + r, function(e) { 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) { 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()) }).on("touchend" + r, function(e) { i(), u || f > 1 || (a = !0, e.preventDefault(), clearTimeout(l), l = setTimeout(function() { a = !1 }, t), o()) }) }) } s.on("click" + r, function() { a || o() }) }) }, e.fn.destroyMfpFastClick = function() { e(this).off("touchstart" + r + " click" + r), n && I.off("touchmove" + r + " touchend" + r) } }(), _() })(window.jQuery || window.Zepto);; function NoMoreMaps() { $ = jQuery; return { postsPromise: null, maxPagesInCache: 32, mapStyle: [{ "featureType": "water", "elementType": "all", "stylers": [{ "hue": "#7fc8ed" }, { "saturation": 55 }, { "lightness": -6 }, { "visibility": "on" }] }, { "featureType": "water", "elementType": "labels", "stylers": [{ "hue": "#7fc8ed" }, { "saturation": 55 }, { "lightness": -6 }, { "visibility": "off" }] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [{ "hue": "#83cead" }, { "saturation": 1 }, { "lightness": -15 }, { "visibility": "on" }] }, { "featureType": "landscape", "elementType": "geometry", "stylers": [{ "hue": "#f3f4f4" }, { "saturation": -84 }, { "lightness": 59 }, { "visibility": "on" }] }, { "featureType": "landscape", "elementType": "labels", "stylers": [{ "hue": "#ffffff" }, { "saturation": -100 }, { "lightness": 100 }, { "visibility": "off" }] }, { "featureType": "road", "elementType": "geometry", "stylers": [{ "hue": "#ffffff" }, { "saturation": -100 }, { "lightness": 100 }, { "visibility": "on" }] }, { "featureType": "road", "elementType": "labels", "stylers": [{ "hue": "#bbbbbb" }, { "saturation": -100 }, { "lightness": 26 }, { "visibility": "on" }] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [{ "hue": "#ffcc00" }, { "saturation": 100 }, { "lightness": -35 }, { "visibility": "simplified" }] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [{ "hue": "#ffcc00" }, { "saturation": 100 }, { "lightness": -22 }, { "visibility": "on" }] }, { "featureType": "poi.school", "elementType": "all", "stylers": [{ "hue": "#d7e4e4" }, { "saturation": -60 }, { "lightness": 23 }, { "visibility": "on" }] }], mapInfoWindowWidth: 200, scrollOffset: 100, iframeTrackingInterval: 2500, init: function() { this.initLanguageSwitchMenu(); this.initPostsCache(); this.initTracking(); this.initExperiments(); this.initGoogleMaps(); this.initPostLinkToMap(); this.initTooltips(); this.initVerticalImages(); this.initFoundation(); this.initVideoWidget(); this.initPostsNavigation(); this.initLightbox(); this.initCookiesAlert(); this.initLinkToNewsletter(); this.initCommentForm(); }, initLanguageSwitchMenu: function() { var clone = $('.lang-item-wrapper > .menu').clone(); if (clone.size() > 0) $('.top-bar-title').append(clone); }, initVideoWidget: function() { $('#sidebar-video-modal').on('open.zf.reveal', function(e) { var wnd = $(e.currentTarget); var script = wnd.find('#video-modal-code'); if (script.size() <= 0) return; script.after(script.html()); }).on('closed.zf.reveal', function(e) { var wnd = $(e.currentTarget); wnd.find('.flex-video').remove(); }); }, initPostsNavigation: function() { if (!this.postsPromise) { var d = $.Deferred(); this.postsPromise = d.promise(); d.resolve(true); } $('.load-posts-btn').click(this.onLoadPostsButtonClick.bind(this)); }, onLoadPostsButtonClick: function(e) { var btn = $(e.currentTarget); var query = btn.attr('data-query'); var page = btn.data('page'); if (!page) page = 1; page++; var data = { action: 'get_posts', query: query, page: page }; var d = $.ajax('_p/' + page + '.html', { method: 'GET', data: data }); btn.prop('disabled', true); btn.find('.load-posts-idle').hide(); btn.find('.load-posts-active').show(); this.postsPromise.always(function() { d.then(this.onPostsLoaded.bind(this, btn, page)).always(function() { this.postsPromise = d; }.bind(this)); }.bind(this)); }, onPostsLoaded: function(btn, page, response, status, xhr) { btn.prop('disabled', false); btn.find('.load-posts-idle').show(); btn.find('.load-posts-active').hide(); if (response) { $('#posts').append(response); btn.data('page', page); var max = parseInt(btn.attr('data-max-pages'), 10); if (page >= max) btn.hide(); this.setCache(page, response); $('#posts img').off('load').on('load', function() { $('.sticky').foundation('_calc', true); }); $('.sticky').foundation('_calc', true); } }, setCache: function(page, response) { if (!sessionStorage) return false; var cache = sessionStorage.getItem('cache'); if (!cache) cache = []; else cache = JSON.parse(cache); var key = window.location.href; var pageCache = null; for (var i = 0; i < cache.length; i++) { if (cache[i].url == key) { pageCache = cache[i]; break; } } if (!pageCache) { pageCache = { page: page, cache: response, ts: Date.now(), url: key }; cache.push(pageCache); } else { pageCache.page = page; pageCache.cache += response; pageCache.ts = Date.now(); } if (cache.length > this.maxPagesInCache) { cache.sort(function(a, b) { b.ts - a.ts; }); cache.splice(this.maxPagesInCache, cache.length); } sessionStorage.setItem('cache', JSON.stringify(cache)); }, initPostsCache: function() { var posts = $('#posts'); if (posts.size() <= 0 || !sessionStorage) return false; var key = window.location.href; var cache = sessionStorage.getItem('cache'); if (!cache) return false; cache = JSON.parse(cache); for (var i = 0; i < cache.length; i++) { if (cache[i].url == key) { var btn = $('.load-posts-btn'); btn.data('page', cache[i].page); var max = parseInt(btn.attr('data-max-pages'), 10); posts.append(cache[i].cache); if (cache[i].page >= max) btn.hide(); break; } } }, initGoogleMaps: function() { this.mapStyle = new google.maps.StyledMapType(this.mapStyle, { name: 'Styled' }); $('body').find('.google-map').each($.proxy(function(index, el) { this.renderGoogleMap($(el)); }, this)); }, renderGoogleMap: function(el) { var markers = el.find('.marker'); var zoom = el.attr('data-zoom'); if (!zoom) zoom = 16; else zoom = parseInt(zoom, 10); var lat = el.attr('data-lat'); var lng = el.attr('data-lng'); var args = { zoom: zoom, center: new google.maps.LatLng(lat, lng), mapTypeControlOptions: { mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain', 'nmm'] }, scrollwheel: false }; var map = new google.maps.Map(el[0], args); map.mapTypes.set('nmm', this.mapStyle); map.setMapTypeId('nmm'); map.markers = []; markers.each($.proxy(function(index, el) { this.addGoogleMapMarker($(el), map); }, this)); el.data('google-map', map); el.addClass('ready'); }, addGoogleMapMarker: function(marker, map) { var latlng = new google.maps.LatLng(marker.attr('data-lat'), marker.attr('data-lng')); var m = new google.maps.Marker({ position: latlng, map: map, title: marker.attr('data-title') }); m.content = marker.html(); map.markers.push(m); google.maps.event.addListener(m, 'click', this.onGoogleMapMarkerClick.bind(this, map, m)); }, onGoogleMapMarkerClick: function(map, marker, e) { if (!map.wnd) { map.wnd = new google.maps.InfoWindow({ content: marker.content, maxWidth: this.mapInfoWindowWidth }); } else { map.wnd.setContent(marker.content); } map.wnd.open(map, marker); }, initTracking: function() { $('.subscription_btn,.form_subscribe_button').click(function() { ga('send', 'event', 'link', 'click', 'Email subscription', 1); }); $('#commentform #submit').click(function() { ga('send', 'event', 'link', 'click', 'post comment', 1); }); $('button[data-open="contact-modal"]').click(function() { ga('send', 'event', 'link', 'click', 'contact', 1); }); $('.load-posts-btn').click(function(event) { var btn = $(event.currentTarget); var page = btn.data('page'); if (!page) page = 1; ga('send', 'event', 'load-post', 'click', window.location.href, page); }); $('a[href*="booking.com"]').click(function(event) { var label = $(event.currentTarget).html().replace(/<\/?[^>]+(>|$)/g, ""); ga('send', 'event', 'booking', 'click', label, 1); }); this.bookingInterval = setInterval(this.initIframeTracking.bind(this, '.bookingaff', 'bookingInterval', function() { ga('send', 'event', 'booking', 'click', 'widget', 1); }), this.iframeTrackingInterval); }, initIframeTracking: function(selector, intervalPropertyName, trackingFunction) { var iframes = $(selector + ' iframe'); if ($(selector).size() <= iframes.size()) { if (this[intervalPropertyName]) { clearInterval(this[intervalPropertyName]); this[intervalPropertyName] = null; } iframes.each(function(index, iframe) { $(iframe).iframeTracker({ blurCallback: trackingFunction.bind(this) }); }.bind(this)); } }, initExperiments: function() { var cls = 'experiment-default'; var match = location.search.match(/(\?|\&)exp\=([^&]+)/); if (match && match.length > 2) cls = 'experiment-' + match[2]; var els = $('.' + cls); if (els.size() > 0) els.show(); }, isLarge: function() { return $(window).width() > 1024; }, isMedium: function() { var width = $(window).width(); return width > 640 && width <= 1024; }, isSmall: function() { return $(window).width() <= 640; }, initCookiesAlert: function() { var a = $('#cookies-alert'); if (a.size() > 0) { a.find('.close-button').click(function() { $.cookie('cookie_alert', '1', { expires: 99999, path: '/' }); }); } }, initFoundation: function() { $(document).foundation(); }, translateLightbox: function() { $.extend(true, $.magnificPopup.defaults, { tClose: 'Zamknij (Esc)', tLoading: 'Wczytywanie obrazu...', gallery: { tPrev: 'Poprzedni (Klawisz ←)', tNext: 'Następny (Klawisz →)', tCounter: '%curr% z %total%' }, image: { tError: 'Obraz jest niedostępny.' }, ajax: { tError: 'Zawartość jest niedostępna.' } }); }, initLightbox: function() { this.translateLightbox(); $('.lightbox').each($.proxy(function(index, el) { var wrapper = $(el); if (wrapper.is('a')) { var gallery = wrapper.attr('data-gallery'); var galleryEl = null; if (gallery) { galleryEl = $('#' + gallery); if (galleryEl.size() > 0) { var items = []; galleryEl.find('option').each($.proxy(function(i, option) { items.push({ src: $(option).attr('value'), title: $(option).attr('data-caption') }); }, this)); wrapper.magnificPopup({ items: items, gallery: { enabled: true }, type: 'image' }); } } else { wrapper.magnificPopup({ type: 'image' }); } } else { wrapper.magnificPopup({ delegate: 'a.lbox', type: 'image', gallery: { enabled: true } }); } }, this)); }, initPostLinkToMap: function() { var post = $('#post'); if (post.size() > 0) { post.find('[data-show-map]').each(function(index, i) { var el = $(i); el.click(function(event) { $('#map-button-text-1').addClass('hide'); $('#map-button-text-2').removeClass('hide'); $('#post-thumb').addClass('hidden'); this.scrollTo($('#post-google-map').addClass('visible')); event.preventDefault(); return false; }.bind(this)); }.bind(this)); } }, scrollTo: function(el) { var d = $.Deferred(); if (el.size() < 0) { d.reject(); return d.promise(); } var offset = el.offset(); var wnd = $(window); var wndTop = wnd.scrollTop(); var wndHeight = wnd.height(); var wndBottom = wndTop + wndHeight; var height = el.height(); var bottom = offset.top + height; if (offset.top < wndTop || bottom > wndBottom) { var edge = offset.top - this.scrollOffset; if (edge < 0) edge = 0; $('html,body').animate({ scrollTop: (edge + 'px') }, 300, 'swing', function() { d.resolve(true); }.bind(this)); } else { d.resolve(false); } return d.promise(); }, initLinkToNewsletter: function() { $('a[href="#newsletter-widget"]').each(function(index, i) { var el = $(i); el.click(function(event) { var el = $(event.currentTarget); var target = $(el.attr('href')); if (target.size() > 0) { this.scrollTo(target).then(function() { target.addClass('highlight'); setTimeout(function() { target.removeClass('highlight'); }.bind(this), 300); var input = target.find('input[type="email"],input[type="text"]'); if (input.size() > 0) input.focus(); }.bind(this)); } event.preventDefault(); return false; }.bind(this)); }.bind(this)); }, initCommentForm: function() { var ta = $('#comment'); if (ta.size() > 0) { ta.blur(function(event) { var ta = $(event.currentTarget); if (ta.val()) ta.addClass('has-content'); }); } }, initTooltips: function() { $('.has-tip').each(function(index, el) { $(el).attr('data-tooltip', ''); }); }, initVerticalImages: function() { $('#post-content img').each(function(index, el) { var img = $(el); var h = img.attr('height'); var w = img.attr('width'); if (h && w) { var hm = h.match(/^\d+$/); var wm = w.match(/^\d+$/); if (hm && wm && hm.length >= 1 && wm.length >= 1) { var height = parseInt(h, 10); var width = parseInt(w, 10); if (height > width) { var c = img.closest('.wp-caption'); if (c.size() > 0) c.addClass('vertical'); } } } }); } }.init(); } jQuery(NoMoreMaps);; /*! * Angular Datepicker v2.1.10 * * Released by 720kb.net under the MIT license * www.opensource.org/licenses/MIT * * 2017-01-17 */ ! function(a, b) { "use strict"; var c = 864e5, d = function() { if (b.userAgent && (b.userAgent.match(/Android/i) || b.userAgent.match(/webOS/i) || b.userAgent.match(/iPhone/i) || b.userAgent.match(/iPad/i) || b.userAgent.match(/iPod/i) || b.userAgent.match(/BlackBerry/i) || b.userAgent.match(/Windows Phone/i))) return !0 }(), e = function(a, b, c) { return c && (d = !1), d ? ['
', '
', '", "
", "
", '
', '
', '", "
", "
"] : ['
', '
', '', a, "", "
", '
', "{{month}} ", '', "", "{{year}}", "", "", "", "
", '
', '', b, "", "
", "
"] }, f = function(a, b) { return ['
', '", '
', '', a, "", '', b, "", "
", "
"] }, g = function() { return ['
', '
', "{{d}}", "
", "
"] }, h = function() { return ['
', '', "{{px}}", "", "", "{{item}}", "", '', "{{nx}}", "", "
"] }, i = function(a, b, c) { var d = ['
', "
"], i = e(a, b, c), j = f(a, b), k = g(), l = h(), m = function(a) { d.splice(d.length - 1, 0, a) }; return i.forEach(m), j.forEach(m), k.forEach(m), l.forEach(m), d.join("") }, j = function(b, e, f, g, h, j) { var k = function(k, l, m) { var n, o, p, q = m.selector, r = a.element(q ? l[0].querySelector("." + q) : l[0].children[0]), s = '', t = '', u = m.buttonPrev || s, v = m.buttonNext || t, w = m.dateFormat, x = k.$eval(k.dateDisabledDates), y = new Date, z = !1, A = !1, B = "undefined" != typeof m.datepickerMobile && "false" !== m.datepickerMobile, C = f.DATETIME_FORMATS, D = 864e5, E = i(u, v, B), F = function() { z || A || !n || k.hideCalendar() }, G = function(a, b) { var c, d, e, f, g, h = new Date(b, a, 0).getDate(), i = new Date(b + "/" + a + "/1").getDay(), j = new Date(b + "/" + a + "/" + h).getDay(), l = [], m = []; for (k.days = [], k.dateWeekStartDay = k.validateWeekDay(k.dateWeekStartDay), g = (k.dateWeekStartDay + 6) % 7, c = 1; c <= h; c += 1) k.days.push(c); if (i === k.dateWeekStartDay) k.prevMonthDays = []; else { for (e = i - k.dateWeekStartDay, i < k.dateWeekStartDay && (e += 7), f = 1 === Number(a) ? 12 : a - 1, c = 1; c <= new Date(b, f, 0).getDate(); c += 1) l.push(c); k.prevMonthDays = l.slice(-e) } if (j === g) k.nextMonthDays = []; else { for (d = 6 - j + k.dateWeekStartDay, j < k.dateWeekStartDay && (d -= 7), c = 1; c <= d; c += 1) m.push(c); k.nextMonthDays = m } }, H = function() { k.month = g("date")(new Date(k.dateMinLimit), "MMMM"), k.monthNumber = Number(g("date")(new Date(k.dateMinLimit), "MM")), k.day = Number(g("date")(new Date(k.dateMinLimit), "dd")), k.year = Number(g("date")(new Date(k.dateMinLimit), "yyyy")), G(k.monthNumber, k.year) }, I = function() { k.month = g("date")(new Date(k.dateMaxLimit), "MMMM"), k.monthNumber = Number(g("date")(new Date(k.dateMaxLimit), "MM")), k.day = Number(g("date")(new Date(k.dateMaxLimit), "dd")), k.year = Number(g("date")(new Date(k.dateMaxLimit), "yyyy")), G(k.monthNumber, k.year) }, J = function() { k.year = Number(k.year) - 1 }, K = function() { k.year = Number(k.year) + 1 }, L = function() { if (!k.isSelectableMinDate(k.year + "/" + k.monthNumber + "/" + k.day) || !k.isSelectableMaxDate(k.year + "/" + k.monthNumber + "/" + k.day)) return !1; var a = new Date(k.year + "/" + k.monthNumber + "/" + k.day); m.dateFormat ? r.val(g("date")(a, w)) : r.val(a), r.triggerHandler("input"), r.triggerHandler("change") }, M = { add: function(a, b) { var c; a.className.indexOf(b) > -1 || (c = a.className.split(" "), c.push(b), a.className = c.join(" ")) }, remove: function(a, b) { var c, d; if (a.className.indexOf(b) !== -1) { for (d = a.className.split(" "), c = 0; c < d.length; c += 1) if (d[c] === b) { d = d.slice(0, c).concat(d.slice(c + 1)); break } a.className = d.join(" ") } } }, N = function() { o = b.document.getElementsByClassName("_720kb-datepicker-calendar"), a.forEach(o, function(a, b) { o[b].classList ? o[b].classList.remove("_720kb-datepicker-open") : M.remove(o[b], "_720kb-datepicker-open") }), n.classList ? n.classList.add("_720kb-datepicker-open") : M.add(n, "_720kb-datepicker-open") }, O = function() { return !k.datepickerToggle || k.$eval(k.datepickerToggle) }, P = function() { return !!k.datepickerShow && k.$eval(k.datepickerShow) }, Q = k.$watch("dateSet", function(a) { a && (y = new Date(a), k.month = g("date")(y, "MMMM"), k.monthNumber = Number(g("date")(y, "MM")), k.day = Number(g("date")(y, "dd")), k.year = Number(g("date")(y, "yyyy")), G(k.monthNumber, k.year), "true" !== k.dateSetHidden && L()) }), R = k.$watch("dateMinLimit", function(a) { a && H() }), S = k.$watch("dateMaxLimit", function(a) { a && I() }), T = k.$watch("dateFormat", function(a) { a && L() }); for (k.nextMonth = function() { 12 === k.monthNumber ? (k.monthNumber = 1, K()) : k.monthNumber += 1, k.dateMaxLimit && (k.isSelectableMaxDate(k.year + "/" + k.monthNumber + "/" + k.days[0]) || I()), k.month = g("date")(new Date(k.year, k.monthNumber - 1), "MMMM"), G(k.monthNumber, k.year), k.day = void 0 }, k.willPrevMonthBeSelectable = function() { var a = k.monthNumber, b = k.year, c = g("date")(new Date(new Date(b + "/" + a + "/01").getTime() - D), "dd"); return 1 === a ? (a = 12, b -= 1) : a -= 1, !(k.dateMinLimit && !k.isSelectableMinDate(b + "/" + a + "/" + c)) }, k.willNextMonthBeSelectable = function() { var a = k.monthNumber, b = k.year; return 12 === a ? (a = 1, b += 1) : a += 1, !(k.dateMaxLimit && !k.isSelectableMaxDate(b + "/" + a + "/01")) }, k.prevMonth = function() { 1 === k.monthNumber ? (k.monthNumber = 12, J()) : k.monthNumber -= 1, k.dateMinLimit && (k.isSelectableMinDate(k.year + "/" + k.monthNumber + "/" + k.days[k.days.length - 1]) || H()), k.month = g("date")(new Date(k.year, k.monthNumber - 1), "MMMM"), G(k.monthNumber, k.year), k.day = void 0 }, k.selectedMonthHandle = function(a) { k.monthNumber = Number(g("date")(new Date(a + "/01/2000"), "MM")), G(k.monthNumber, k.year), L() }, k.setNewYear = function(a) { if (d || (k.day = void 0), k.dateMaxLimit && k.year < Number(a)) { if (!k.isSelectableMaxYear(a)) return } else if (k.dateMinLimit && k.year > Number(a) && !k.isSelectableMinYear(a)) return; k.paginateYears(a), k.showYearsPagination = !1, j(function() { k.year = Number(a), G(k.monthNumber, k.year) }, 0) }, k.hideCalendar = function() { n.classList ? n.classList.remove("_720kb-datepicker-open") : M.remove(n, "_720kb-datepicker-open") }, k.setDatepickerDay = function(a) { k.isSelectableDate(k.monthNumber, k.year, a) && k.isSelectableMaxDate(k.year + "/" + k.monthNumber + "/" + a) && k.isSelectableMinDate(k.year + "/" + k.monthNumber + "/" + a) && (k.day = Number(a), k.selectedDay = k.day, k.selectedMonth = k.monthNumber, k.selectedYear = k.year, L(), m.hasOwnProperty("dateRefocus") && r[0].focus(), k.hideCalendar()) }, k.paginateYears = function(a) { var b, c = [], e = 10, f = 10; for (k.paginationYears = [], d && (e = 50, f = 50, k.dateMinLimit && k.dateMaxLimit && (a = new Date(k.dateMaxLimit).getFullYear(), e = a - new Date(k.dateMinLimit).getFullYear(), f = 1)), b = e; b > 0; b -= 1) c.push(Number(a) - b); for (b = 0; b < f; b += 1) c.push(Number(a) + b); "true" === k.dateTyper && r.on("keyup blur", function() { if (r[0].value && r[0].value.length && r[0].value.length > 0) try { y = w ? new Date(g("date")(r[0].value.toString(), w)) : new Date(r[0].value.toString()), y.getFullYear() && !isNaN(y.getDay()) && !isNaN(y.getMonth()) && k.isSelectableDate(y) && k.isSelectableMaxDate(y) && k.isSelectableMinDate(y) && k.$apply(function() { k.month = g("date")(y, "MMMM"), k.monthNumber = Number(g("date")(y, "MM")), k.day = Number(g("date")(y, "dd")), 4 === y.getFullYear().toString().length && (k.year = Number(g("date")(y, "yyyy"))), G(k.monthNumber, k.year) }) } catch (a) { return a } }), k.dateMaxLimit && c && c.length && !k.isSelectableMaxYear(Number(c[c.length - 1]) + 1) ? k.paginationYearsNextDisabled = !0 : k.paginationYearsNextDisabled = !1, k.dateMinLimit && c && c.length && !k.isSelectableMinYear(Number(c[0]) - 1) ? k.paginationYearsPrevDisabled = !0 : k.paginationYearsPrevDisabled = !1, k.paginationYears = c }, k.isSelectableDate = function(a, b, c) { var d = 0; if (x && x.length > 0) for (d; d <= x.length; d += 1) if (new Date(x[d]).getTime() === new Date(a + "/" + c + "/" + b).getTime()) return !1; return !0 }, k.isSelectableMinDate = function(a) { return !(k.dateMinLimit && new Date(k.dateMinLimit) && new Date(a).getTime() < new Date(k.dateMinLimit).getTime()) }, k.isSelectableMaxDate = function(a) { return !(k.dateMaxLimit && new Date(k.dateMaxLimit) && new Date(a).getTime() > new Date(k.dateMaxLimit).getTime()) }, k.isSelectableMaxYear = function(a) { return !(k.dateMaxLimit && a > new Date(k.dateMaxLimit).getFullYear()) }, k.isSelectableMinYear = function(a) { return !(k.dateMinLimit && a < new Date(k.dateMinLimit).getFullYear()) }, k.validateWeekDay = function(a) { var b = Number(a, 10); return (!b || b < 0 || b > 6) && (b = 0), b }, E = E.replace(/{{/g, h.startSymbol()).replace(/}}/g, h.endSymbol()), k.dateMonthTitle = k.dateMonthTitle || "Select month", k.dateYearTitle = k.dateYearTitle || "Select year", k.buttonNextTitle = k.buttonNextTitle || "Next", k.buttonPrevTitle = k.buttonPrevTitle || "Prev", k.month = g("date")(y, "MMMM"), k.monthNumber = Number(g("date")(y, "MM")), k.day = Number(g("date")(y, "dd")), k.dateWeekStartDay = k.validateWeekDay(k.dateWeekStartDay), k.dateMaxLimit ? k.year = Number(g("date")(new Date(k.dateMaxLimit), "yyyy")) : k.year = Number(g("date")(y, "yyyy")), k.months = C.MONTH, k.daysInString = [], p = k.dateWeekStartDay; p <= k.dateWeekStartDay + 6; p += 1) k.daysInString.push(p % 7); k.daysInString = k.daysInString.map(function(a) { return g("date")(new Date(new Date("06/08/2014").valueOf() + c * a), "EEE") }), k.datepickerAppendTo && k.datepickerAppendTo.indexOf(".") !== -1 ? (k.datepickerID = "datepicker-id-" + (new Date).getTime() + (Math.floor(6 * Math.random()) + 8), a.element(document.getElementsByClassName(k.datepickerAppendTo.replace(".", ""))[0]).append(e(a.element(E))(k, function(b) { n = a.element(b)[0] }))) : k.datepickerAppendTo && k.datepickerAppendTo.indexOf("#") !== -1 ? (k.datepickerID = "datepicker-id-" + (new Date).getTime() + (Math.floor(6 * Math.random()) + 8), a.element(document.getElementById(k.datepickerAppendTo.replace("#", ""))).append(e(a.element(E))(k, function(b) { n = a.element(b)[0] }))) : k.datepickerAppendTo && "body" === k.datepickerAppendTo ? (k.datepickerID = "datepicker-id-" + ((new Date).getTime() + (Math.floor(6 * Math.random()) + 8)), a.element(document).find("body").append(e(a.element(E))(k, function(b) { n = a.element(b)[0] }))) : (r.after(e(a.element(E))(k)), n = l[0].querySelector("._720kb-datepicker-calendar")), O() && r.on("focus click focusin", function() { A = !0, z || A || !n ? N() : k.hideCalendar() }), r.on("focusout blur", function() { A = !1 }), a.element(n).on("mouseenter", function() { z = !0 }), a.element(n).on("mouseleave", function() { z = !1 }), a.element(n).on("focusin", function() { z = !0 }), a.element(b).on("click focus focusin", F), (k.dateMinLimit && !k.isSelectableMinYear(k.year) || !k.isSelectableMinDate(k.year + "/" + k.monthNumber + "/" + k.day)) && H(), (k.dateMaxLimit && !k.isSelectableMaxYear(k.year) || !k.isSelectableMaxDate(k.year + "/" + k.monthNumber + "/" + k.day)) && I(), k.paginateYears(k.year), G(k.monthNumber, k.year), k.checkVisibility = P, k.$on("$destroy", function() { Q(), R(), S(), T(), r.off("focus click focusout blur"), a.element(n).off("mouseenter mouseleave focusin"), a.element(b).off("click focus focusin", F) }) }; return { restrict: "AEC", scope: { dateSet: "@", dateMinLimit: "@", dateMaxLimit: "@", dateMonthTitle: "@", dateYearTitle: "@", buttonNextTitle: "@", buttonPrevTitle: "@", dateDisabledDates: "@", dateSetHidden: "@", dateTyper: "@", dateWeekStartDay: "@", datepickerAppendTo: "@", datepickerToggle: "@", datepickerClass: "@", datepickerShow: "@" }, link: k } }; a.module("720kb.datepicker", []).directive("datepicker", ["$window", "$compile", "$locale", "$filter", "$interpolate", "$timeout", j]) }(angular, navigator); //# sourceMappingURL=angular-datepicker.sourcemap.map ; angular.module('nmmRussianRailwayTickets', ['720kb.datepicker']).constant('nmmRussianRailwayTicketsConfig', { dateFormat: 'dd.MM.yyyy', stations: [{ id: 2004000, name: 'Sankt Petersburg', russianName: 'Санкт-Петербург', distance: -634 }, { id: 2000000, name: 'Moskwa', russianName: 'Москва', distance: 0 }, { id: 2010000, name: 'Jarosław', russianName: 'Ярослáвль', distance: 284 }, { id: 2010090, name: 'Kostroma', russianName: 'Кострома', distance: 740 }, { id: 2060600, name: 'Kirow', russianName: 'Киров', distance: 957 }, { id: 2030400, name: 'Perm', russianName: 'Пермь', distance: 1436 }, { id: 2030000, name: 'Jekaterynburg', russianName: 'Екатеринбург', distance: 1816 }, { id: 2030100, name: 'Tiumeń', russianName: 'Тюмень', distance: 2144 }, { id: 2044700, name: 'Omsk', russianName: 'Омск', distance: 2712 }, { id: 2044001, name: 'Nowosybirsk', russianName: 'Новосибирск', distance: 3335 }, { id: 2038001, name: 'Krasnojarsk', russianName: 'Красноярск', distance: 4098 }, { id: 2054001, name: 'Irkuck', russianName: 'Иркутск', distance: 5185 }, { id: 2054785, name: 'Ułan Ude', russianName: 'Улан-Удэ', distance: 5642 }, { id: 2050001, name: 'Czyta', russianName: 'Чита', distance: 6199 }, { id: 2034400, name: 'Birobidżan', russianName: 'Биробиджан', distance: 8351 }, { id: 2034000, name: 'Chabarowsk', russianName: 'Хаба́ровск', distance: 8523 }, { id: 2034137, name: 'Władywostok', russianName: 'Владивосток', distance: 9289 }], defaultDeparture: 2000000, defaultDestination: 2034137, tpBaseUrl: 'http://c45.travelpayouts.com/click?shmarker=68599&promo_id=1294&source_type=customlink&type=click&custom_url={{url}}', ttrHomeUrl: 'https://www.tutu.travel/poezda/', ttrBaseUrl: 'https://www.tutu.travel/poezda/rasp_d.php?nnst1={{departure}}&nnst2={{destination}}&date={{date}}' }).controller('RussianRailwayTicketsSearchForm', ['$scope', 'nmmRussianRailwayTicketsConfig', 'dateFilter', 'filterFilter', function($scope, config, dateFilter, filterFilter) { $scope.stations = config.stations; var tmrw = new Date(); tmrw.setDate(tmrw.getDate() + 1); var today = new Date(); $scope.minDate = today.toISOString().split('T')[0]; $scope.defaultDate = tmrw.toISOString().split('T')[0]; $scope.dateFormat = config.dateFormat; $scope.inputs = { departure: config.defaultDeparture, destination: config.defaultDestination, date: dateFilter(tmrw, config.dateFormat) }; function getTpUrl(url) { return config.tpBaseUrl.replace('{{url}}', encodeURIComponent(url)); } function track(link) { if (link) { ga('send', 'event', 'link', 'click', 'russian-railway-search', 1); } else { var distance = 0; var departure = filterFilter(config.stations, { id: $scope.inputs.departure }); var destination = filterFilter(config.stations, { id: $scope.inputs.destination }); if (departure.length > 0 && destination.length > 0) { distance = Math.abs(departure[0].distance - destination[0].distance); } ga('send', 'event', 'form', 'submit', 'russian-railway-search', distance); } } $scope.tpHomeUrl = getTpUrl(config.ttrHomeUrl); $scope.onTpHomeLinkClick = function() { track(); return true; }; $scope.submit = function() { if ($scope.inputs.departure && $scope.inputs.destination && $scope.inputs.destination != $scope.inputs.departure && $scope.inputs.date) { track(); var url = config.ttrBaseUrl.replace('{{departure}}', encodeURIComponent($scope.inputs.departure)).replace('{{destination}}', encodeURIComponent($scope.inputs.destination)).replace('{{date}}', encodeURIComponent($scope.inputs.date)); url = getTpUrl(url); var wnd = window.open(url, '_blank'); wnd.location; wnd.focus(); } }; }]);; angular.module('NoMoreMaps', ['nmmRussianRailwayTickets']);; var dateFormat = function() { var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, pad = function(val, len) { val = String(val); len = len || 2; while (val.length < len) val = "0" + val; return val; }; return function(date, mask, utc) { var dF = dateFormat; if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { mask = date; date = undefined; } date = date ? new Date(date) : new Date; if (isNaN(date)) throw SyntaxError("invalid date"); mask = String(dF.masks[mask] || mask || dF.masks["default"]); if (mask.slice(0, 4) == "UTC:") { mask = mask.slice(4); utc = true; } var _ = utc ? "getUTC" : "get", d = date[_ + "Date"](), D = date[_ + "Day"](), m = date[_ + "Month"](), y = date[_ + "FullYear"](), H = date[_ + "Hours"](), M = date[_ + "Minutes"](), s = date[_ + "Seconds"](), L = date[_ + "Milliseconds"](), o = utc ? 0 : date.getTimezoneOffset(), flags = { d: d, dd: pad(d), ddd: dF.i18n.dayNames[D], dddd: dF.i18n.dayNames[D + 7], m: m + 1, mm: pad(m + 1), mmm: dF.i18n.monthNames[m], mmmm: dF.i18n.monthNames[m + 12], yy: String(y).slice(2), yyyy: y, h: H % 12 || 12, hh: pad(H % 12 || 12), H: H, HH: pad(H), M: M, MM: pad(M), s: s, ss: pad(s), l: pad(L, 3), L: pad(L > 99 ? Math.round(L / 10) : L), t: H < 12 ? "a" : "p", tt: H < 12 ? "am" : "pm", T: H < 12 ? "A" : "P", TT: H < 12 ? "AM" : "PM", Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] }; return mask.replace(token, function($0) { return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); }); }; }(); dateFormat.masks = { "default": "ddd mmm dd yyyy HH:MM:ss", shortDate: "m/d/yy", mediumDate: "mmm d, yyyy", longDate: "mmmm d, yyyy", fullDate: "dddd, mmmm d, yyyy", shortTime: "h:MM TT", mediumTime: "h:MM:ss TT", longTime: "h:MM:ss TT Z", isoDate: "yyyy-mm-dd", isoTime: "HH:MM:ss", isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" }; dateFormat.i18n = { dayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] }; Date.prototype.format = function(mask, utc) { return dateFormat(this, mask, utc); };; /*! * Pikaday * * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday */ (function(root, factory) { 'use strict'; var moment; if (typeof exports === 'object') { try { moment = require('moment'); } catch (e) {} module.exports = factory(moment); } else if (typeof define === 'function' && define.amd) { define(function(req) { var id = 'moment'; try { moment = req(id); } catch (e) {} return factory(moment); }); } else { root.Pikaday = factory(root.moment); } }(this, function(moment) { 'use strict'; var hasMoment = typeof moment === 'function', hasEventListeners = !!window.addEventListener, document = window.document, sto = window.setTimeout, addEvent = function(el, e, callback, capture) { if (hasEventListeners) { el.addEventListener(e, callback, !!capture); } else { el.attachEvent('on' + e, callback); } }, removeEvent = function(el, e, callback, capture) { if (hasEventListeners) { el.removeEventListener(e, callback, !!capture); } else { el.detachEvent('on' + e, callback); } }, trim = function(str) { return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); }, hasClass = function(el, cn) { return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1; }, addClass = function(el, cn) { if (!hasClass(el, cn)) { el.className = (el.className === '') ? cn : el.className + ' ' + cn; } }, removeClass = function(el, cn) { el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' ')); }, isArray = function(obj) { return (/Array/).test(Object.prototype.toString.call(obj)); }, isDate = function(obj) { return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()); }, isWeekend = function(date) { var day = date.getDay(); return day === 0 || day === 6; }, isLeapYear = function(year) { return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; }, getDaysInMonth = function(year, month) { return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }, setToStartOfDay = function(date) { if (isDate(date)) date.setHours(0, 0, 0, 0); }, compareDates = function(a, b) { return a.getTime() === b.getTime(); }, extend = function(to, from, overwrite) { var prop, hasProp; for (prop in from) { hasProp = to[prop] !== undefined; if (hasProp && typeof from[prop] === 'object' && from[prop] !== null && from[prop].nodeName === undefined) { if (isDate(from[prop])) { if (overwrite) { to[prop] = new Date(from[prop].getTime()); } } else if (isArray(from[prop])) { if (overwrite) { to[prop] = from[prop].slice(0); } } else { to[prop] = extend({}, from[prop], overwrite); } } else if (overwrite || !hasProp) { to[prop] = from[prop]; } } return to; }, fireEvent = function(el, eventName, data) { var ev; if (document.createEvent) { ev = document.createEvent('HTMLEvents'); ev.initEvent(eventName, true, false); ev = extend(ev, data); el.dispatchEvent(ev); } else if (document.createEventObject) { ev = document.createEventObject(); ev = extend(ev, data); el.fireEvent('on' + eventName, ev); } }, adjustCalendar = function(calendar) { if (calendar.month < 0) { calendar.year -= Math.ceil(Math.abs(calendar.month) / 12); calendar.month += 12; } if (calendar.month > 11) { calendar.year += Math.floor(Math.abs(calendar.month) / 12); calendar.month -= 12; } return calendar; }, defaults = { field: null, bound: undefined, ariaLabel: 'Use the arrow keys to pick a date', position: 'bottom left', reposition: true, format: 'YYYY-MM-DD', toString: null, parse: null, defaultDate: null, setDefaultDate: false, firstDay: 0, formatStrict: false, minDate: null, maxDate: null, yearRange: 10, showWeekNumber: false, pickWholeWeek: false, minYear: 0, maxYear: 9999, minMonth: undefined, maxMonth: undefined, startRange: null, endRange: null, isRTL: false, yearSuffix: '', showMonthAfterYear: false, showDaysInNextAndPreviousMonths: false, enableSelectionDaysInNextAndPreviousMonths: false, numberOfMonths: 1, mainCalendar: 'left', container: undefined, blurFieldOnSelect: true, i18n: { previousMonth: 'Previous Month', nextMonth: 'Next Month', months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] }, theme: null, events: [], onSelect: null, onOpen: null, onClose: null, onDraw: null, keyboardInput: true, linkURL: '', linkTarget: 0 }, renderDayName = function(opts, day, abbr) { day += opts.firstDay; while (day >= 7) { day -= 7; } return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day]; }, renderDay = function(opts) { var arr = []; var ariaSelected = 'false'; var target = ''; if (opts.linkTarget == 1) { target = 'target="_blank"'; } if (opts.isEmpty) { if (opts.showDaysInNextAndPreviousMonths) { arr.push('is-outside-current-month'); if (!opts.enableSelectionDaysInNextAndPreviousMonths) { arr.push('is-selection-disabled'); } } else { return ''; } } if (opts.isDisabled) { arr.push('is-disabled'); } if (opts.isToday) { arr.push('is-today'); } if (opts.isSelected) { arr.push('is-selected'); ariaSelected = 'true'; } if (opts.hasEvent) { arr.push('has-event'); } if (opts.isInRange) { arr.push('is-inrange'); } if (opts.isStartRange) { arr.push('is-startrange'); } if (opts.isEndRange) { arr.push('is-endrange'); } var dateFormat, dateUrl, linkURL; dateFormat = new Date(opts.year, opts.month, opts.day); dateUrl = dateFormat.format('yyyy-mm-d'); linkURL = opts.linkURL + dateUrl; return '' + '' + '' + '' + ''; }, renderWeek = function(d, m, y) { var onejan = new Date(y, 0, 1), weekNum = Math.ceil((((new Date(y, m, d) - onejan) / 86400000) + onejan.getDay() + 1) / 7); return '' + weekNum + ''; }, renderRow = function(days, isRTL, pickWholeWeek, isRowSelected) { return '' + (isRTL ? days.reverse() : days).join('') + ''; }, renderBody = function(rows) { return '' + rows.join('') + ''; }, renderHead = function(opts) { var i, arr = []; if (opts.showWeekNumber) { arr.push(''); } for (i = 0; i < 7; i++) { arr.push('' + renderDayName(opts, i, true) + ''); } return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; }, renderTitle = function(instance, c, year, month, refYear, randId) { var i, j, arr, opts = instance._o, isMinYear = year === opts.minYear, isMaxYear = year === opts.maxYear, html = '
', monthHtml, yearHtml, prev = true, next = true; for (arr = [], i = 0; i < 12; i++) { arr.push(''); } monthHtml = '
' + opts.i18n.months[month] + '
'; if (isArray(opts.yearRange)) { i = opts.yearRange[0]; j = opts.yearRange[1] + 1; } else { i = year - opts.yearRange; j = 1 + year + opts.yearRange; } for (arr = []; i < j && i <= opts.maxYear; i++) { if (i >= opts.minYear) { arr.push(''); } } yearHtml = '
' + year + opts.yearSuffix + '
'; if (opts.showMonthAfterYear) { html += yearHtml + monthHtml; } else { html += monthHtml + yearHtml; } if (isMinYear && (month === 0 || opts.minMonth >= month)) { prev = false; } if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { next = false; } if (c === 0) { html += ''; } if (c === (instance._o.numberOfMonths - 1)) { html += ''; } return html += '
'; }, renderTable = function(opts, data, randId) { return '' + renderHead(opts) + renderBody(data) + '
'; }, Pikaday = function(options) { var self = this, opts = self.config(options); self._onMouseDown = function(e) { console.log(self) console.log(e) console.log('_onMouseDown'); if (!self._v) { return; } e = e || window.event; var target = e.target || e.srcElement; console.log(target); console.log(target.parentNode); console.log(target.parentNode.parentNode); if (!target) { return; } if (!hasClass(target, 'is-disabled')) { console.log(hasClass(target, 'tp-pika-link')) console.log(!hasClass(target, 'is-empty')) console.log(!hasClass(target.parentNode, 'is-disabled')) if (hasClass(target.parentNode, 'tp-pika-link') && !hasClass(target.parentNode.parentNode, 'is-empty') && !hasClass(target.parentNode.parentNode, 'is-disabled')) { self._c = true; } else if (hasClass(target, 'pika-prev')) { self.prevMonth(); } else if (hasClass(target, 'pika-next')) { self.nextMonth(); } } if (!hasClass(target, 'pika-select')) { if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; return false; } } else { self._c = true; } }; self._onChange = function(e) { console.log('_onChange'); e = e || window.event; var target = e.target || e.srcElement; if (!target) { return; } if (hasClass(target, 'pika-select-month')) { self.gotoMonth(target.value); } else if (hasClass(target, 'pika-select-year')) { self.gotoYear(target.value); } }; self._onKeyChange = function(e) { console.log('_onKeyChange'); e = e || window.event; if (self.isVisible()) { switch (e.keyCode) { case 13: case 27: if (opts.field) { opts.field.blur(); } break; case 37: e.preventDefault(); self.adjustDate('subtract', 1); break; case 38: self.adjustDate('subtract', 7); break; case 39: self.adjustDate('add', 1); break; case 40: self.adjustDate('add', 7); break; } } }; self._onInputChange = function(e) { console.log('_onInputChange'); var date; if (e.firedBy === self) { return; } if (opts.parse) { date = opts.parse(opts.field.value, opts.format); } else if (hasMoment) { date = moment(opts.field.value, opts.format, opts.formatStrict); date = (date && date.isValid()) ? date.toDate() : null; } else { date = new Date(Date.parse(opts.field.value)); } if (isDate(date)) { self.setDate(date); } if (!self._v) { self.show(); } }; self._onInputFocus = function() { console.log('_onInputFocus'); self.show(); }; self._onInputClick = function() { console.log('_onInputClick'); self.show(); }; self._onInputBlur = function() { console.log('_onInputBlur'); var pEl = document.activeElement; do { if (hasClass(pEl, 'pika-single')) { return; } } while ((pEl = pEl.parentNode)); if (!self._c) { self._b = sto(function() { self.hide(); }, 50); } self._c = false; }; self._onClick = function(e) { console.log('_onClick'); e = e || window.event; var target = e.target || e.srcElement, pEl = target; if (!target) { return; } if (!hasEventListeners && hasClass(target, 'pika-select')) { if (!target.onchange) { target.setAttribute('onchange', 'return;'); addEvent(target, 'change', self._onChange); } } do { if (hasClass(pEl, 'pika-single') || pEl === opts.trigger) { return; } } while ((pEl = pEl.parentNode)); if (self._v && target !== opts.trigger && pEl !== opts.trigger) { self.hide(); } }; self.el = document.createElement('div'); self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '') + (opts.theme ? ' ' + opts.theme : ''); addEvent(self.el, 'mousedown', self._onMouseDown, true); addEvent(self.el, 'touchend', self._onMouseDown, true); addEvent(self.el, 'change', self._onChange); if (opts.keyboardInput) { addEvent(document, 'keydown', self._onKeyChange); } if (opts.field) { if (opts.container) { opts.container.appendChild(self.el); } else if (opts.bound) { document.body.appendChild(self.el); } else { opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling); } addEvent(opts.field, 'change', self._onInputChange); if (!opts.defaultDate) { if (hasMoment && opts.field.value) { opts.defaultDate = moment(opts.field.value, opts.format).toDate(); } else { opts.defaultDate = new Date(Date.parse(opts.field.value)); } opts.setDefaultDate = true; } } var defDate = opts.defaultDate; if (isDate(defDate)) { if (opts.setDefaultDate) { self.setDate(defDate, true); } else { self.gotoDate(defDate); } } else { self.gotoDate(new Date()); } if (opts.bound) { this.hide(); self.el.className += ' is-bound'; addEvent(opts.trigger, 'click', self._onInputClick); addEvent(opts.trigger, 'focus', self._onInputFocus); addEvent(opts.trigger, 'blur', self._onInputBlur); } else { this.show(); } }; Pikaday.prototype = { config: function(options) { if (!this._o) { this._o = extend({}, defaults, true); } var opts = extend(this._o, options, true); opts.isRTL = !!opts.isRTL; opts.field = (opts.field && opts.field.nodeName) ? opts.field : null; opts.theme = (typeof opts.theme) === 'string' && opts.theme ? opts.theme : null; opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field); opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field; opts.disableWeekends = !!opts.disableWeekends; opts.disableDayFn = (typeof opts.disableDayFn) === 'function' ? opts.disableDayFn : null; var nom = parseInt(opts.numberOfMonths, 10) || 1; opts.numberOfMonths = nom > 4 ? 4 : nom; if (!isDate(opts.minDate)) { opts.minDate = false; } if (!isDate(opts.maxDate)) { opts.maxDate = false; } if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) { opts.maxDate = opts.minDate = false; } if (opts.minDate) { this.setMinDate(opts.minDate); } if (opts.maxDate) { this.setMaxDate(opts.maxDate); } if (isArray(opts.yearRange)) { var fallback = new Date().getFullYear() - 10; opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback; opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback; } else { opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange; if (opts.yearRange > 100) { opts.yearRange = 100; } } return opts; }, toString: function(format) { format = format || this._o.format; if (!isDate(this._d)) { return ''; } if (this._o.toString) { return this._o.toString(this._d, format); } if (hasMoment) { return moment(this._d).format(format); } return this._d.toDateString(); }, getMoment: function() { return hasMoment ? moment(this._d) : null; }, setMoment: function(date, preventOnSelect) { if (hasMoment && moment.isMoment(date)) { this.setDate(date.toDate(), preventOnSelect); } }, getDate: function() { return isDate(this._d) ? new Date(this._d.getTime()) : null; }, setDate: function(date, preventOnSelect) { if (!date) { this._d = null; if (this._o.field) { this._o.field.value = ''; fireEvent(this._o.field, 'change', { firedBy: this }); } return this.draw(); } if (typeof date === 'string') { date = new Date(Date.parse(date)); } if (!isDate(date)) { return; } var min = this._o.minDate, max = this._o.maxDate; if (isDate(min) && date < min) { date = min; } else if (isDate(max) && date > max) { date = max; } this._d = new Date(date.getTime()); setToStartOfDay(this._d); this.gotoDate(this._d); if (this._o.field) { this._o.field.value = this.toString(); fireEvent(this._o.field, 'change', { firedBy: this }); } if (!preventOnSelect && typeof this._o.onSelect === 'function') { this._o.onSelect.call(this, this.getDate()); } }, gotoDate: function(date) { var newCalendar = true; if (!isDate(date)) { return; } if (this.calendars) { var firstVisibleDate = new Date(this.calendars[0].year, this.calendars[0].month, 1), lastVisibleDate = new Date(this.calendars[this.calendars.length - 1].year, this.calendars[this.calendars.length - 1].month, 1), visibleDate = date.getTime(); lastVisibleDate.setMonth(lastVisibleDate.getMonth() + 1); lastVisibleDate.setDate(lastVisibleDate.getDate() - 1); newCalendar = (visibleDate < firstVisibleDate.getTime() || lastVisibleDate.getTime() < visibleDate); } if (newCalendar) { this.calendars = [{ month: date.getMonth(), year: date.getFullYear() }]; if (this._o.mainCalendar === 'right') { this.calendars[0].month += 1 - this._o.numberOfMonths; } } this.adjustCalendars(); }, adjustDate: function(sign, days) { var day = this.getDate() || new Date(); var difference = parseInt(days) * 24 * 60 * 60 * 1000; var newDay; if (sign === 'add') { newDay = new Date(day.valueOf() + difference); } else if (sign === 'subtract') { newDay = new Date(day.valueOf() - difference); } this.setDate(newDay); }, adjustCalendars: function() { this.calendars[0] = adjustCalendar(this.calendars[0]); for (var c = 1; c < this._o.numberOfMonths; c++) { this.calendars[c] = adjustCalendar({ month: this.calendars[0].month + c, year: this.calendars[0].year }); } this.draw(); }, gotoToday: function() { this.gotoDate(new Date()); }, gotoMonth: function(month) { if (!isNaN(month)) { this.calendars[0].month = parseInt(month, 10); this.adjustCalendars(); } }, nextMonth: function() { this.calendars[0].month++; this.adjustCalendars(); }, prevMonth: function() { this.calendars[0].month--; this.adjustCalendars(); }, gotoYear: function(year) { if (!isNaN(year)) { this.calendars[0].year = parseInt(year, 10); this.adjustCalendars(); } }, setMinDate: function(value) { if (value instanceof Date) { setToStartOfDay(value); this._o.minDate = value; this._o.minYear = value.getFullYear(); this._o.minMonth = value.getMonth(); } else { this._o.minDate = defaults.minDate; this._o.minYear = defaults.minYear; this._o.minMonth = defaults.minMonth; this._o.startRange = defaults.startRange; } this.draw(); }, setMaxDate: function(value) { if (value instanceof Date) { setToStartOfDay(value); this._o.maxDate = value; this._o.maxYear = value.getFullYear(); this._o.maxMonth = value.getMonth(); } else { this._o.maxDate = defaults.maxDate; this._o.maxYear = defaults.maxYear; this._o.maxMonth = defaults.maxMonth; this._o.endRange = defaults.endRange; } this.draw(); }, setStartRange: function(value) { this._o.startRange = value; }, setEndRange: function(value) { this._o.endRange = value; }, draw: function(force) { if (!this._v && !force) { return; } var opts = this._o, minYear = opts.minYear, maxYear = opts.maxYear, minMonth = opts.minMonth, maxMonth = opts.maxMonth, html = '', randId; if (this._y <= minYear) { this._y = minYear; if (!isNaN(minMonth) && this._m < minMonth) { this._m = minMonth; } } if (this._y >= maxYear) { this._y = maxYear; if (!isNaN(maxMonth) && this._m > maxMonth) { this._m = maxMonth; } } randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); for (var c = 0; c < opts.numberOfMonths; c++) { html += '
' + renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId) + '
'; } this.el.innerHTML = html; if (opts.bound) { if (opts.field.type !== 'hidden') { sto(function() { opts.trigger.focus(); }, 1); } } if (typeof this._o.onDraw === 'function') { this._o.onDraw(this); } if (opts.bound) { opts.field.setAttribute('aria-label', opts.ariaLabel); } }, adjustPosition: function() { var field, pEl, width, height, viewportWidth, viewportHeight, scrollTop, left, top, clientRect; if (this._o.container) return; this.el.style.position = 'absolute'; field = this._o.trigger; pEl = field; width = this.el.offsetWidth; height = this.el.offsetHeight; viewportWidth = window.innerWidth || document.documentElement.clientWidth; viewportHeight = window.innerHeight || document.documentElement.clientHeight; scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop; if (typeof field.getBoundingClientRect === 'function') { clientRect = field.getBoundingClientRect(); left = clientRect.left + window.pageXOffset; top = clientRect.bottom + window.pageYOffset; } else { left = pEl.offsetLeft; top = pEl.offsetTop + pEl.offsetHeight; while ((pEl = pEl.offsetParent)) { left += pEl.offsetLeft; top += pEl.offsetTop; } } if ((this._o.reposition && left + width > viewportWidth) || (this._o.position.indexOf('right') > -1 && left - width + field.offsetWidth > 0)) { left = left - width + field.offsetWidth; } if ((this._o.reposition && top + height > viewportHeight + scrollTop) || (this._o.position.indexOf('top') > -1 && top - height - field.offsetHeight > 0)) { top = top - height - field.offsetHeight; } this.el.style.left = left + 'px'; this.el.style.top = top + 'px'; }, render: function(year, month, randId) { var opts = this._o, now = new Date(), days = getDaysInMonth(year, month), before = new Date(year, month, 1).getDay(), data = [], row = [], linkURL = this._o.linkURL, linkTarget = this._o.linkTarget; setToStartOfDay(now); if (opts.firstDay > 0) { before -= opts.firstDay; if (before < 0) { before += 7; } } var previousMonth = month === 0 ? 11 : month - 1, nextMonth = month === 11 ? 0 : month + 1, yearOfPreviousMonth = month === 0 ? year - 1 : year, yearOfNextMonth = month === 11 ? year + 1 : year, daysInPreviousMonth = getDaysInMonth(yearOfPreviousMonth, previousMonth); var cells = days + before, after = cells; while (after > 7) { after -= 7; } cells += 7 - after; var isWeekSelected = false; for (var i = 0, r = 0; i < cells; i++) { var day = new Date(year, month, 1 + (i - before)), isSelected = isDate(this._d) ? compareDates(day, this._d) : false, isToday = compareDates(day, now), hasEvent = opts.events.indexOf(day.toDateString()) !== -1 ? true : false, isEmpty = i < before || i >= (days + before), dayNumber = 1 + (i - before), monthNumber = month, yearNumber = year, isStartRange = opts.startRange && compareDates(opts.startRange, day), isEndRange = opts.endRange && compareDates(opts.endRange, day), isInRange = opts.startRange && opts.endRange && opts.startRange < day && day < opts.endRange, isDisabled = (opts.minDate && day < opts.minDate) || (opts.maxDate && day > opts.maxDate) || (opts.disableWeekends && isWeekend(day)) || (opts.disableDayFn && opts.disableDayFn(day)); if (isEmpty) { if (i < before) { dayNumber = daysInPreviousMonth + dayNumber; monthNumber = previousMonth; yearNumber = yearOfPreviousMonth; } else { dayNumber = dayNumber - days; monthNumber = nextMonth; yearNumber = yearOfNextMonth; } } var dayConfig = { day: dayNumber, month: monthNumber, year: yearNumber, hasEvent: hasEvent, isSelected: isSelected, isToday: isToday, isDisabled: isDisabled, isEmpty: isEmpty, isStartRange: isStartRange, isEndRange: isEndRange, isInRange: isInRange, showDaysInNextAndPreviousMonths: opts.showDaysInNextAndPreviousMonths, enableSelectionDaysInNextAndPreviousMonths: opts.enableSelectionDaysInNextAndPreviousMonths, linkURL: linkURL, linkTarget: linkTarget }; if (opts.pickWholeWeek && isSelected) { isWeekSelected = true; } row.push(renderDay(dayConfig)); if (++r === 7) { if (opts.showWeekNumber) { row.unshift(renderWeek(i - before, month, year)); } data.push(renderRow(row, opts.isRTL, opts.pickWholeWeek, isWeekSelected)); row = []; r = 0; isWeekSelected = false; } } return renderTable(opts, data, randId); }, isVisible: function() { return this._v; }, show: function() { if (!this.isVisible()) { this._v = true; this.draw(); removeClass(this.el, 'is-hidden'); if (this._o.bound) { addEvent(document, 'click', this._onClick); this.adjustPosition(); } if (typeof this._o.onOpen === 'function') { this._o.onOpen.call(this); } } }, hide: function() { var v = this._v; if (v !== false) { if (this._o.bound) { removeEvent(document, 'click', this._onClick); } this.el.style.position = 'static'; this.el.style.left = 'auto'; this.el.style.top = 'auto'; addClass(this.el, 'is-hidden'); this._v = false; if (v !== undefined && typeof this._o.onClose === 'function') { this._o.onClose.call(this); } } }, destroy: function() { var opts = this._o; this.hide(); removeEvent(this.el, 'mousedown', this._onMouseDown, true); removeEvent(this.el, 'touchend', this._onMouseDown, true); removeEvent(this.el, 'change', this._onChange); if (opts.keyboardInput) { removeEvent(document, 'keydown', this._onKeyChange); } if (opts.field) { removeEvent(opts.field, 'change', this._onInputChange); if (opts.bound) { removeEvent(opts.trigger, 'click', this._onInputClick); removeEvent(opts.trigger, 'focus', this._onInputFocus); removeEvent(opts.trigger, 'blur', this._onInputBlur); } } if (this.el.parentNode) { this.el.parentNode.removeChild(this.el); } } }; return Pikaday; }));; /*! * Pikaday jQuery plugin. * * Copyright © 2013 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday */ (function(root, factory) { 'use strict'; if (typeof exports === 'object') { factory(require('jquery'), require('pikaday')); } else if (typeof define === 'function' && define.amd) { define(['jquery', 'pikaday'], factory); } else { factory(root.jQuery, root.Pikaday); } }(this, function($, Pikaday) { 'use strict'; $.fn.pikaday = function() { var args = arguments; if (!args || !args.length) { args = [{}]; } return this.each(function() { var self = $(this), plugin = self.data('pikaday'); if (!(plugin instanceof Pikaday)) { if (typeof args[0] === 'object') { var options = $.extend({}, args[0]); options.field = self[0]; self.data('pikaday', new Pikaday(options)); } } else { if (typeof args[0] === 'string' && typeof plugin[args[0]] === 'function') { plugin[args[0]].apply(plugin, Array.prototype.slice.call(args, 1)); if (args[0] === 'destroy') { self.removeData('pikaday'); } } } }); }; }));; jQuery(function($) { $(document).ready(function() { var size_list = $(".TPReadMoreList > div").size(); var x = 1; console.log(size_list) $('.TPReadMoreList > div:lt(' + x + ')').show(); $('.TPReadMoreButton').click(function() { console.log("click"); x = (x + 1 <= size_list) ? x + 1 : size_list; console.log(x) $('.TPReadMoreList > div:lt(' + x + ')').show(); }); if (x == size_list) $('.TPReadMoreButton').hide() $(".TPTabs").tabs({ beforeActivate: function(event, ui) { console.log('beforeActivate'); } }); $('.TPButtonTableDates').bind("click", handlerRailwayDatepickerTest); }); var handlerRailwayDatepickerTest = function(e) { e.preventDefault() var link, picker, linkUrl, target, dateUrl, linkOpen; link = $(this); target = parseInt(link.data('target')); linkUrl = link.data('href'); picker = link.pikaday({ firstDay: 1, i18n: { previousMonth: 'Предыдущий месяц', nextMonth: 'Следующий месяц', months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Aвгуст', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], weekdays: ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятницу', 'Суббота', 'Воскресенье'], weekdaysShort: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'] }, minDate: new Date(), maxDate: new Date(new Date().setDate(new Date().getDate() + 90)), linkURL: linkUrl, linkTarget: target, onDraw: function() { $(document).find('.tp-pika-link').click(function(e) { picker.pikaday('hide'); picker.pikaday('destroy'); }); }, onOpen: function() { console.log('onOpen') $(document).find('.tp-pika-link').click(function(e) { picker.pikaday('hide'); picker.pikaday('destroy'); }); }, onSelect: function(date) { console.log('onSelect') var dateFormat; dateFormat = new Date(date); dateUrl = dateFormat.format('yyyy-mm-d'); linkUrl += dateFormat.format('yyyy-mm-d'); console.log(linkUrl) console.log(dateUrl) }, onClose: function() { console.log('onClose') console.log(linkUrl); console.log(dateUrl); }, }); picker.pikaday('show'); } var conteiner = '.TP-Plugin-Tables_wrapper'; var table = ' .TP-Plugin-Tables_box'; function checkSize() { console.log('checkSize'); var widthWrapper, widthBox, hidden, small; $(table).each(function() { $(this).removeClass('TP-autoWidth-plugin'); widthWrapper = $(this).parents(conteiner).width(); widthBox = $(this).width(); if (widthBox > widthWrapper) { while (widthBox > widthWrapper) { if (!$(this).find('tr td.TP-unessential:not(.TP-hidden)').length) return false; $('td.TP-unessential:not(.TP-hidden):last', $(this).find('tr')).addClass('TP-hidden'); widthWrapper = $(this).parents(conteiner).width(); widthBox = $(this).width(); } $(this).addClass('TP-autoWidth-plugin'); } else { small = true; while (small) { small = false; if ($(this).find('tr td.TP-unessential.TP-hidden').length) { hidden = $('td.TP-unessential.TP-hidden:first', $(this).find('tr')); hidden.removeClass('TP-hidden'); widthWrapper = $(this).parents(conteiner).width(); widthBox = $(this).width(); if (widthBox > widthWrapper) { hidden.addClass('TP-hidden'); $(this).addClass('TP-autoWidth-plugin'); } else { small = true; } } } } }); } checkSize(); $(window).resize(checkSize); }); jQuery(function($) { var doc, win; doc = $(document); win = $(window); $.fn.dataTableExt.oSort['tp-date-asc'] = function(a, b) { var x = $(a).data("tptime"); var y = $(b).data("tptime"); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }; $.fn.dataTableExt.oSort['tp-date-desc'] = function(a, b) { var x = $(a).data("tptime"); var y = $(b).data("tptime"); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; $.fn.dataTableExt.oSort['tp-found-asc'] = function(a, b) { var x = ($(a).data("tpctime") - $(a).data("tptime")); var y = ($(b).data("tpctime") - $(b).data("tptime")); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }; $.fn.dataTableExt.oSort['tp-found-desc'] = function(a, b) { var x = ($(a).data("tpctime") - $(a).data("tptime")); var y = ($(b).data("tpctime") - $(b).data("tptime")); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; $.fn.rowCount = function() { return $('tr', $(this).find('tbody')).length; }; $.fn.getPaginateTP = function() { if ($(this).data("paginate") == true) { if ($(this).rowCount() > $(this).data("paginate_limit")) { return true; } } return false; }; $.fn.dataTableExt.oSort['tp-price-asc'] = function(a, b) { var x = $(a).data("price"); var y = $(b).data("price"); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }; $.fn.dataTableExt.oSort['tp-price-desc'] = function(a, b) { var x = $(a).data("price"); var y = $(b).data("price"); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; $.fn.dataTableExt.oSort['tp-airline_logo-asc'] = function(a, b) { var x = ($(a).data("tpairline")); var y = ($(b).data("tpairline")); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }; $.fn.dataTableExt.oSort['tp-airline_logo-desc'] = function(a, b) { var x = ($(a).data("tpairline")); var y = ($(b).data("tpairline")); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; function tpTableCod(selector) { var tpTable, tableSortColumn; tableSortColumn = getSortColumn(selector); tpTable = selector.dataTable({ ordering: true, "order": [ [tableSortColumn, "asc"] ], paging: selector.getPaginateTP(), iDisplayLength: selector.data("paginate_limit"), "bLengthChange": false, searching: false, bFilter: false, bInfo: false, columnDefs: [{ targets: tableSortColumn, className: 'TP-active' }, { "aTargets": ["tp-nosort-column"], "orderable": false }, { "aTargets": ["tp-date-column"], "sType": "tp-date" }, { "aTargets": ["tp-found-column"], "sType": "tp-found" }, { "aTargets": ["tp-price-column"], "sType": "tp-price" }, { "aTargets": ["tp-airline_logo-column"], "sType": "tp-airline_logo" }], "oLanguage": { "oPaginate": { "sNext": null, "sLast": null, "sFirst": null, "sPrevious": null } } }); return tpTable; } function tpTableInit() { doc.find('.TP-Plugin-Tables_box').each(function() { var tpTable; tpTable = tpTableCod($(this)); }); } function tpTableResize() { doc.find('.TP-Plugin-Tables_box').each(function() { var tpTable; $(this).children('thead').children('tr').find("td.TP-active").each(function() { $(this).removeClass("TP-active"); }); $(this).dataTable().fnDestroy(); tpTable = tpTableCod($(this)); }); } doc.ready(function() { $.fn.dataTableExt.sErrMode = 'throw'; win.resize(tpTableResize); tpTableInit(); }); function getSortColumn(selector) { var column = selector.data('sort_column'); console.log('getSortColumn = ' + column); if (selector.children('thead').children('tr').children('td:eq(' + column + ')').hasClass("TP-hidden") === false) { return column; } else { selector.children('thead').children('tr').children('td').each(function(index, value) { if (!$(this).hasClass("TP-hidden")) { column = index; return false; } }); return column; } } doc.find('td.TPTableHead').click(function() { if ($(this).hasClass("tp-nosort-column") == false) { $(this).parent('tr').find("td.TP-active").each(function() { $(this).removeClass("TP-active"); }); $(this).addClass("TP-active"); } }); var PopularRoutesWidgets = $('.TP-PopularRoutesWidgets'); PopularRoutesWidgets.each(function() { var $items = $(this).find('.TP-PopularRoutesWidget'); var width = 100 / $items.length - 1; var count = $items.length - 1; $items.each(function(i, e) { if (i != count) { var width_new = width; $(e).css('margin-right', "1%"); $(e).css('width', (width_new - 1) + "%"); } else { $(e).css('width', width + "%"); } }); }); $(document).ready(function() { $(".TP-Plugin-Tables_box_thead .TPdepartureTd.TPTableHead").css("width", "auto !important"); var width_departure = $(".TPTrainTable .TPTHdepartureTd").width(); if (width_departure <= "85") { $(".TP-Plugin-Tables_box_thead .TPdepartureTd.TPTableHead").css("max-width", "20px"); } else { $(".TP-Plugin-Tables_box_thead .TPdepartureTd.TPTableHead").css("max-width", "100px"); } var width_departure_description = $(".TPTrainTable .TPdepartureTd").width(); if (width_departure_description <= "85") { $(".TPdepartureTd .span-timeComming").removeClass("TPactive"); } else { $(".TPdepartureTd .span-timeComming").addClass("TPactive"); } var width_departure_description = $(".TPTrainTable .TParrivalTd").width(); if (width_departure_description <= "85") { $(".TParrivalTd .span-timeComming").removeClass("TPactive"); } else { $(".TParrivalTd .span-timeComming").addClass("TPactive"); } }); $(document).resize(function() { $(".TP-Plugin-Tables_box_thead .TPdepartureTd.TPTableHead").css("width", "auto !important"); var width_departure = $(".TPTrainTable .TPTHdepartureTd").width(); if (width_departure <= "85") { $(".TP-Plugin-Tables_box_thead .TPdepartureTd.TPTableHead").css("max-width", "20px"); } else { $(".TP-Plugin-Tables_box_thead .TPdepartureTd.TPTableHead").css("max-width", "100px"); } var width_departure_description = $(".TPTrainTable .TPdepartureTd").width(); if (width_departure_description <= "85") { $(".TPdepartureTd .span-timeComming").removeClass("TPactive"); } else { $(".TPdepartureTd .span-timeComming").addClass("TPactive"); } var width_departure_description = $(".TPTrainTable .TParrivalTd").width(); if (width_departure_description <= "85") { $(".TParrivalTd .span-timeComming").removeClass("TPactive"); } else { $(".TParrivalTd .span-timeComming").addClass("TPactive"); } }); });; ! function(d, l) { "use strict"; var e = !1, n = !1; if (l.querySelector) if (d.addEventListener) e = !0; if (d.wp = d.wp || {}, !d.wp.receiveEmbedMessage) if (d.wp.receiveEmbedMessage = function(e) { var t = e.data; if (t) if (t.secret || t.message || t.value) if (!/[^a-zA-Z0-9]/.test(t.secret)) { for (var r, i, a, s = l.querySelectorAll('iframe[data-secret="' + t.secret + '"]'), n = l.querySelectorAll('blockquote[data-secret="' + t.secret + '"]'), o = new RegExp("^https?:$", "i"), c = 0; c < n.length; c++) n[c].style.display = "none"; for (c = 0; c < s.length; c++) if (r = s[c], e.source === r.contentWindow) { if (r.removeAttribute("style"), "height" === t.message) { if (1e3 < (a = parseInt(t.value, 10))) a = 1e3; else if (~~a < 200) a = 200; r.height = a } if ("link" === t.message) if (i = l.createElement("a"), a = l.createElement("a"), i.href = r.getAttribute("src"), a.href = t.value, o.test(a.protocol)) if (a.host === i.host) if (l.activeElement === r) d.top.location.href = t.value } } }, e) d.addEventListener("message", d.wp.receiveEmbedMessage, !1), l.addEventListener("DOMContentLoaded", t, !1), d.addEventListener("load", t, !1); function t() { if (!n) { n = !0; for (var e, t, r = -1 !== navigator.appVersion.indexOf("MSIE 10"), i = !!navigator.userAgent.match(/Trident.*rv:11\./), a = l.querySelectorAll("iframe.wp-embedded-content"), s = 0; s < a.length; s++) { if (!(e = a[s]).getAttribute("data-secret")) t = Math.random().toString(36).substr(2, 10), e.src += "#?secret=" + t, e.setAttribute("data-secret", t); if (r || i)(t = e.cloneNode(!0)).removeAttribute("security"), e.parentNode.replaceChild(t, e) } } } }(window, document);