diff --git a/bower.json b/bower.json index 1e2f0a7..fd738a3 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "jquery-idleTimeout-plus", "description": "User idle detector with session keep-alive, warning dialog, lock screen, url redirection and support for multiple windows and tabs.", - "version": "0.9.2", + "version": "0.9.3", "main": "dist/jquery-idleTimeout-plus.js", "authors": [ "Jason Abraham", diff --git a/dist/js/jquery-idleTimeout-plus-iframe.js b/dist/js/jquery-idleTimeout-plus-iframe.js index 1b61167..b90aa1e 100644 --- a/dist/js/jquery-idleTimeout-plus-iframe.js +++ b/dist/js/jquery-idleTimeout-plus-iframe.js @@ -656,6 +656,7 @@ stopLockTimer(); closeLockScreen(); + $('#jitp-lock-pass').val(''); //Don't want the password to stay in the field if(config.keepAliveInterval) startKeepSessionAlive(); storeData('lockStartTime',-1); initIdle(); @@ -1002,7 +1003,8 @@ } var hoursLeft = Math.floor(minLeft/60); minLeft %= 60; - if(minLeft <= 15 || minLeft >52) return 'about '+hoursLeft+' hours'; + if(minLeft <= 15) return 'about '+hoursLeft+' hours'; + if(minLeft > 52) return 'about '+(hoursLeft+1)+' hours'; return 'about '+hoursLeft+'½ hours'; } diff --git a/dist/js/jquery-idleTimeout-plus-iframe.min.js b/dist/js/jquery-idleTimeout-plus-iframe.min.js index 220d3e7..89fbd69 100644 --- a/dist/js/jquery-idleTimeout-plus-iframe.min.js +++ b/dist/js/jquery-idleTimeout-plus-iframe.min.js @@ -1 +1 @@ -!function(t,o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof exports?module.exports=o(require("jquery")):t.IdleTimeoutPlus=o(t.jQuery)}(this,function(t){function o(){null==ot&&(ot=$.localStorage?$.initNamespaceStorage("jqueryIdleTimeoutPlus").localStorage:{})}function n(t,o){_.multiWindowSupport?ot.set(t,o):ot[t]=o}function e(t,o){if(o="undefined"!=typeof o?o:null,_.multiWindowSupport){if(ot.isSet(t))return ot.get(t)}else if(t in ot)return ot[t];return o}function l(){n("warningStartTime",-1),n("lockStartTime",-1),i(),_.idleCallback!==!1&&_.idleCallback(_)}function i(){a(),n("lastActivity",$.now()),et=setInterval(r,_.idleCheckHeartbeat)}function a(){clearInterval(et)}function r(){var t=e("lastActivity",$.now())+_.idleTimeLimit;return e("logoutTriggered")===!0?N():-1!=e("lockStartTime",-1)?(a(),U()):$.now()>=t?(a(),_.warnEnabled?d():_.lockEnabled?A():O()):void 0}function c(){$(document).on(_.activityEvents,function(t){if("mousemove"===t.type){if(t.clientX===rt[0]&&t.clientY===rt[1])return;rt[0]=t.clientX,rt[1]=t.clientY}-1==e("warningStartTime",-1)&&-1==e("lockStartTime",-1)&&i()})}function u(){s(),lt=setInterval(function(){$.ajax({type:_.keepAliveAjaxType,url:_.keepAliveUrl,data:_.keepAliveAjaxData})},_.keepAliveInterval)}function s(){clearInterval(lt)}function d(){k(),_.warnCallback!==!1&&(ct=_.warnCallback(_)),w()}function p(){f(),m(),n("warningStartTime",-1),l()}function k(){n("warningStartTime",$.now()),it=setInterval(v,500)}function f(){clearInterval(it)}function v(){if(e("logoutTriggered")===!0)return f(),N();if(-1==e("warningStartTime",-1))return p();var t=e("warningStartTime")+_.warnTimeLimit-1;return $.now()>=t?(f(),_.lockEnabled?(m(),A()):O()):void b()}function w(){ct&&(g(),b(),_.bootstrap?st.modal("show"):st.dialog("open"),ut=!0)}function m(){ut=!1,null!==st&&(_.bootstrap?(st.modal("hide"),tt.removeClass("modal-open"),$("div.modal-backdrop").remove()):st.dialog("close"))}function b(){if(null!==st&&(null!==dt||null!==pt)){var t=$.now(),o=Math.floor((e("warningStartTime",t)+_.warnTimeLimit-t)/1e3);if(null!==dt&&dt.html(V(o)),null!=pt){var n=Math.floor(o/(_.warnTimeLimit/1e3)*100);_.bootstrap?pt.css("width",n+"%"):pt.progressbar("value",n)}}}function g(){if(null===st){var t="";t=_.warnContentCallback!==!1?_.warnContentCallback(_):_.bootstrap?j():C(),_.bootstrap?h(t):y(t)}}function h(t){tt.append(t),$("#jitp-warn-logout").on("click",function(){T()}),$("#jitp-warn-alive").on("click",function(){S()}),st=$("#jitp-warn-display"),(null!=_.warnCountdownMessage||_.warnCountdownBar)&&(dt=st.find(".jitp-countdown-holder")),_.warnCountdownBar&&(pt=$("#jitp-warn-bar"))}function y(t){$(t).dialog({buttons:[{text:_.warnLogoutButton,click:function(){T()}},{text:_.warnStayAliveButton,click:function(){S()}}],closeOnEscape:!1,modal:!0,title:_.warnTitle,minWidth:320,autoOpen:!1,open:function(){null==_.warnTitle?$(this).closest(".ui-dialog").find(".ui-dialog-titlebar").hide():$(this).closest(".ui-dialog").find(".ui-dialog-titlebar-close").hide(),$(this).parent().find("button:nth-child(2)").focus()}}),st=$("#jitp-warn-display"),null!=_.warnCountdownMessage&&(dt=st.find(".jitp-countdown-holder")),_.warnCountdownBar&&(pt=$("#jitp-warn-bar"),pt.progressbar({value:0,max:100}))}function j(){var t=_.warnTitle?'":"",o=null!=_.warnCountdownMessage?"

"+_.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",n=_.warnCountdownBar?'
':"";return'"}function C(){var t=null!=_.warnCountdownMessage?"

"+_.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",o=_.warnCountdownBar?'
':"";return'

'+_.warnMessage+"

"+t+o+"
"}function T(){f(),D()}function S(){p()}function A(){_.lockHaltKeepAlive&&s(),M(),_.lockCallback!==!1&&(kt=_.lockCallback(_)),E()}function U(){_.lockHaltKeepAlive?s():_.keepAliveInterval&&u(),-1==e("lockStartTime",-1)?M():at=setInterval(B,500),E()}function L(){I(),x(),_.keepAliveInterval&&u(),n("lockStartTime",-1),l()}function M(){n("lockStartTime",$.now()),at=setInterval(B,500)}function I(){clearInterval(at)}function B(){if(1==e("logoutTriggered"))return I(),N();if(-1==e("lockStartTime",-1))return L();var t=e("lockStartTime")+_.lockTimeLimit-1;return $.now()>=t?(I(),1==e("logoutTriggered")?N():O()):void q()}function E(){if(kt){W(),q();var t={message:$("#jitp-lock-display")};t=$.extend(t,_.lockBlockUiConfig),$.blockUI(t),ft=!0}}function x(){$.unblockUI(),ft=!1}function q(){if(null!==wt){var t=$.now(),o=Math.floor((e("lockStartTime",t)+_.lockTimeLimit-t)/1e3);wt.html(V(o))}}function W(){if(null===vt){var t="";t=_.lockContentCallback!==!1?_.lockContentCallback(_):_.bootstrap?P():H(),tt.append(t),vt=$("#jitp-lock-display"),0!=_.lockCountdownMessage&&(wt=vt.find(".jitp-countdown-holder")),$("#jitp-lock-logout").on("click",function(){Q()}),$("#jitp-lock-unlock").on("click",function(){K()}),$("#jitp-lock-form").length&&$("#jitp-lock-form").submit(function(){return K(),!1}),q()}}function P(){var t=null!==_.lockTitle?'

'+_.lockTitle+"

":"",o=_.lockLogoutButton.replace(/{username}/g,_.lockUsername),n=_.lockCountdownMessage?'":"";return'"}function H(){var t=null!==_.lockTitle?"
"+_.lockTitle+"
":"",o=_.lockLogoutButton.replace(/{username}/g,_.lockUsername),n=_.lockCountdownMessage?"":"";return'"}function Q(){I(),D()}function K(){_.lockPassCallback($("#jitp-lock-pass").val())}function Y(){s(),a(),f(),I()}function D(){Y(),n("logoutTriggered",!0),("function"!=typeof _.logoutCallback||_.logoutCallback(_))&&window.location.replace(_.logoutUrl)}function N(){Y(),("function"!=typeof _.logoutAutoCallback||_.logoutAutoCallback(_))&&window.location.replace(_.logoutAutoUrl)}function O(){return Y(),_.multiWindowSupport?void setTimeout(X,Z(100,500)):X()}function X(){return e("logoutTriggered",!1)?N():(n("logoutTriggered",!0),void(("function"!=typeof _.redirectCallback||_.redirectCallback(_))&&window.location.replace(_.redirectUrl)))}function F(){n("activityEvents",_.activityEvents)}function G(){$(document).on("dialogopen shown.bs.modal",function(){ut||ft||J()})}function J(){var t,o=function(){"complete"===document.readyState&&(clearInterval(t),R())};t=setInterval(o,1e3)}function R(t){t||(t=$(document));var o=0;t.find("iframe,frame").each(function(){if($(this).hasClass("jitp-inspected")===!1)try{R($(this).contents()),$(this).on("load",z($(this)));var t=$(this)[o];t.attachEvent&&t.attachEvent("onload",z($(this))),o++}catch(n){$(this).addClass("jitp-inspected cross-site")}})}function z(t){var o=t.contents(),n=e("activityEvents","");try{o.on(n,function(t){$("body").trigger(t)}),t.addClass("jitp-inspected")}catch(l){}}function V(t){var o=Math.floor(t/60);if(15>=o){var n=t%60,e=o>0?o+"m ":"";return e+=n+"s"}if(75>=o)return 22>=o?"about 15 mins":37>=o?"about 30 mins":52>=o?"about 25 mins":"about 1 hour";var l=Math.floor(o/60);return o%=60,15>=o||o>52?"about "+l+" hours":"about "+l+"½ hours"}function Z(t,o){return Math.floor(Math.random()*(o-t))+t}var _={idleTimeLimit:1200,idleCallback:!1,idleCheckHeartbeat:2,activityEvents:"click keypress scroll wheel mousewheel mousemove touchmove",bootstrap:!1,warnEnabled:!0,warnTimeLimit:180,warnCallback:!1,warnContentCallback:!1,warnTitle:"Session Timeout",warnMessage:"Your session is about to expire!",warnStayAliveButton:"Stay Connected",warnLogoutButton:"Logout",warnCountdownMessage:"Time remaining: {timer}",warnCountdownBar:!1,redirectUrl:"/timed-out",logoutUrl:"/logout",logoutAutoUrl:"null",redirectCallback:!1,logoutCallback:!1,logoutAutoCallback:!1,keepAliveInterval:600,keepAliveUrl:window.location.href,keepAliveAjaxType:"GET",keepAliveAjaxData:"",lockEnabled:!1,lockTimeLimit:7200,lockHaltKeepAlive:!0,lockCallback:!1,lockContentCallback:!1,lockPassCallback:!1,lockTitle:null,lockUsername:"System User",lockMessage:"Enter your password to unlock the screen",lockUnlockButton:"UnLock",lockLogoutButton:"Not {username} ?",lockCountdownMessage:"Auto-logout in: {timer}",lockBlockUiConfig:{},lockLoadActive:!1,iframesSupport:!1,multiWindowSupport:!1},tt=$("body"),ot=null,nt={};nt.start=function(t){if(_=$.extend(_,t),null==_.logoutAutoUrl&&(_.logoutAutoUrl=_.logoutUrl),_.idleTimeLimit*=1e3,_.idleCheckHeartbeat*=1e3,_.warnTimeLimit*=1e3,_.lockTimeLimit*=1e3,_.keepAliveInterval*=1e3,_.multiWindowSupport&&!$.localStorage)return console.error("jitp: Multi-Window support requested but JQuery Storage API is unavailable."),!1;if(_.warnEnabled&&_.warnCallback===!1||_.lockEnabled&&_.lockCallback===!1)if(_.bootstrap){if("undefined"==typeof $.fn.modal)return console.error("jitp: Bootstrap library is unavailable"),!1}else if("undefined"==typeof jQuery.ui)return console.error("jitp: jQueryUI library is unavailable"),!1;if(_.lockEnabled&&!_.multiWindowSupport)return console.error("jitp: Lock screen requested but multi-window support is not enabled."),!1;if(_.lockEnabled&&_.lockCallback===!1){if("undefined"==typeof $.blockUI)return console.error("jitp: Lock screen requested but blockUI library is unavailable."),!1;if(_.lockPassCallback===!1)return console.error("jitp: Lock screen requested but lockPassCallback function is not set."),!1}return _.iframesSupport&&!_.multiWindowSupport?(console.error("jitp: IFrame support requested but Multi-Window support disabled."),!1):(o(),_.lockEnabled&&(_.lockLoadActive||e("lockStartTime",-1)>0)?U():(n("logoutTriggered",!1),n("warningStartTime",-1),n("lockStartTime",-1),n("lastActivity",$.now()),i(),_.keepAliveInterval&&u()),_.keepAliveInterval&&u(),F(),G(),c(),J(),!0)},nt.cleanUpLockScreen=function(){o(),$.localStorage&&ot.set("lockStartTime",-99)},nt.logout=function(){D()},nt.displayWarning=function(){w()},nt.displayLockScreen=function(){E()},nt.initLockScreen=function(){a(),f(),A()},nt.rollback=function(){L(),p()},nt.iframeRecheck=function(){J()};var et,lt,it,at,rt=[-1,-1],ct=!0,ut=!1,st=null,dt=null,pt=null,kt=!0,ft=!1,vt=null,wt=null;return nt}); \ No newline at end of file +!function(t,o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof exports?module.exports=o(require("jquery")):t.IdleTimeoutPlus=o(t.jQuery)}(this,function(t){function o(){null==ot&&(ot=$.localStorage?$.initNamespaceStorage("jqueryIdleTimeoutPlus").localStorage:{})}function n(t,o){_.multiWindowSupport?ot.set(t,o):ot[t]=o}function e(t,o){if(o="undefined"!=typeof o?o:null,_.multiWindowSupport){if(ot.isSet(t))return ot.get(t)}else if(t in ot)return ot[t];return o}function l(){n("warningStartTime",-1),n("lockStartTime",-1),i(),_.idleCallback!==!1&&_.idleCallback(_)}function i(){a(),n("lastActivity",$.now()),et=setInterval(r,_.idleCheckHeartbeat)}function a(){clearInterval(et)}function r(){var t=e("lastActivity",$.now())+_.idleTimeLimit;return e("logoutTriggered")===!0?N():-1!=e("lockStartTime",-1)?(a(),U()):$.now()>=t?(a(),_.warnEnabled?d():_.lockEnabled?A():O()):void 0}function c(){$(document).on(_.activityEvents,function(t){if("mousemove"===t.type){if(t.clientX===rt[0]&&t.clientY===rt[1])return;rt[0]=t.clientX,rt[1]=t.clientY}-1==e("warningStartTime",-1)&&-1==e("lockStartTime",-1)&&i()})}function u(){s(),lt=setInterval(function(){$.ajax({type:_.keepAliveAjaxType,url:_.keepAliveUrl,data:_.keepAliveAjaxData})},_.keepAliveInterval)}function s(){clearInterval(lt)}function d(){k(),_.warnCallback!==!1&&(ct=_.warnCallback(_)),w()}function p(){f(),m(),n("warningStartTime",-1),l()}function k(){n("warningStartTime",$.now()),it=setInterval(v,500)}function f(){clearInterval(it)}function v(){if(e("logoutTriggered")===!0)return f(),N();if(-1==e("warningStartTime",-1))return p();var t=e("warningStartTime")+_.warnTimeLimit-1;return $.now()>=t?(f(),_.lockEnabled?(m(),A()):O()):void b()}function w(){ct&&(g(),b(),_.bootstrap?st.modal("show"):st.dialog("open"),ut=!0)}function m(){ut=!1,null!==st&&(_.bootstrap?(st.modal("hide"),tt.removeClass("modal-open"),$("div.modal-backdrop").remove()):st.dialog("close"))}function b(){if(null!==st&&(null!==dt||null!==pt)){var t=$.now(),o=Math.floor((e("warningStartTime",t)+_.warnTimeLimit-t)/1e3);if(null!==dt&&dt.html(V(o)),null!=pt){var n=Math.floor(o/(_.warnTimeLimit/1e3)*100);_.bootstrap?pt.css("width",n+"%"):pt.progressbar("value",n)}}}function g(){if(null===st){var t="";t=_.warnContentCallback!==!1?_.warnContentCallback(_):_.bootstrap?j():C(),_.bootstrap?h(t):y(t)}}function h(t){tt.append(t),$("#jitp-warn-logout").on("click",function(){T()}),$("#jitp-warn-alive").on("click",function(){S()}),st=$("#jitp-warn-display"),(null!=_.warnCountdownMessage||_.warnCountdownBar)&&(dt=st.find(".jitp-countdown-holder")),_.warnCountdownBar&&(pt=$("#jitp-warn-bar"))}function y(t){$(t).dialog({buttons:[{text:_.warnLogoutButton,click:function(){T()}},{text:_.warnStayAliveButton,click:function(){S()}}],closeOnEscape:!1,modal:!0,title:_.warnTitle,minWidth:320,autoOpen:!1,open:function(){null==_.warnTitle?$(this).closest(".ui-dialog").find(".ui-dialog-titlebar").hide():$(this).closest(".ui-dialog").find(".ui-dialog-titlebar-close").hide(),$(this).parent().find("button:nth-child(2)").focus()}}),st=$("#jitp-warn-display"),null!=_.warnCountdownMessage&&(dt=st.find(".jitp-countdown-holder")),_.warnCountdownBar&&(pt=$("#jitp-warn-bar"),pt.progressbar({value:0,max:100}))}function j(){var t=_.warnTitle?'":"",o=null!=_.warnCountdownMessage?"

"+_.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",n=_.warnCountdownBar?'
':"";return'"}function C(){var t=null!=_.warnCountdownMessage?"

"+_.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",o=_.warnCountdownBar?'
':"";return'

'+_.warnMessage+"

"+t+o+"
"}function T(){f(),D()}function S(){p()}function A(){_.lockHaltKeepAlive&&s(),M(),_.lockCallback!==!1&&(kt=_.lockCallback(_)),E()}function U(){_.lockHaltKeepAlive?s():_.keepAliveInterval&&u(),-1==e("lockStartTime",-1)?M():at=setInterval(B,500),E()}function L(){I(),x(),$("#jitp-lock-pass").val(""),_.keepAliveInterval&&u(),n("lockStartTime",-1),l()}function M(){n("lockStartTime",$.now()),at=setInterval(B,500)}function I(){clearInterval(at)}function B(){if(1==e("logoutTriggered"))return I(),N();if(-1==e("lockStartTime",-1))return L();var t=e("lockStartTime")+_.lockTimeLimit-1;return $.now()>=t?(I(),1==e("logoutTriggered")?N():O()):void q()}function E(){if(kt){W(),q();var t={message:$("#jitp-lock-display")};t=$.extend(t,_.lockBlockUiConfig),$.blockUI(t),ft=!0}}function x(){$.unblockUI(),ft=!1}function q(){if(null!==wt){var t=$.now(),o=Math.floor((e("lockStartTime",t)+_.lockTimeLimit-t)/1e3);wt.html(V(o))}}function W(){if(null===vt){var t="";t=_.lockContentCallback!==!1?_.lockContentCallback(_):_.bootstrap?P():H(),tt.append(t),vt=$("#jitp-lock-display"),0!=_.lockCountdownMessage&&(wt=vt.find(".jitp-countdown-holder")),$("#jitp-lock-logout").on("click",function(){Q()}),$("#jitp-lock-unlock").on("click",function(){K()}),$("#jitp-lock-form").length&&$("#jitp-lock-form").submit(function(){return K(),!1}),q()}}function P(){var t=null!==_.lockTitle?'

'+_.lockTitle+"

":"",o=_.lockLogoutButton.replace(/{username}/g,_.lockUsername),n=_.lockCountdownMessage?'":"";return'"}function H(){var t=null!==_.lockTitle?"
"+_.lockTitle+"
":"",o=_.lockLogoutButton.replace(/{username}/g,_.lockUsername),n=_.lockCountdownMessage?"":"";return'"}function Q(){I(),D()}function K(){_.lockPassCallback($("#jitp-lock-pass").val())}function Y(){s(),a(),f(),I()}function D(){Y(),n("logoutTriggered",!0),("function"!=typeof _.logoutCallback||_.logoutCallback(_))&&window.location.replace(_.logoutUrl)}function N(){Y(),("function"!=typeof _.logoutAutoCallback||_.logoutAutoCallback(_))&&window.location.replace(_.logoutAutoUrl)}function O(){return Y(),_.multiWindowSupport?void setTimeout(X,Z(100,500)):X()}function X(){return e("logoutTriggered",!1)?N():(n("logoutTriggered",!0),void(("function"!=typeof _.redirectCallback||_.redirectCallback(_))&&window.location.replace(_.redirectUrl)))}function F(){n("activityEvents",_.activityEvents)}function G(){$(document).on("dialogopen shown.bs.modal",function(){ut||ft||J()})}function J(){var t,o=function(){"complete"===document.readyState&&(clearInterval(t),R())};t=setInterval(o,1e3)}function R(t){t||(t=$(document));var o=0;t.find("iframe,frame").each(function(){if($(this).hasClass("jitp-inspected")===!1)try{R($(this).contents()),$(this).on("load",z($(this)));var t=$(this)[o];t.attachEvent&&t.attachEvent("onload",z($(this))),o++}catch(n){$(this).addClass("jitp-inspected cross-site")}})}function z(t){var o=t.contents(),n=e("activityEvents","");try{o.on(n,function(t){$("body").trigger(t)}),t.addClass("jitp-inspected")}catch(l){}}function V(t){var o=Math.floor(t/60);if(15>=o){var n=t%60,e=o>0?o+"m ":"";return e+=n+"s"}if(75>=o)return 22>=o?"about 15 mins":37>=o?"about 30 mins":52>=o?"about 25 mins":"about 1 hour";var l=Math.floor(o/60);return o%=60,15>=o?"about "+l+" hours":o>52?"about "+(l+1)+" hours":"about "+l+"½ hours"}function Z(t,o){return Math.floor(Math.random()*(o-t))+t}var _={idleTimeLimit:1200,idleCallback:!1,idleCheckHeartbeat:2,activityEvents:"click keypress scroll wheel mousewheel mousemove touchmove",bootstrap:!1,warnEnabled:!0,warnTimeLimit:180,warnCallback:!1,warnContentCallback:!1,warnTitle:"Session Timeout",warnMessage:"Your session is about to expire!",warnStayAliveButton:"Stay Connected",warnLogoutButton:"Logout",warnCountdownMessage:"Time remaining: {timer}",warnCountdownBar:!1,redirectUrl:"/timed-out",logoutUrl:"/logout",logoutAutoUrl:"null",redirectCallback:!1,logoutCallback:!1,logoutAutoCallback:!1,keepAliveInterval:600,keepAliveUrl:window.location.href,keepAliveAjaxType:"GET",keepAliveAjaxData:"",lockEnabled:!1,lockTimeLimit:7200,lockHaltKeepAlive:!0,lockCallback:!1,lockContentCallback:!1,lockPassCallback:!1,lockTitle:null,lockUsername:"System User",lockMessage:"Enter your password to unlock the screen",lockUnlockButton:"UnLock",lockLogoutButton:"Not {username} ?",lockCountdownMessage:"Auto-logout in: {timer}",lockBlockUiConfig:{},lockLoadActive:!1,iframesSupport:!1,multiWindowSupport:!1},tt=$("body"),ot=null,nt={};nt.start=function(t){if(_=$.extend(_,t),null==_.logoutAutoUrl&&(_.logoutAutoUrl=_.logoutUrl),_.idleTimeLimit*=1e3,_.idleCheckHeartbeat*=1e3,_.warnTimeLimit*=1e3,_.lockTimeLimit*=1e3,_.keepAliveInterval*=1e3,_.multiWindowSupport&&!$.localStorage)return console.error("jitp: Multi-Window support requested but JQuery Storage API is unavailable."),!1;if(_.warnEnabled&&_.warnCallback===!1||_.lockEnabled&&_.lockCallback===!1)if(_.bootstrap){if("undefined"==typeof $.fn.modal)return console.error("jitp: Bootstrap library is unavailable"),!1}else if("undefined"==typeof jQuery.ui)return console.error("jitp: jQueryUI library is unavailable"),!1;if(_.lockEnabled&&!_.multiWindowSupport)return console.error("jitp: Lock screen requested but multi-window support is not enabled."),!1;if(_.lockEnabled&&_.lockCallback===!1){if("undefined"==typeof $.blockUI)return console.error("jitp: Lock screen requested but blockUI library is unavailable."),!1;if(_.lockPassCallback===!1)return console.error("jitp: Lock screen requested but lockPassCallback function is not set."),!1}return _.iframesSupport&&!_.multiWindowSupport?(console.error("jitp: IFrame support requested but Multi-Window support disabled."),!1):(o(),_.lockEnabled&&(_.lockLoadActive||e("lockStartTime",-1)>0)?U():(n("logoutTriggered",!1),n("warningStartTime",-1),n("lockStartTime",-1),n("lastActivity",$.now()),i(),_.keepAliveInterval&&u()),_.keepAliveInterval&&u(),F(),G(),c(),J(),!0)},nt.cleanUpLockScreen=function(){o(),$.localStorage&&ot.set("lockStartTime",-99)},nt.logout=function(){D()},nt.displayWarning=function(){w()},nt.displayLockScreen=function(){E()},nt.initLockScreen=function(){a(),f(),A()},nt.rollback=function(){L(),p()},nt.iframeRecheck=function(){J()};var et,lt,it,at,rt=[-1,-1],ct=!0,ut=!1,st=null,dt=null,pt=null,kt=!0,ft=!1,vt=null,wt=null;return nt}); \ No newline at end of file diff --git a/dist/js/jquery-idleTimeout-plus.js b/dist/js/jquery-idleTimeout-plus.js index e1eef9b..95d3ab3 100644 --- a/dist/js/jquery-idleTimeout-plus.js +++ b/dist/js/jquery-idleTimeout-plus.js @@ -639,6 +639,7 @@ stopLockTimer(); closeLockScreen(); + $('#jitp-lock-pass').val(''); //Don't want the password to stay in the field if(config.keepAliveInterval) startKeepSessionAlive(); storeData('lockStartTime',-1); initIdle(); @@ -876,7 +877,8 @@ } var hoursLeft = Math.floor(minLeft/60); minLeft %= 60; - if(minLeft <= 15 || minLeft >52) return 'about '+hoursLeft+' hours'; + if(minLeft <= 15) return 'about '+hoursLeft+' hours'; + if(minLeft > 52) return 'about '+(hoursLeft+1)+' hours'; return 'about '+hoursLeft+'½ hours'; } diff --git a/dist/js/jquery-idleTimeout-plus.min.js b/dist/js/jquery-idleTimeout-plus.min.js index 84a3b4d..3b73037 100644 --- a/dist/js/jquery-idleTimeout-plus.min.js +++ b/dist/js/jquery-idleTimeout-plus.min.js @@ -1 +1 @@ -!function(t,o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof exports?module.exports=o(require("jquery")):t.IdleTimeoutPlus=o(t.jQuery)}(this,function(t){function o(){null==R&&(R=$.localStorage?$.initNamespaceStorage("jqueryIdleTimeoutPlus").localStorage:{})}function n(t,o){z.multiWindowSupport?R.set(t,o):R[t]=o}function e(t,o){if(o="undefined"!=typeof o?o:null,z.multiWindowSupport){if(R.isSet(t))return R.get(t)}else if(t in R)return R[t];return o}function l(){n("warningStartTime",-1),n("lockStartTime",-1),i(),z.idleCallback!==!1&&z.idleCallback(z)}function i(){a(),n("lastActivity",$.now()),Z=setInterval(r,z.idleCheckHeartbeat)}function a(){clearInterval(Z)}function r(){var t=e("lastActivity",$.now())+z.idleTimeLimit;return e("logoutTriggered")===!0?N():-1!=e("lockStartTime",-1)?(a(),U()):$.now()>=t?(a(),z.warnEnabled?d():z.lockEnabled?A():O()):void 0}function c(){$(document).on(z.activityEvents,function(t){if("mousemove"===t.type){if(t.clientX===nt[0]&&t.clientY===nt[1])return;nt[0]=t.clientX,nt[1]=t.clientY}-1==e("warningStartTime",-1)&&-1==e("lockStartTime",-1)&&i()})}function u(){s(),_=setInterval(function(){$.ajax({type:z.keepAliveAjaxType,url:z.keepAliveUrl,data:z.keepAliveAjaxData})},z.keepAliveInterval)}function s(){clearInterval(_)}function d(){k(),z.warnCallback!==!1&&(et=z.warnCallback(z)),v()}function p(){f(),b(),n("warningStartTime",-1),l()}function k(){n("warningStartTime",$.now()),tt=setInterval(w,500)}function f(){clearInterval(tt)}function w(){if(e("logoutTriggered")===!0)return f(),N();if(-1==e("warningStartTime",-1))return p();var t=e("warningStartTime")+z.warnTimeLimit-1;return $.now()>=t?(f(),z.lockEnabled?(b(),A()):O()):void m()}function v(){et&&(g(),m(),z.bootstrap?it.modal("show"):it.dialog("open"),lt=!0)}function b(){lt=!1,null!==it&&(z.bootstrap?(it.modal("hide"),F.removeClass("modal-open"),$("div.modal-backdrop").remove()):it.dialog("close"))}function m(){if(null!==it&&(null!==at||null!==rt)){var t=$.now(),o=Math.floor((e("warningStartTime",t)+z.warnTimeLimit-t)/1e3);if(null!==at&&at.html(G(o)),null!=rt){var n=Math.floor(o/(z.warnTimeLimit/1e3)*100);z.bootstrap?rt.css("width",n+"%"):rt.progressbar("value",n)}}}function g(){if(null===it){var t="";t=z.warnContentCallback!==!1?z.warnContentCallback(z):z.bootstrap?C():h(),z.bootstrap?j(t):y(t)}}function j(t){F.append(t),$("#jitp-warn-logout").on("click",function(){T()}),$("#jitp-warn-alive").on("click",function(){S()}),it=$("#jitp-warn-display"),(null!=z.warnCountdownMessage||z.warnCountdownBar)&&(at=it.find(".jitp-countdown-holder")),z.warnCountdownBar&&(rt=$("#jitp-warn-bar"))}function y(t){$(t).dialog({buttons:[{text:z.warnLogoutButton,click:function(){T()}},{text:z.warnStayAliveButton,click:function(){S()}}],closeOnEscape:!1,modal:!0,title:z.warnTitle,minWidth:320,autoOpen:!1,open:function(){null==z.warnTitle?$(this).closest(".ui-dialog").find(".ui-dialog-titlebar").hide():$(this).closest(".ui-dialog").find(".ui-dialog-titlebar-close").hide(),$(this).parent().find("button:nth-child(2)").focus()}}),it=$("#jitp-warn-display"),null!=z.warnCountdownMessage&&(at=it.find(".jitp-countdown-holder")),z.warnCountdownBar&&(rt=$("#jitp-warn-bar"),rt.progressbar({value:0,max:100}))}function C(){var t=z.warnTitle?'":"",o=null!=z.warnCountdownMessage?"

"+z.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",n=z.warnCountdownBar?'
':"";return'"}function h(){var t=null!=z.warnCountdownMessage?"

"+z.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",o=z.warnCountdownBar?'
':"";return'

'+z.warnMessage+"

"+t+o+"
"}function T(){f(),D()}function S(){p()}function A(){z.lockHaltKeepAlive&&s(),M(),z.lockCallback!==!1&&(ct=z.lockCallback(z)),x()}function U(){z.lockHaltKeepAlive?s():z.keepAliveInterval&&u(),-1==e("lockStartTime",-1)?M():ot=setInterval(B,500),x()}function L(){I(),E(),z.keepAliveInterval&&u(),n("lockStartTime",-1),l()}function M(){n("lockStartTime",$.now()),ot=setInterval(B,500)}function I(){clearInterval(ot)}function B(){if(1==e("logoutTriggered"))return I(),N();if(-1==e("lockStartTime",-1))return L();var t=e("lockStartTime")+z.lockTimeLimit-1;return $.now()>=t?(I(),1==e("logoutTriggered")?N():O()):void q()}function x(){if(ct){P(),q();var t={message:$("#jitp-lock-display")};t=$.extend(t,z.lockBlockUiConfig),$.blockUI(t),ut=!0}}function E(){$.unblockUI(),ut=!1}function q(){if(null!==dt){var t=$.now(),o=Math.floor((e("lockStartTime",t)+z.lockTimeLimit-t)/1e3);dt.html(G(o))}}function P(){if(null===st){var t="";t=z.lockContentCallback!==!1?z.lockContentCallback(z):z.bootstrap?W():H(),F.append(t),st=$("#jitp-lock-display"),0!=z.lockCountdownMessage&&(dt=st.find(".jitp-countdown-holder")),$("#jitp-lock-logout").on("click",function(){Q()}),$("#jitp-lock-unlock").on("click",function(){K()}),$("#jitp-lock-form").length&&$("#jitp-lock-form").submit(function(){return K(),!1}),q()}}function W(){var t=null!==z.lockTitle?'

'+z.lockTitle+"

":"",o=z.lockLogoutButton.replace(/{username}/g,z.lockUsername),n=z.lockCountdownMessage?'":"";return'"}function H(){var t=null!==z.lockTitle?"
"+z.lockTitle+"
":"",o=z.lockLogoutButton.replace(/{username}/g,z.lockUsername),n=z.lockCountdownMessage?"":"";return'"}function Q(){I(),D()}function K(){z.lockPassCallback($("#jitp-lock-pass").val())}function Y(){s(),a(),f(),I()}function D(){Y(),n("logoutTriggered",!0),("function"!=typeof z.logoutCallback||z.logoutCallback(z))&&window.location.replace(z.logoutUrl)}function N(){Y(),("function"!=typeof z.logoutAutoCallback||z.logoutAutoCallback(z))&&window.location.replace(z.logoutAutoUrl)}function O(){return Y(),z.multiWindowSupport?void setTimeout(X,J(100,500)):X()}function X(){return e("logoutTriggered",!1)?N():(n("logoutTriggered",!0),void(("function"!=typeof z.redirectCallback||z.redirectCallback(z))&&window.location.replace(z.redirectUrl)))}function G(t){var o=Math.floor(t/60);if(15>=o){var n=t%60,e=o>0?o+"m ":"";return e+=n+"s"}if(75>=o)return 22>=o?"about 15 mins":37>=o?"about 30 mins":52>=o?"about 25 mins":"about 1 hour";var l=Math.floor(o/60);return o%=60,15>=o||o>52?"about "+l+" hours":"about "+l+"½ hours"}function J(t,o){return Math.floor(Math.random()*(o-t))+t}var z={idleTimeLimit:1200,idleCallback:!1,idleCheckHeartbeat:2,activityEvents:"click keypress scroll wheel mousewheel mousemove touchmove",bootstrap:!1,warnEnabled:!0,warnTimeLimit:180,warnCallback:!1,warnContentCallback:!1,warnTitle:"Session Timeout",warnMessage:"Your session is about to expire!",warnStayAliveButton:"Stay Connected",warnLogoutButton:"Logout",warnCountdownMessage:"Time remaining: {timer}",warnCountdownBar:!1,redirectUrl:"/timed-out",logoutUrl:"/logout",logoutAutoUrl:"null",redirectCallback:!1,logoutCallback:!1,logoutAutoCallback:!1,keepAliveInterval:600,keepAliveUrl:window.location.href,keepAliveAjaxType:"GET",keepAliveAjaxData:"",lockEnabled:!1,lockTimeLimit:7200,lockHaltKeepAlive:!0,lockCallback:!1,lockContentCallback:!1,lockPassCallback:!1,lockTitle:null,lockUsername:"System User",lockMessage:"Enter your password to unlock the screen",lockUnlockButton:"UnLock",lockLogoutButton:"Not {username} ?",lockCountdownMessage:"Auto-logout in: {timer}",lockBlockUiConfig:{},lockLoadActive:!1,multiWindowSupport:!1},F=$("body"),R=null,V={};V.start=function(t){if(z=$.extend(z,t),null==z.logoutAutoUrl&&(z.logoutAutoUrl=z.logoutUrl),z.idleTimeLimit*=1e3,z.idleCheckHeartbeat*=1e3,z.warnTimeLimit*=1e3,z.lockTimeLimit*=1e3,z.keepAliveInterval*=1e3,z.multiWindowSupport&&!$.localStorage)return console.error("jitp: Multi-Window support requested but JQuery Storage API is unavailable."),!1;if(z.warnEnabled&&z.warnCallback===!1||z.lockEnabled&&z.lockCallback===!1)if(z.bootstrap){if("undefined"==typeof $.fn.modal)return console.error("jitp: Bootstrap library is unavailable"),!1}else if("undefined"==typeof jQuery.ui)return console.error("jitp: jQueryUI library is unavailable"),!1;if(z.lockEnabled&&!z.multiWindowSupport)return console.error("jitp: Lock screen requested but multi-window support is not enabled."),!1;if(z.lockEnabled&&z.lockCallback===!1){if("undefined"==typeof $.blockUI)return console.error("jitp: Lock screen requested but blockUI library is unavailable."),!1;if(z.lockPassCallback===!1)return console.error("jitp: Lock screen requested but lockPassCallback function is not set."),!1}return o(),z.lockEnabled&&(z.lockLoadActive||e("lockStartTime",-1)>0)?U():(n("logoutTriggered",!1),n("warningStartTime",-1),n("lockStartTime",-1),n("lastActivity",$.now()),i(),z.keepAliveInterval&&u()),z.keepAliveInterval&&u(),c(),!0},V.cleanUpLockScreen=function(){o(),$.localStorage&&R.set("lockStartTime",-99)},V.logout=function(){D()},V.displayWarning=function(){v()},V.displayLockScreen=function(){x()},V.initLockScreen=function(){a(),f(),A()},V.rollback=function(){L(),p()};var Z,_,tt,ot,nt=[-1,-1],et=!0,lt=!1,it=null,at=null,rt=null,ct=!0,ut=!1,st=null,dt=null;return V}); \ No newline at end of file +!function(t,o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof exports?module.exports=o(require("jquery")):t.IdleTimeoutPlus=o(t.jQuery)}(this,function(t){function o(){null==R&&(R=$.localStorage?$.initNamespaceStorage("jqueryIdleTimeoutPlus").localStorage:{})}function n(t,o){z.multiWindowSupport?R.set(t,o):R[t]=o}function e(t,o){if(o="undefined"!=typeof o?o:null,z.multiWindowSupport){if(R.isSet(t))return R.get(t)}else if(t in R)return R[t];return o}function l(){n("warningStartTime",-1),n("lockStartTime",-1),i(),z.idleCallback!==!1&&z.idleCallback(z)}function i(){a(),n("lastActivity",$.now()),Z=setInterval(r,z.idleCheckHeartbeat)}function a(){clearInterval(Z)}function r(){var t=e("lastActivity",$.now())+z.idleTimeLimit;return e("logoutTriggered")===!0?N():-1!=e("lockStartTime",-1)?(a(),U()):$.now()>=t?(a(),z.warnEnabled?d():z.lockEnabled?A():O()):void 0}function c(){$(document).on(z.activityEvents,function(t){if("mousemove"===t.type){if(t.clientX===nt[0]&&t.clientY===nt[1])return;nt[0]=t.clientX,nt[1]=t.clientY}-1==e("warningStartTime",-1)&&-1==e("lockStartTime",-1)&&i()})}function u(){s(),_=setInterval(function(){$.ajax({type:z.keepAliveAjaxType,url:z.keepAliveUrl,data:z.keepAliveAjaxData})},z.keepAliveInterval)}function s(){clearInterval(_)}function d(){k(),z.warnCallback!==!1&&(et=z.warnCallback(z)),w()}function p(){f(),b(),n("warningStartTime",-1),l()}function k(){n("warningStartTime",$.now()),tt=setInterval(v,500)}function f(){clearInterval(tt)}function v(){if(e("logoutTriggered")===!0)return f(),N();if(-1==e("warningStartTime",-1))return p();var t=e("warningStartTime")+z.warnTimeLimit-1;return $.now()>=t?(f(),z.lockEnabled?(b(),A()):O()):void m()}function w(){et&&(g(),m(),z.bootstrap?it.modal("show"):it.dialog("open"),lt=!0)}function b(){lt=!1,null!==it&&(z.bootstrap?(it.modal("hide"),F.removeClass("modal-open"),$("div.modal-backdrop").remove()):it.dialog("close"))}function m(){if(null!==it&&(null!==at||null!==rt)){var t=$.now(),o=Math.floor((e("warningStartTime",t)+z.warnTimeLimit-t)/1e3);if(null!==at&&at.html(G(o)),null!=rt){var n=Math.floor(o/(z.warnTimeLimit/1e3)*100);z.bootstrap?rt.css("width",n+"%"):rt.progressbar("value",n)}}}function g(){if(null===it){var t="";t=z.warnContentCallback!==!1?z.warnContentCallback(z):z.bootstrap?C():h(),z.bootstrap?j(t):y(t)}}function j(t){F.append(t),$("#jitp-warn-logout").on("click",function(){T()}),$("#jitp-warn-alive").on("click",function(){S()}),it=$("#jitp-warn-display"),(null!=z.warnCountdownMessage||z.warnCountdownBar)&&(at=it.find(".jitp-countdown-holder")),z.warnCountdownBar&&(rt=$("#jitp-warn-bar"))}function y(t){$(t).dialog({buttons:[{text:z.warnLogoutButton,click:function(){T()}},{text:z.warnStayAliveButton,click:function(){S()}}],closeOnEscape:!1,modal:!0,title:z.warnTitle,minWidth:320,autoOpen:!1,open:function(){null==z.warnTitle?$(this).closest(".ui-dialog").find(".ui-dialog-titlebar").hide():$(this).closest(".ui-dialog").find(".ui-dialog-titlebar-close").hide(),$(this).parent().find("button:nth-child(2)").focus()}}),it=$("#jitp-warn-display"),null!=z.warnCountdownMessage&&(at=it.find(".jitp-countdown-holder")),z.warnCountdownBar&&(rt=$("#jitp-warn-bar"),rt.progressbar({value:0,max:100}))}function C(){var t=z.warnTitle?'":"",o=null!=z.warnCountdownMessage?"

"+z.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",n=z.warnCountdownBar?'
':"";return'"}function h(){var t=null!=z.warnCountdownMessage?"

"+z.warnCountdownMessage.replace(/{timer}/g,'')+"

":"",o=z.warnCountdownBar?'
':"";return'

'+z.warnMessage+"

"+t+o+"
"}function T(){f(),D()}function S(){p()}function A(){z.lockHaltKeepAlive&&s(),M(),z.lockCallback!==!1&&(ct=z.lockCallback(z)),x()}function U(){z.lockHaltKeepAlive?s():z.keepAliveInterval&&u(),-1==e("lockStartTime",-1)?M():ot=setInterval(B,500),x()}function L(){I(),E(),$("#jitp-lock-pass").val(""),z.keepAliveInterval&&u(),n("lockStartTime",-1),l()}function M(){n("lockStartTime",$.now()),ot=setInterval(B,500)}function I(){clearInterval(ot)}function B(){if(1==e("logoutTriggered"))return I(),N();if(-1==e("lockStartTime",-1))return L();var t=e("lockStartTime")+z.lockTimeLimit-1;return $.now()>=t?(I(),1==e("logoutTriggered")?N():O()):void q()}function x(){if(ct){P(),q();var t={message:$("#jitp-lock-display")};t=$.extend(t,z.lockBlockUiConfig),$.blockUI(t),ut=!0}}function E(){$.unblockUI(),ut=!1}function q(){if(null!==dt){var t=$.now(),o=Math.floor((e("lockStartTime",t)+z.lockTimeLimit-t)/1e3);dt.html(G(o))}}function P(){if(null===st){var t="";t=z.lockContentCallback!==!1?z.lockContentCallback(z):z.bootstrap?W():H(),F.append(t),st=$("#jitp-lock-display"),0!=z.lockCountdownMessage&&(dt=st.find(".jitp-countdown-holder")),$("#jitp-lock-logout").on("click",function(){Q()}),$("#jitp-lock-unlock").on("click",function(){K()}),$("#jitp-lock-form").length&&$("#jitp-lock-form").submit(function(){return K(),!1}),q()}}function W(){var t=null!==z.lockTitle?'

'+z.lockTitle+"

":"",o=z.lockLogoutButton.replace(/{username}/g,z.lockUsername),n=z.lockCountdownMessage?'":"";return'"}function H(){var t=null!==z.lockTitle?"
"+z.lockTitle+"
":"",o=z.lockLogoutButton.replace(/{username}/g,z.lockUsername),n=z.lockCountdownMessage?"":"";return'"}function Q(){I(),D()}function K(){z.lockPassCallback($("#jitp-lock-pass").val())}function Y(){s(),a(),f(),I()}function D(){Y(),n("logoutTriggered",!0),("function"!=typeof z.logoutCallback||z.logoutCallback(z))&&window.location.replace(z.logoutUrl)}function N(){Y(),("function"!=typeof z.logoutAutoCallback||z.logoutAutoCallback(z))&&window.location.replace(z.logoutAutoUrl)}function O(){return Y(),z.multiWindowSupport?void setTimeout(X,J(100,500)):X()}function X(){return e("logoutTriggered",!1)?N():(n("logoutTriggered",!0),void(("function"!=typeof z.redirectCallback||z.redirectCallback(z))&&window.location.replace(z.redirectUrl)))}function G(t){var o=Math.floor(t/60);if(15>=o){var n=t%60,e=o>0?o+"m ":"";return e+=n+"s"}if(75>=o)return 22>=o?"about 15 mins":37>=o?"about 30 mins":52>=o?"about 25 mins":"about 1 hour";var l=Math.floor(o/60);return o%=60,15>=o?"about "+l+" hours":o>52?"about "+(l+1)+" hours":"about "+l+"½ hours"}function J(t,o){return Math.floor(Math.random()*(o-t))+t}var z={idleTimeLimit:1200,idleCallback:!1,idleCheckHeartbeat:2,activityEvents:"click keypress scroll wheel mousewheel mousemove touchmove",bootstrap:!1,warnEnabled:!0,warnTimeLimit:180,warnCallback:!1,warnContentCallback:!1,warnTitle:"Session Timeout",warnMessage:"Your session is about to expire!",warnStayAliveButton:"Stay Connected",warnLogoutButton:"Logout",warnCountdownMessage:"Time remaining: {timer}",warnCountdownBar:!1,redirectUrl:"/timed-out",logoutUrl:"/logout",logoutAutoUrl:"null",redirectCallback:!1,logoutCallback:!1,logoutAutoCallback:!1,keepAliveInterval:600,keepAliveUrl:window.location.href,keepAliveAjaxType:"GET",keepAliveAjaxData:"",lockEnabled:!1,lockTimeLimit:7200,lockHaltKeepAlive:!0,lockCallback:!1,lockContentCallback:!1,lockPassCallback:!1,lockTitle:null,lockUsername:"System User",lockMessage:"Enter your password to unlock the screen",lockUnlockButton:"UnLock",lockLogoutButton:"Not {username} ?",lockCountdownMessage:"Auto-logout in: {timer}",lockBlockUiConfig:{},lockLoadActive:!1,multiWindowSupport:!1},F=$("body"),R=null,V={};V.start=function(t){if(z=$.extend(z,t),null==z.logoutAutoUrl&&(z.logoutAutoUrl=z.logoutUrl),z.idleTimeLimit*=1e3,z.idleCheckHeartbeat*=1e3,z.warnTimeLimit*=1e3,z.lockTimeLimit*=1e3,z.keepAliveInterval*=1e3,z.multiWindowSupport&&!$.localStorage)return console.error("jitp: Multi-Window support requested but JQuery Storage API is unavailable."),!1;if(z.warnEnabled&&z.warnCallback===!1||z.lockEnabled&&z.lockCallback===!1)if(z.bootstrap){if("undefined"==typeof $.fn.modal)return console.error("jitp: Bootstrap library is unavailable"),!1}else if("undefined"==typeof jQuery.ui)return console.error("jitp: jQueryUI library is unavailable"),!1;if(z.lockEnabled&&!z.multiWindowSupport)return console.error("jitp: Lock screen requested but multi-window support is not enabled."),!1;if(z.lockEnabled&&z.lockCallback===!1){if("undefined"==typeof $.blockUI)return console.error("jitp: Lock screen requested but blockUI library is unavailable."),!1;if(z.lockPassCallback===!1)return console.error("jitp: Lock screen requested but lockPassCallback function is not set."),!1}return o(),z.lockEnabled&&(z.lockLoadActive||e("lockStartTime",-1)>0)?U():(n("logoutTriggered",!1),n("warningStartTime",-1),n("lockStartTime",-1),n("lastActivity",$.now()),i(),z.keepAliveInterval&&u()),z.keepAliveInterval&&u(),c(),!0},V.cleanUpLockScreen=function(){o(),$.localStorage&&R.set("lockStartTime",-99)},V.logout=function(){D()},V.displayWarning=function(){w()},V.displayLockScreen=function(){x()},V.initLockScreen=function(){a(),f(),A()},V.rollback=function(){L(),p()};var Z,_,tt,ot,nt=[-1,-1],et=!0,lt=!1,it=null,at=null,rt=null,ct=!0,ut=!1,st=null,dt=null;return V}); \ No newline at end of file diff --git a/package.json b/package.json index 8c77ccd..08aa53a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery-idleTimeout-plus", - "version": "0.9.2", + "version": "0.9.3", "description": "User idle detector with session keep-alive, warning dialog, lock screen, url redirection and support for multiple windows and tabs.", "main": "dist/jquery-idleTimeout-plus.js", "homepage": "https://github.com/LinearSoft/jquery-idleTimeout-plus", diff --git a/src/jquery-idleTimeout-plus.js b/src/jquery-idleTimeout-plus.js index 6a5b088..82626a8 100644 --- a/src/jquery-idleTimeout-plus.js +++ b/src/jquery-idleTimeout-plus.js @@ -95,10 +95,10 @@ /* --strip_testing_begin-- */ var testingConfig = { idleTimeLimit: 30, - activityEvents: 'click keypress scroll wheel mousewheel', // Remove mousemove warnTimeLimit: 30, lockTimeLimit: 60, - keepAliveInterval: 10 + keepAliveInterval: 10, + activityEvents: 'click keypress scroll wheel mousewheel' // Remove mousemove }; /* --strip_testing_end-- */ @@ -664,6 +664,7 @@ console.log('rollbackLock called'); stopLockTimer(); closeLockScreen(); + $('#jitp-lock-pass').val(''); //Don't want the password to stay in the field if(config.keepAliveInterval) startKeepSessionAlive(); storeData('lockStartTime',-1); initIdle(); @@ -1010,7 +1011,8 @@ } var hoursLeft = Math.floor(minLeft/60); minLeft %= 60; - if(minLeft <= 15 || minLeft >52) return 'about '+hoursLeft+' hours'; + if(minLeft <= 15) return 'about '+hoursLeft+' hours'; + if(minLeft > 52) return 'about '+(hoursLeft+1)+' hours'; return 'about '+hoursLeft+'½ hours'; }