diff --git a/README.md b/README.md
index 6a36b3f..fb4e7bc 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,14 @@ As long as the user is active, the (optional) keep-alive URL keeps getting pinge
## Documentation
### Options
+**title**
+
+Type: `String`
+
+Default: `'Your session is about to expire!'`
+
+This is the text shown to user via Bootstrap warning dialog after warning period. (modal title)
+
**message**
Type: `String`
@@ -32,6 +40,22 @@ Default: `'Your session is about to expire.'`
This is the text shown to user via Bootstrap warning dialog after warning period.
+**logoutButton**
+
+Type: `String`
+
+Default: `'Logout'`
+
+This is the text shown to user via Bootstrap warning dialog after warning period in the logout button.
+
+**keepAliveButton**
+
+Type: `String`
+
+Default: `'Stay Connected'`
+
+This is the text shown to user via Bootstrap warning dialog after warning period in the Kepp Alive button.
+
**keepAliveUrl**
Type: `String`
@@ -56,6 +80,14 @@ Default: `5000` (5 seconds)
Time in milliseconds between two keep-alive pings.
+**ajaxType**
+
+Type: `String`
+
+Default: `'POST'`
+
+If you need to specify the ajax method
+
**ajaxData**
Type: `String`
diff --git a/dist/bootstrap-session-timeout.js b/dist/bootstrap-session-timeout.js
index 7d33a03..46caa73 100644
--- a/dist/bootstrap-session-timeout.js
+++ b/dist/bootstrap-session-timeout.js
@@ -11,8 +11,12 @@
(function( $ ){
jQuery.sessionTimeout = function( options ) {
var defaults = {
+ title : 'Your Session is About to Expire!',
message : 'Your session is about to expire.',
+ logoutButton : 'Logout',
+ keepAliveButton : 'Stay Connected',
keepAliveUrl : '/keep-alive',
+ ajaxType : 'POST',
ajaxData : '',
redirUrl : '/timed-out',
logoutUrl : '/log-out',
@@ -45,7 +49,21 @@
// unless user set his own callback function, prepare bootstrap modal elements and events
if(typeof opt.onWarn !== 'function'){
// create timeout warning dialog
- $('body').append('
');
+ $('body').append(' \
+
\
+
\
+ \
+
'+ opt.message +'
\
+ \
+
\
+
\
+
');
// "Logout" button click
$('#sessionTimeout-dialog-logout').on('click', function () { window.location = opt.logoutUrl; });
@@ -69,7 +87,7 @@
function keepAlive () {
if (!keepAlivePinged){
$.ajax({
- type: 'POST',
+ type: opt.ajaxType,
url: opt.keepAliveUrl,
data: opt.ajaxData
});
@@ -125,4 +143,4 @@
// start session timer
startSessionTimer();
};
-})( jQuery );
\ No newline at end of file
+})( jQuery );
diff --git a/dist/bootstrap-session-timeout.min.js b/dist/bootstrap-session-timeout.min.js
index b6b2dee..919dce2 100644
--- a/dist/bootstrap-session-timeout.min.js
+++ b/dist/bootstrap-session-timeout.min.js
@@ -1 +1 @@
-"use strict";!function(a){jQuery.sessionTimeout=function(b){function c(){i||(a.ajax({type:"POST",url:h.keepAliveUrl,data:h.ajaxData}),i=!0,setTimeout(function(){i=!1},h.keepAliveInterval))}function d(){clearTimeout(f),h.keepAlive&&c(),f=setTimeout(function(){"function"!=typeof h.onWarn?a("#sessionTimeout-dialog").modal("show"):h.onWarn("warn"),e()},h.warnAfter)}function e(){clearTimeout(f),f=setTimeout(function(){"function"!=typeof h.onRedir?(e("start"),window.location=h.redirUrl):h.onRedir()},h.redirAfter-h.warnAfter)}var f,g={message:"Your session is about to expire.",keepAliveUrl:"/keep-alive",ajaxData:"",redirUrl:"/timed-out",logoutUrl:"/log-out",warnAfter:9e5,redirAfter:12e5,keepAliveInterval:5e3,keepAlive:!0,ignoreUserActivity:!1,onWarn:!1,onRedir:!1},h=g;if(b&&(h=a.extend(g,b)),h.warnAfter>=h.redirAfter)return("undefined"!=typeof console||"undefined"!=typeof console.error)&&console.error('Bootstrap-session-timeout plugin is miss-configured. Option "redirAfter" must be equal or greater than "warnAfter".'),!1;"function"!=typeof h.onWarn&&(a("body").append(''),a("#sessionTimeout-dialog-logout").on("click",function(){window.location=h.logoutUrl}),a("#sessionTimeout-dialog").on("hide.bs.modal",function(){d()})),h.ignoreUserActivity||a(document).on("keyup mouseup mousemove touchend touchmove",function(){d()});var i=!1;d()}}(jQuery);
\ No newline at end of file
+"use strict";(function(e){jQuery.sessionTimeout=function(t){function o(){if(!s){e.ajax({type:r.ajaxType,url:r.keepAliveUrl,data:r.ajaxData});s=true;setTimeout(function(){s=false},r.keepAliveInterval)}}function u(){clearTimeout(i);if(r.keepAlive){o()}i=setTimeout(function(){if(typeof r.onWarn!=="function"){e("#sessionTimeout-dialog").modal("show")}else{r.onWarn("warn")}a()},r.warnAfter)}function a(){clearTimeout(i);i=setTimeout(function(){if(typeof r.onRedir!=="function"){a("start");window.location=r.redirUrl}else{r.onRedir()}},r.redirAfter-r.warnAfter)}var n={title:"Your Session is About to Expire!",message:"Your session is about to expire.",logoutButton:"Logout",keepAliveButton:"Stay Connected",keepAliveUrl:"/keep-alive",ajaxType:"POST",ajaxData:"",redirUrl:"/timed-out",logoutUrl:"/log-out",warnAfter:9e5,redirAfter:12e5,keepAliveInterval:5e3,keepAlive:true,ignoreUserActivity:false,onWarn:false,onRedir:false};var r=n,i;if(t){r=e.extend(n,t)}if(r.warnAfter>=r.redirAfter){if(typeof console!=="undefined"||typeof console.error!=="undefined"){console.error('Bootstrap-session-timeout plugin is miss-configured. Option "redirAfter" must be equal or greater than "warnAfter".')}return false}if(typeof r.onWarn!=="function"){e("body").append('");e("#sessionTimeout-dialog-logout").on("click",function(){window.location=r.logoutUrl});e("#sessionTimeout-dialog").on("hide.bs.modal",function(){u()})}if(!r.ignoreUserActivity){e(document).on("keyup mouseup mousemove touchend touchmove",function(){u()})}var s=false;u()}})(jQuery)