/* --------------------------------------------------------- - document: Slick Modals - HTML5 and CSS3 powered modal popups - author: Capelle @ Codecanyon - profile: http://codecanyon.net/user/Capelle - version: 4.4 ---------------------------------------------------------- */ !function (o) { o.fn.slickModals = function (e) { var a = o.extend({ hideOnPages: [], openViaHash: !1, urlHash: "#loremIpsum", popupType: "none", delayTime: 5e3, scrollTopDistance: 500, autoClose: !1, autoCloseDelay: 5e3, enableStats: !1, fileLocation: "slickStats/collect.php", modalName: "Modal 1", modalSummary: "Modal 1 summary", callToAction: "cta", setCookie: !1, cookieDays: 30, cookieTriggerClass: "setCookie-1", cookieName: "slickModal-1", cookieScope: "domain", overlayVisible: !0, overlayClosesModal: !0, overlayColor: "rgba(0,0,0,0.85)", overlayAnimationDuration: "0.4", overlayAnimationEffect: "fadeIn", pageAnimationDuration: "0.4", pageAnimationEffect: "none", pageBlurRadius: "1px", pageScaleValue: "0.9", pageMoveDistance: "30%", popupWidth: "480px", popupHeight: "360px", popupLocation: "center", popupAnimationDuration: "0.4", popupAnimationEffect: "fadeIn", popupBoxShadow: "none", popupBackground: "#fff", popupRadius: "0", popupMargin: "auto", popupPadding: "20px", showOnMobile: !0, responsive: !0, mobileBreakPoint: "480px", mobileLocation: "center", mobileWidth: "100%", mobileHeight: "360px", mobileRadius: "0", mobileMargin: "0", mobilePadding: "20px", contentAnimation: !1, contentAnimationEffect: "zoomIn", contentAnimationDuration: "0.4", contentAnimationDelay: "0.4", videoSupport: !1, videoAutoPlay: !1, videoStopOnClose: !1, addCloseButton: !0, buttonStyle: "icon", enableESC: !0, reopenClass: "openSlickModal-1" }, e); return this.each(function () { var e, i, n = this, t = document.cookie.indexOf(a.cookieName) >= 0, s = window.location.pathname, l = -1 === o.inArray(s, a.hideOnPages), c = o(n).find('iframe[src*="youtube.com"]'), r = c.attr("src"), d = o("body > *").not(".slickModal, script, style"), p = "sm-", u = o(n).find(".slickWindow"); function m(o) { "center" === o ? u.css({ margin: "auto" }) : "bottomCenter" === o || "topCenter" === o ? u.css({ "margin-left": "auto", "margin-right": "auto" }) : "right" !== o && "left" !== o || u.css({ "margin-top": "auto", "margin-bottom": "auto" }) } var f = 0; switch (a.overlayVisible) { case !0: f = parseFloat(a.overlayAnimationDuration); break; case !1: f = 0 }var g, k = void 0 !== a.urlHash && "" !== a.urlHash; function v() { if (!t) { var e = window.location.hash; if (e === a.urlHash && a.openViaHash && k) b(e); else if ("delayed" === a.popupType) setTimeout(S, a.delayTime); else if ("exit" === a.popupType) { var i = !1; o(document).on("mouseleave", function (o) { o.clientY < 0 && !i && (i = !0, S()) }) } else if ("scrolled" === a.popupType) { var n = !1; o(document).scroll(function () { o(this).scrollTop() > a.scrollTopDistance && !n && (n = !0, S()) }) } } } function b(o) { a.openViaHash && k && "" !== o && (o === a.urlHash ? S() : D()) } function h() { switch (days = a.cookieDays, CookieDate = new Date, CookieDate.setTime(CookieDate.getTime() + 24 * days * 60 * 60 * 1e3), a.cookieScope) { case "domain": scopeSetting = "/"; break; case "page": scopeSetting = window.location.href }days > 0 ? document.cookie = a.cookieName + "=true; path=" + scopeSetting + "; expires=" + CookieDate.toGMTString() : 0 === days && (document.cookie = a.cookieName + "=true; path=" + scopeSetting + ";") } o(window).on("hashchange", function () { b(window.location.hash) }); var C = 0, y = 0, w = { interval: null, Start: function () { this.interval = setInterval(function () { C += 1 }, 1e3) }, Stop: function () { window.clearTimeout(this.interval) } }; function A(e, i, t) { var s = { id: o(n).attr("id"), name: a.modalName, summary: a.modalSummary, click: i, impression: e, time: t, isAjax: 1, origin: window.location.origin || window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "") }; o.ajax({ url: a.fileLocation, type: "POST", data: JSON.stringify(s), dataType: "text", contentType: "application/json; charset=utf-8", error: function () { console.log("Data was not saved.") } }) } function S() { o(n).addClass("isActive"), function () { if ("blur" === a.pageAnimationEffect || "scale" === a.pageAnimationEffect || a.pageAnimationEffect.indexOf("move") > -1) if (d.css({ "-webkit-transition-duration": a.pageAnimationDuration + "s", "transition-duration": a.pageAnimationDuration + "s" }), "blur" === a.pageAnimationEffect) d.addClass("blurred").css({ "-webkit-filter": "blur(" + a.pageBlurRadius + ")", filter: "blur(" + a.pageBlurRadius + ")" }); else if ("scale" === a.pageAnimationEffect) d.addClass("scaled").css({ "-webkit-transform": "scale(" + a.pageScaleValue + ")", transform: "scale(" + a.pageScaleValue + ")" }); else if (a.pageAnimationEffect.indexOf("move") > -1) { var o = a.pageAnimationEffect; switch (!0) { case "moveUp" === o: axis = "Y", sign = "-"; break; case "moveDown" === o: axis = "Y", sign = ""; break; case "moveLeft" === o: axis = "X", sign = "-"; break; case "moveRight" === o: axis = "X", sign = "" }d.addClass("moved").css({ "-webkit-transform": "translate" + axis + "(" + sign + parseFloat(a.pageMoveDistance) + "%)", transform: "translate" + axis + "(" + sign + parseFloat(a.pageMoveDistance) + "%)" }) } }(), a.overlayVisible && e.removeClass(p + "fadeOut").addClass(p + a.overlayAnimationEffect), u.removeClass(p + "fadeOut").addClass(p + a.popupAnimationEffect), void 0 !== a.onSlickLoad && a.onSlickLoad(), a.videoSupport && a.videoAutoPlay && c.length > 0 && c.attr("src", r + "?autoplay=1"), a.autoClose && (g = setTimeout(D, 1e3 * f + a.autoCloseDelay), a.setCookie && h()), a.enableStats && (w.Start(), A(1, y, C)) } function D() { (d.hasClass("blurred") || d.hasClass("scaled") || d.hasClass("moved")) && d.removeClass("blurred scaled moved").css({ "-webkit-transform": "", transform: "", "-webkit-filter": "", filter: "" }), u.removeClass(p + a.popupAnimationEffect).addClass(p + "fadeOut"), a.overlayVisible && setTimeout(function () { e.removeClass(p + a.overlayAnimationEffect).addClass(p + "fadeOut") }, 1e3 * parseFloat(a.popupAnimationDuration) / 2), a.contentAnimation && i.removeClass(p + a.contentAnimationEffect), void 0 !== a.onSlickClose && a.onSlickClose(), a.videoSupport && a.videoStopOnClose && c.length > 0 && c.attr("src", r + "?autoplay=0"), a.enableStats && (w.Stop(), A(0, y, C), y = 0, C = 0), setTimeout(function () { o(n).removeClass("isActive") }, 1e3 * (f + parseFloat(a.popupAnimationDuration))), void 0 !== g && clearTimeout(g) } l && (a.mobileBreakPoint = parseInt(a.mobileBreakPoint), a.overlayVisible && (o(n).prepend('
'), e = o(n).find(".slickOverlay"), a.overlayClosesModal && e.addClass("closeModal"), e.css({ background: a.overlayColor, "-webkit-animation-duration": f + "s", "animation-duration": f + "s" }), a.setCookie && e.addClass(a.cookieTriggerClass)), a.addCloseButton && (u.prepend('
'), a.setCookie && u.children(".closeModal").addClass(a.cookieTriggerClass)), a.enableESC && o(window).bind("keydown", function (o) { 27 === o.keyCode && (D(), a.setCookie && h()) }), a.showOnMobile ? v() : o(window).width() > a.mobileBreakPoint && v(), u.addClass(p + "animated").css({ "box-shadow": a.popupBoxShadow, background: a.popupBackground, "-webkit-animation-duration": a.popupAnimationDuration + "s", "animation-duration": a.popupAnimationDuration + "s", "-webkit-animation-delay": f / 2 + "s", "animation-delay": f / 2 + "s" }), a.responsive && o(window).width() <= a.mobileBreakPoint ? (u.addClass(p + a.mobileLocation).css({ "border-radius": a.mobileRadius, width: a.mobileWidth, height: a.mobileHeight, margin: a.mobileMargin, padding: a.mobilePadding }), m(a.mobileLocation)) : (u.addClass(p + a.popupLocation).css({ "border-radius": a.popupRadius, width: a.popupWidth, height: a.popupHeight, margin: a.popupMargin, padding: a.popupPadding }), m(a.popupLocation)), a.setCookie && o("." + a.cookieTriggerClass).on("click", function () { h() }), a.contentAnimation && (u.children().not(".slickCloseBtn").wrapAll('
'), (i = u.find(".slickContent")).addClass(p + a.contentAnimationEffect + " " + p + "animated").css({ "-webkit-animation-duration": a.contentAnimationDuration + "s", "animation-duration": a.contentAnimationDuration + "s", "-webkit-animation-delay": a.contentAnimationDelay + "s", "animation-delay": a.contentAnimationDelay + "s" })), a.enableStats && u.find("." + a.callToAction).each(function () { o(this).on("click", function () { y = 1, 0 }) }), o(n).find(".closeModal").on("click", function () { D() }), o("." + a.reopenClass).on("click", function () { S() })) }) } }(jQuery);