Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions dist/js/jquery-idleTimeout-plus-iframe.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/**
* This work is licensed under the Creative Commons Attribution-Share Alike 3.0
* United States License. To view a copy of this license,
* visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter
* to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
* Modified by: Jason Abraham (CrashSensei)
* Written by: Jason Abraham (CrashSensei)
* Email: jason@linearsoft.com
* License: GPLv3 (https://www.gnu.org/licenses/gpl-3.0-standalone.html)
*
* Configurable idle (no activity) timer and logout redirect for jQuery.
* Supports both jQueryUI dialogs or Bootstrap modals
Expand All @@ -19,7 +15,7 @@
* Multi-window support requires JQuery Storage API
* Dialogs require either jQueryUI or Bootstrap
*
* version 0.5.0
* version 0.9.5
**/

(function(root, factory) {
Expand Down Expand Up @@ -57,7 +53,7 @@
// Auto-Url settings (NOTE: if a callback is defined auto url redirection will only occur if the callback returns true)
redirectUrl: '/timed-out', // URL if no action is taken after the warning/lock screen timeout
logoutUrl: '/logout', // URL if the user clicks "Logout" on the warning/lock screen
logoutAutoUrl: 'null', // URL for secondary tabs that received an automatic logout trigger (to help avoid race conditions)
logoutAutoUrl: null, // URL for secondary tabs that received an automatic logout trigger (to help avoid race conditions)
redirectCallback: false,
logoutCallback: false,
logoutAutoCallback: false,
Expand All @@ -67,7 +63,9 @@
keepAliveUrl: window.location.href, // set URL to ping - does not apply if keepAliveInterval: false
keepAliveAjaxType: 'GET',
keepAliveAjaxData: '',

keepAliveResponse: false, // add ability to check keep alive's response. if user was logged out by other means, or something went wrong, redirect to keepAliveBadUrl - Set to false to disable KeepAliveBadUrl redirection
keepAliveBadUrl: window.location.href, // set URL to redirect to if keepAliveResponse wasn't what was expected and if keepAliveResponse isn't set to false

// Lock Screen settings
lockEnabled: false, // Set to true to enable lock screen before redirecting
lockTimeLimit: 7200, // 2 hrs
Expand All @@ -88,7 +86,7 @@
iframesSupport: false, // Enable iframe support (also requires multiWindow support to work)
multiWindowSupport: false // Requires jquery-storage-api
};
var bodyElm = $('body'); // Store for jQuery optimization
var bodyElm = null;
var dataStore = null;
//#########################################################################
// ### Public API Functions
Expand All @@ -101,9 +99,10 @@
* @return {boolean} - Returns true if successfully initialized
*/
api.start = function(userConfig) {
bodyElm = $('body');
//--Merge default and user configs
config = $.extend(config, userConfig);
if (config.logoutAutoUrl === null) config.logoutAutoUrl = config.logoutUrl;
if (config.logoutAutoUrl == null) config.logoutAutoUrl = config.logoutUrl;
//--Convert secs to millisecs
config.idleTimeLimit *= 1000;
config.idleCheckHeartbeat *= 1000;
Expand Down Expand Up @@ -349,7 +348,12 @@
$.ajax({
type: config.keepAliveAjaxType,
url: config.keepAliveUrl,
data: config.keepAliveAjaxData
data: config.keepAliveAjaxData,
success: function(response){
if(config.keepAliveResponse !== false && $.trim(response) !== config.keepAliveResponse){
window.location.replace(config.keepAliveBadUrl);
}
}
});
}, config.keepAliveInterval);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/jquery-idleTimeout-plus-iframe.min.js

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions dist/js/jquery-idleTimeout-plus.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/**
* This work is licensed under the Creative Commons Attribution-Share Alike 3.0
* United States License. To view a copy of this license,
* visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter
* to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
* Modified by: Jason Abraham (CrashSensei)
* Written by: Jason Abraham (CrashSensei)
* Email: jason@linearsoft.com
* License: GPLv3 (https://www.gnu.org/licenses/gpl-3.0-standalone.html)
*
* Configurable idle (no activity) timer and logout redirect for jQuery.
* Supports both jQueryUI dialogs or Bootstrap modals
Expand All @@ -19,7 +15,7 @@
* Multi-window support requires JQuery Storage API
* Dialogs require either jQueryUI or Bootstrap
*
* version 0.5.0
* version 0.9.5
**/

(function(root, factory) {
Expand Down Expand Up @@ -57,7 +53,7 @@
// Auto-Url settings (NOTE: if a callback is defined auto url redirection will only occur if the callback returns true)
redirectUrl: '/timed-out', // URL if no action is taken after the warning/lock screen timeout
logoutUrl: '/logout', // URL if the user clicks "Logout" on the warning/lock screen
logoutAutoUrl: 'null', // URL for secondary tabs that received an automatic logout trigger (to help avoid race conditions)
logoutAutoUrl: null, // URL for secondary tabs that received an automatic logout trigger (to help avoid race conditions)
redirectCallback: false,
logoutCallback: false,
logoutAutoCallback: false,
Expand All @@ -67,7 +63,9 @@
keepAliveUrl: window.location.href, // set URL to ping - does not apply if keepAliveInterval: false
keepAliveAjaxType: 'GET',
keepAliveAjaxData: '',

keepAliveResponse: false, // add ability to check keep alive's response. if user was logged out by other means, or something went wrong, redirect to keepAliveBadUrl - Set to false to disable KeepAliveBadUrl redirection
keepAliveBadUrl: window.location.href, // set URL to redirect to if keepAliveResponse wasn't what was expected and if keepAliveResponse isn't set to false

// Lock Screen settings
lockEnabled: false, // Set to true to enable lock screen before redirecting
lockTimeLimit: 7200, // 2 hrs
Expand All @@ -88,7 +86,7 @@

multiWindowSupport: false // Requires jquery-storage-api
};
var bodyElm = $('body'); // Store for jQuery optimization
var bodyElm = null;
var dataStore = null;
//#########################################################################
// ### Public API Functions
Expand All @@ -101,9 +99,10 @@
* @return {boolean} - Returns true if successfully initialized
*/
api.start = function(userConfig) {
bodyElm = $('body');
//--Merge default and user configs
config = $.extend(config, userConfig);
if (config.logoutAutoUrl === null) config.logoutAutoUrl = config.logoutUrl;
if (config.logoutAutoUrl == null) config.logoutAutoUrl = config.logoutUrl;
//--Convert secs to millisecs
config.idleTimeLimit *= 1000;
config.idleCheckHeartbeat *= 1000;
Expand Down Expand Up @@ -335,7 +334,12 @@
$.ajax({
type: config.keepAliveAjaxType,
url: config.keepAliveUrl,
data: config.keepAliveAjaxData
data: config.keepAliveAjaxData,
success: function(response){
if(config.keepAliveResponse !== false && $.trim(response) !== config.keepAliveResponse){
window.location.replace(config.keepAliveBadUrl);
}
}
});
}, config.keepAliveInterval);
}
Expand Down
Loading