1/** 2 * Logout users after some minutes of inactivity 3 */ 4 5 6function inactivityLogOut(_time_to_logout) { 7 let logout_time = _time_to_logout; 8 setTimeout(checkLastActivityTime, logout_time); 9} 10 11function addLoadEvent(func) { 12 let oldonload = window.onload; 13 if (typeof window.onload != 'function') { 14 window.onload = func; 15 } else { 16 window.onload = function() { 17 if (oldonload) { 18 oldonload(); 19 } 20 func(); 21 } 22 } 23} 24 25function getCookie(cname) { 26 let name = cname + "="; 27 let ca = document.cookie.split(';'); 28 29 for (const cookie of ca) { 30 let c = cookie.trim(); 31 if (c.startsWith(name)) { 32 return c.substring(name.length); 33 } 34 } 35 36 return ""; 37} 38 39function checkLastActivityTime() { 40 let la = getCookie('last_request'); 41 let currdate = Date.now(); 42 let diff = Math.floor((Math.abs(currdate - la * 1000) / 1000) / 60); 43 if (diff >= logout_time / 1000 / 60) { 44 // document.cookie = 'last_request; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; 45 window.location = '/logout.html?msg=logout'; 46 } 47}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.