From 31d272a3785dbf7c91fc9ac4e2e9ddd5df136785 Mon Sep 17 00:00:00 2001 From: diakonos Date: Tue, 10 Mar 2015 20:22:55 +0800 Subject: [PATCH 1/2] Fixed timer reset when dialog is open Check if the dialog is open at the event listener, not in startDialogTimer(). --- dist/bootstrap-session-timeout.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/bootstrap-session-timeout.js b/dist/bootstrap-session-timeout.js index 9690881..b463254 100644 --- a/dist/bootstrap-session-timeout.js +++ b/dist/bootstrap-session-timeout.js @@ -94,7 +94,10 @@ // Reset timer on any of these events if (!opt.ignoreUserActivity) { $(document).on('keyup mouseup mousemove touchend touchmove', function() { - startSessionTimer(); + if(!$('#session-timeout-dialog').hasClass('in')) { + // If warning dialog is not already open start session timer + startSessionTimer(); + } }); } @@ -149,9 +152,8 @@ function startDialogTimer() { // Clear session timer clearTimeout(timer); - if (!$('#session-timeout-dialog').hasClass('in') && (opt.countdownMessage || opt.countdownBar)) { - // If warning dialog is not already open and either opt.countdownMessage - // or opt.countdownBar are set start countdown + if ((opt.countdownMessage || opt.countdownBar)) { + // If either opt.countdownMessage or opt.countdownBar are set start countdown startCountdownTimer('dialog', true); } // Set dialog timer From 13431b7ecc7fde5743b61cfdf071d0a9387aa5b1 Mon Sep 17 00:00:00 2001 From: diakonos Date: Tue, 10 Mar 2015 20:24:36 +0800 Subject: [PATCH 2/2] fixed indentation --- dist/bootstrap-session-timeout.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/bootstrap-session-timeout.js b/dist/bootstrap-session-timeout.js index b463254..506db35 100644 --- a/dist/bootstrap-session-timeout.js +++ b/dist/bootstrap-session-timeout.js @@ -95,9 +95,9 @@ if (!opt.ignoreUserActivity) { $(document).on('keyup mouseup mousemove touchend touchmove', function() { if(!$('#session-timeout-dialog').hasClass('in')) { - // If warning dialog is not already open start session timer - startSessionTimer(); - } + // If warning dialog is not already open start session timer + startSessionTimer(); + } }); }