!function (t, n) { "function" == typeof define && define.amd ? define(["jquery"], n) : n(t.jQuery) }(this, function (t) { function n() { var t = document.createElement("smartbanner"), n = { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend" }; for (var s in n) if (void 0 !== t.style[s]) return { end: n[s] }; return !1 } var s = navigator.userAgent, i = /Edge/i.test(s), e = function (n) { this.origHtmlMargin = parseFloat(t("html").css("margin-top")), this.options = t.extend({}, t.smartbanner.defaults, n); var e = navigator.standalone; if (this.options.force ? this.type = this.options.force : null !== s.match(/Windows Phone/i) && null !== s.match(/Edge|Touch/i) ? this.type = "windows" : null !== s.match(/iPhone|iPod/i) || s.match(/iPad/) && this.options.iOSUniversalApp ? null !== s.match(/Safari/i) && (null !== s.match(/CriOS/i) || null != s.match(/FxiOS/i) || window.Number(s.substr(s.indexOf("OS ") + 3, 3).replace("_", ".")) < 6) && (this.type = "ios") : s.match(/\bSilk\/(.*\bMobile Safari\b)?/) || s.match(/\bKF\w/) || s.match("Kindle Fire") ? this.type = "kindle" : null !== s.match(/Android/i) && (this.type = "android"), this.type && !e && !this.getCookie("sb-closed") && !this.getCookie("sb-installed")) { this.scale = "auto" == this.options.scale ? t(window).width() / window.screen.width : this.options.scale, this.scale < 1 && (this.scale = 1); var o = t("android" == this.type ? 'meta[name="google-play-app"]' : "ios" == this.type ? 'meta[name="apple-itunes-app"]' : "kindle" == this.type ? 'meta[name="kindle-fire-app"]' : 'meta[name="msApplication-ID"]'); if (o.length) { if ("windows" == this.type) i && (this.appId = t('meta[name="msApplication-PackageEdgeName"]').attr("content")), this.appId || (this.appId = t('meta[name="msApplication-PackageFamilyName"]').attr("content")); else { var a = /app-id=([^\s,]+)/.exec(o.attr("content")); if (!a) return; this.appId = a[1] } this.title = this.options.title ? this.options.title : o.data("title") || t("title").text().replace(/\s*[|\-ยท].*$/, ""), this.author = this.options.author ? this.options.author : o.data("author") || (t('meta[name="author"]').length ? t('meta[name="author"]').attr("content") : window.location.hostname), this.iconUrl = o.data("icon-url"), this.price = o.data("price"), "function" == typeof this.options.onInstall ? this.options.onInstall = this.options.onInstall : this.options.onInstall = function () { }, "function" == typeof this.options.onClose ? this.options.onClose = this.options.onClose : this.options.onClose = function () { }, this.create(), this.show(), this.listen() } } }; e.prototype = { constructor: e, create: function () { var n, s = this.price || this.options.price, e = this.options.url || function () { switch (this.type) { case "android": return "market://details?id="; case "kindle": return "amzn://apps/android?asin="; case "windows": return i ? "ms-windows-store://pdp/?productid=" : "ms-windows-store:navigate?appid=" } return "https://click.google-analytics.com/redirect?tid=UA-81294240-2&url=https%3A%2F%2Fitunes.apple.com%2Fin%2Fapp%2Frehlat%2Fid1141857583%3Fmt%3D8&aid=com.Rehlat.RehlatMobile&cs=" + $.cookie("utm_source") + "&cm=" + $.cookie("utm_medium") + "&cn=" + utm_campaign; }.call(this) + this.appId, o = (s && function () { var t = s + " - "; switch (this.type) { case "android": return t + this.options.inGooglePlay; case "kindle": return t + this.options.inAmazonAppStore; case "windows": return t + this.options.inWindowsStore } return t + this.options.inAppStore }.call(this), null == this.options.iconGloss ? "ios" == this.type : this.options.iconGloss); "android" == this.type && this.options.GooglePlayParams && (e += "&referrer=" + this.options.GooglePlayParams); var a = ''; this.options.layer ? t(this.options.appendToSelector).append(a) : t(this.options.appendToSelector).prepend(a), this.options.icon ? n = this.options.icon : this.iconUrl ? n = this.iconUrl : t('link[rel="apple-touch-icon-precomposed"]').length > 0 ? (n = t('link[rel="apple-touch-icon-precomposed"]').attr("href"), null == this.options.iconGloss && (o = !1)) : t('link[rel="apple-touch-icon"]').length > 0 ? n = t('link[rel="apple-touch-icon"]').attr("href") : t('meta[name="msApplication-TileImage"]').length > 0 ? n = t('meta[name="msApplication-TileImage"]').attr("content") : t('meta[name="msapplication-TileImage"]').length > 0 && (n = t('meta[name="msapplication-TileImage"]').attr("content")); var r = nativeImage; t(".sb-icon").css("background-image", "url(" + r + ")"), n && o && t("#smartbanner .sb-icon").addClass("gloss"), this.bannerHeight = t("#smartbanner").outerHeight() + 2, this.scale > 1 && (t("#smartbanner").css("height", parseFloat(t("#smartbanner").css("height")) * this.scale).hide(), t("#smartbanner .sb-container").css("-webkit-transform", "scale(" + this.scale + ")").css("-msie-transform", "scale(" + this.scale + ")").css("-moz-transform", "scale(" + this.scale + ")").css("width", t(window).width() / this.scale)) }, listen: function () { t("#smartbanner .sb-close").on("click", t.proxy(this.close, this)), t("#smartbanner .sb-button").on("click", t.proxy(this.install, this)) }, show: function (n) { var s = t("#smartbanner"); if (s.stop(), this.options.layer) s.animate({ bottom: 0, display: "block" }, this.options.speedIn).addClass("shown").show(), t(this.pushSelector).animate({ paddingTop: this.origHtmlMargin + this.bannerHeight * this.scale }, this.options.speedIn, "swing", n); else if (t.support.transition) { s.animate({ bottom: 0 }, this.options.speedIn).addClass("shown"); t(this.pushSelector).addClass("sb-animation").one(t.support.transition.end, function () { t("html").removeClass("sb-animation"), n && n() }).emulateTransitionEnd(this.options.speedIn).css("margin-top", this.origHtmlMargin + this.bannerHeight * this.scale) } else s.slideDown(this.options.speedIn).addClass("shown") }, hide: function (n) { var s = t("#smartbanner"); if (s.stop(), this.options.layer) s.animate({ top: -1 * this.bannerHeight * this.scale, display: "block" }, this.options.speedIn).removeClass("shown"), t(this.pushSelector).animate({ paddingTop: this.origHtmlMargin }, this.options.speedIn, "swing", n); else if (t.support.transition) { this.type, s.css({ display: "none" }).removeClass("shown"); t(this.pushSelector).addClass("sb-animation").one(t.support.transition.end, function () { t("html").removeClass("sb-animation"), n && n() }).emulateTransitionEnd(this.options.speedOut).css("margin-top", this.origHtmlMargin) } else s.slideUp(this.options.speedOut).removeClass("shown") }, close: function (t) { dataLayer.push({ 'event': 'eventTracking', 'category': 'AppBanner', 'action': 'AppBanner', 'label': this.type + "_Close" }); ga("send", "event", "mwebappbanner", "mwebappbanner", this.type + "_Close"), t.preventDefault(), this.hide(), this.setCookie("sb-closed", "true", this.options.daysHidden), this.options.onClose(t) }, install: function (t) { ga("send", "event", "mwebappbanner", "mwebappbanner", this.type); ga("send", "event", "mwebappbanner", "mwebappbanner", this.type), this.options.hideOnInstall && this.hide(), this.setCookie("sb-installed", "true", this.options.daysReminder), this.options.onInstall(t) }, setCookie: function (t, n, s) { var i = new Date; i.setDate(i.getDate() + s), n = encodeURI(n) + (null == s ? "" : "; expires=" + i.toUTCString()), document.cookie = t + "=" + n + "; path=/;" }, getCookie: function (t) { var n, s, i, e = document.cookie.split(";"); for (n = 0; n < e.length; n++) if (s = e[n].substr(0, e[n].indexOf("=")), i = e[n].substr(e[n].indexOf("=") + 1), (s = s.replace(/^\s+|\s+$/g, "")) == t) return decodeURI(i); return null }, switchType: function () { var n = this; this.hide(function () { n.type = "android" == n.type ? "ios" : "android"; var s = t("android" == n.type ? 'meta[name="google-play-app"]' : 'meta[name="apple-itunes-app"]').attr("content"); n.appId = /app-id=([^\s,]+)/.exec(s)[1], t("#smartbanner").detach(), n.create(), n.show() }) } }, t.smartbanner = function (n) { var s = t(window), i = s.data("smartbanner"), o = "object" == typeof n && n; i || s.data("smartbanner", i = new e(o)), "string" == typeof n && i[n]() }, t.smartbanner.defaults = { title: null, author: null, price: "FREE", appStoreLanguage: "us", inAppStore: "", inGooglePlay: "", inAmazonAppStore: "In the Amazon Appstore", inWindowsStore: "In the Windows Store", GooglePlayParams: "utm_source%3D" + $.cookie("utm_source") + "%26utm_medium%3D" + $.cookie("utm_medium") + "%26utm_term%3Dappinstalls%26utm_content%3Dsmartbanner%26utm_campaign%3Dm" + utm_campaign, icon: null, iconGloss: null, button: nativeButton, url: null, scale: "auto", speedIn: 300, speedOut: 400, daysHidden: 0, daysReminder: 0, force: null, hideOnInstall: !1, layer: !1, iOSUniversalApp: !0, appendToSelector: "body", pushSelector: "html" }, t.smartbanner.Constructor = e, void 0 === t.support.transition && (t.fn.emulateTransitionEnd = function (n) { var s = !1, i = this; t(this).one(t.support.transition.end, function () { s = !0 }); return setTimeout(function () { s || t(i).trigger(t.support.transition.end) }, n), this }, t(function () { t.support.transition = n() })) });;