diff --git a/README.md b/README.md index 9ffc25a..cc426e7 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,14 @@ Default: `'Logout'` This is the text shown to user via Bootstrap warning dialog after warning period in the logout button. +**logoutButtonCallback**
+ +Type: `Boolean` or `function` + +Default: `false` + +This is a way to set a custom callback behavior for the logout button. + **keepAliveButton**
Type: `String` @@ -56,6 +64,14 @@ Default: `'Stay Connected'` This is the text shown to user via Bootstrap warning dialog after warning period in the Keep Alive button. +**keepAliveButtonCallback**
+ +Type: `Boolean` or `function` + +Default: `false` + +This is a way to set a custom callback behavior for the keep alive button. + **keepAliveUrl** Type: `String` @@ -188,6 +204,31 @@ Default: `false` Custom callback you can use instead of redirecting the user to `redirUrl`. Takes options object as the only argument. +**activityHidesModal** + +Type: `Boolean` + +Default: `true` + +If `false`, the modal persists on the screen regardless of mouse or keyboard activity. + +**resetTimerWhileModalOpen** + +Type: `Boolean` + +Default: `true` + +If `false`, the timer is not reset on any mouse or keyboard activity. + +**isModalStatic** + +Type: `Boolean` + +Default: `false` + +If `true`, the modal persists on the screen even when user clicks outside of the modal element or presses the escape key. +To dismiss the modal the user must use the buttons. + ## Examples You can play around with the examples in the `/examples` directory. diff --git a/dist/bootstrap-session-timeout.js b/dist/bootstrap-session-timeout.js index 1d65189..14d19d1 100644 --- a/dist/bootstrap-session-timeout.js +++ b/dist/bootstrap-session-timeout.js @@ -14,7 +14,11 @@ title: 'Your Session is About to Expire!', message: 'Your session is about to expire.', logoutButton: 'Logout', + // allow control of logoutButton callback + logoutButtonCallback: false, keepAliveButton: 'Stay Connected', + // allow control of keepAliveButton callback + keepAliveButtonCallback: false, keepAliveUrl: '/keep-alive', ajaxType: 'POST', ajaxData: '', @@ -30,7 +34,13 @@ onRedir: false, countdownMessage: false, countdownBar: false, - countdownSmart: false + countdownSmart: false, + // allow control over show/hide modal on mouse or keyboard activity + activityHidesModal: true, + // allow control over timer reset while modal is shown + resetTimerWhileModalOpen: true, + // allow ability to set modal as static. + isModalStatic: false }; var opt = defaults, @@ -60,8 +70,11 @@ \ ' : ''; + // if isModalStatic is true, set modal data attributes to make the modal static + var modalStaticAttributes = opt.isModalStatic ? 'data-backdrop="static" data-keyboard="false"' : ''; + // Create timeout warning dialog - $('body').append('