JillElaine / jquery-idleTimeout

Idle activity timeout and logout redirect for jQuery for multiple windows & tabs
Other
73 stars 79 forks source link

possibility to display custom popup #25

Closed Nigrimmist closed 8 years ago

Nigrimmist commented 8 years ago

Sample of using :

var idle = $(document).idleTimeout({
    redirectUrl: '/autologout',
    // idle settings
    idleTimeLimit: timeout,//*60,
    idleCheckHeartbeat: 2,
    customCallback: false,
    activityEvents: 'click keypress scroll wheel mousewheel mousemove', // separate each event with a space

    enableDialog: true,           // set to false for logout without warning dialog
    dialogDisplayLimit: 180,       // 20 seconds for testing. Time to display the warning dialog before logout (and optional callback) in seconds. 180 = 3 Minutes

    // error message if https://github.com/marcuswestin/store.js not enabled
    errorAlertMessage: 'Please disable "Private Mode", or upgrade to a modern browser.',
    sessionKeepAliveTimer: 600,
    sessionKeepAliveUrl: '/ping',
    onPopupRequired: function () {
        $('#autologoutDialog').modal('show');
    },
    onDialogTimerTicked: function (minutes, seconds) {
        $('#logoutTime').html(minutes + ':' + seconds);
    },
    onDialogShouldBeHided: function () {
        $('#autologoutDialog').modal('hide');
    },
    useCustomPopup: true,
    modifyPageTitle : false
});

$('#btnAutologoutLogout').click(function () {
    idle.logoutUser();
});

$('#btnAutologoutStayLogged').click(function () {
    log('btnAutologoutStayLogged')
    idle.stayLogged();
});
JillElaine commented 8 years ago

Closing pull request.