! function (e) { e.fn.idleTimeout = function (i) { var t, o, n, l, a, s, r, d, c, u, g, m, v, f, T, p, y, b, L, w, h = { redirectUrl: "/logout", idleTimeLimit: 30, idleCheckHeartbeat: 2, customCallback: !1, activityEvents: "click keypress scroll wheel mousewheel mousemove", enableDialog: !0, dialogDisplayLimit: 15, dialogTitle: "Session Expiration Warning", dialogText: "Because you have been inactive, your session is about to expire.", dialogTimeRemaining: "Time remaining", dialogStayLoggedInButton: "Stay Logged In", dialogLogOutNowButton: "Log Out", errorAlertMessage: 'Please disable "Private Mode", or upgrade to a modern browser. Or perhaps a dependent file missing.', //Please see: https://github.com/marcuswestin/store.js sessionKeepAliveTimer: 600, sessionKeepAliveUrl: window.location.href }, A = e.extend(h, i), D = document.title; return this.logout = function () { setCookie("idleTimerLoggedOut", !0); }, o = function () { l = function () { e.get(A.sessionKeepAliveUrl), o() }, a = setTimeout(l, 1e3 * A.sessionKeepAliveTimer) }, n = function () { clearTimeout(a) }, t = function () { e("body").on(A.activityEvents, function () { (!A.enableDialog || A.enableDialog && y() !== !0) && u() }) }, d = function () { var i = parseInt(getCookie("idleTimerLastActivity")) + 1e3 * A.idleTimeLimit; e.now() > i ? A.enableDialog ? A.enableDialog && y() !== !0 && (m(), T()) : w() : !Boolean(getCookie("idleTimerLoggedOut")) === !0 ? w() : A.enableDialog && y() === !0 && (b(), p()) }, u = function () { g(), setCookie("idleTimerLastActivity", e.now()), c() }, c = function () { d(), s = setTimeout(c, 1e3 * A.idleCheckHeartbeat) }, g = function () { clearTimeout(s) }, m = function () { var i = "

" + A.dialogText + "

" + A.dialogTimeRemaining + ":

"; e(i).dialog({ buttons: [ { text: A.dialogStayLoggedInButton, click: function () { validateToken(), b(), p(), u() } }, { text: A.dialogLogOutNowButton, click: function () { w() } }], closeOnEscape: !1, modal: !0, title: A.dialogTitle, open: function () { e(this).closest(".ui-dialog").find(".ui-dialog-titlebar-close").hide() } }), L(), document.title = A.dialogTitle, A.sessionKeepAliveTimer && n() }, f = function () { var i = parseInt(getCookie("idleTimerLastActivity")) + 1e3 * A.idleTimeLimit + 1e3 * A.dialogDisplayLimit; (e.now() > i || !Boolean(getCookie("idleTimerLoggedOut")) === !0) && w() }, T = function () { v = setInterval(f, 1e3 * A.idleCheckHeartbeat) }, p = function () { clearInterval(v), clearInterval(r) }, y = function () { var i = e("#idletimer_warning_dialog").is(":visible"); return i === !0 ? !0 : !1 }, b = function () { e("#idletimer_warning_dialog").dialog("destroy").remove(), document.title = D, A.sessionKeepAliveTimer && o() }, L = function () { var i, t, o = A.dialogDisplayLimit; r = setInterval(function () { i = Math.floor(o / 60), 10 > i && (i = "0" + i), t = o - 60 * i, 10 > t && (t = "0" + t), e("#countdownDisplay").html(i + ":" + t), o -= 1 }, 1e3) }, w = function () { setCookie("idleTimerLoggedOut", !0), A.sessionKeepAliveTimer && n(), A.customCallback && A.customCallback(), u(), A.redirectUrl && (window.location.href = A.redirectUrl) }, validateToken_ASMX = function () { var result = false; try { $.ajax({ type: "POST", url: GLOBAL_SERVICE_URL + "/ValidateToken", async: true, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { try { if (null != data && null != data.d) { result = true; } else { alert("Error: Error retrieving data."); result = false; } } catch (err) { alert("Error: " + err.message); } }, error: function (response) { try { var r = jQuery.parseJSON(response.responseText); alert("Error : " + r.Message + " ExceptionType: " + r.ExceptionType); } catch (err) { alert("Error: " + response); } }, }); } catch (err) { alert("Error: " + err.message); } finally { } }, validateToken = function () { var result = false; try { $.ajax({ type: "POST", url: VALIDATE_TOKEN_HANDLER_URL, async: true, data: JSON.stringify({ updateSession: "true" }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { try { if (null != data) { result = (data == 'true'); } else { } } catch (err) { } }, error: function (response) { }, }); } catch (err) { } finally { } }, this.each(function () { (setCookie("idleTimerLastActivity", e.now()), setCookie("idleTimerLoggedOut", !1), t(), A.sessionKeepAliveTimer && o(), u()) }) } function setCookie(cname, cvalue) { document.cookie = cname + "=" + cvalue + "; "; } function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1); if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } }(jQuery);