// create the module and name it scotchApp ,'acute.select' //var scotchApp = angular.module('scotchApp', ['ngRoute' ,'ui.bootstrap' ,'mc.resizer' ,'localytics.directives']); var scotchApp = angular.module('scotchApp', ['ngRoute' ,'ngMask' ,'ui.bootstrap' ]); // ,'mc.resizer' scotchApp.run(function ($http) { //alert("scotchApp"); $http.cache = false; }); scotchApp.run(function($rootScope, $templateCache) { $rootScope.$on('$routeChangeStart', function(event, next, current) { if (typeof(current) !== 'undefined'){ $templateCache.remove(current.templateUrl); } }); }); scotchApp.run(function($rootScope ,$document) { var d = new Date(); var n = d.getTime(); //n in ms $rootScope.idleEndTime = n+(45*60*1000); //set end time to 20 min from now $document.find('body').on('mousemove keydown DOMMouseScroll mousewheel mousedown touchstart', checkAndResetIdle); //monitor events function checkAndResetIdle() //user did something { var d = new Date(); var n = d.getTime(); //n in ms if (n>$rootScope.idleEndTime) { $document.find('body').off('mousemove keydown DOMMouseScroll mousewheel mousedown touchstart'); //un-monitor events //$location.search('IntendedURL',$location.absUrl()).path('/login'); //terminate by sending to login page document.location.href = doGetPath('/#/logout');//'https://whatever.com/myapp/#/login'; alert('Session Time Out!!!'); } else { $rootScope.idleEndTime = n+(45*60*1000); //reset end time } } }); var doGetPath = function(url){ var contentPath = window.location.pathname.substring(0, window.location.pathname.indexOf("/",2)); if(contentPath != null || contentPath != ''){ return contentPath+url; }else{ return url; } }; var isNotEntry = function(data){ if(typeof(data) != "undefined"){ if (data != null && data != 'null' && data != '' && data != ' '){ return true; } return false; } return false; } var isEntry = function(data){ if(typeof(data) == "undefined"){ return true; }else if(data == null){ return true; }else if(data == 'null'){ return true; }else if(data == ''){ return true; }else if(data == ' '){ return true; } return false; }