Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($){
- $.idleTimer = function(){
- var timerIdleCheck=window.setTimeout(function(){
- showTimeoutWarning();
- }, 5000);
- //var timerKeepAlive=window.setInterval(function(){alert('Woot Woot')},5000);
- $(document).mousemove(function(){
- window.clearTimeout(timerIdleCheck);
- timerIdleCheck = window.setTimeout(function(){
- showTimeoutWarning();
- }, 5000);
- });
- this.showTimeoutWarning = function(){
- var dialog=document.createElement('div');
- var timeRemaining=document.createTextnode('60')
- $(dialog).append("Warning! Youve been idle too long and will be log shortly.<br/><b>Time Remaining:</b>").append(timeRemaining).append("<br/><br/>Extend Session?");
- $(dialog).dialog({
- width: 700,
- modal: true,
- buttons:{'Done':function(){ $(this).dialog('destroy') }}
- });
- var timerWarning = window.setInterval(function(){timeRemaing.value=Number(timeRemaining)-1});
- }
- }
- })(jQuery);
Add Comment
Please, Sign In to add comment