PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.7.0
Defender Security – Malware Scanner, Login Security & Firewall v5.7.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / assets / js / idle-session.js

idle-session.js in Defender Security – Malware Scanner, Login Security & Firewall 5.7.0, at assets/js/idle-session.js

2 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var _wpdef_idle_params;"undefined"==typeof wpdef_idle_params&&console.warn("wpdef_idle_params is undefined. Ensure it is properly set for idle detection.");var idleTimer,idleThreshold="undefined"!=typeof wpdef_idle_params&&wpdef_idle_params.timeout?1e3*Math.min(Number((null===(_wpdef_idle_params=wpdef_idle_params)||void 0===_wpdef_idle_params?void 0:_wpdef_idle_params.timeout)||60),2147483):6e4,tabId=Math.random().toString(36).substring(2,11),currentState="active",supportsBroadcastChannel="undefined"!=typeof BroadcastChannel,bc=supportsBroadcastChannel?new BroadcastChannel("idle-detection-channel"):null;function broadcastState(e){supportsBroadcastChannel&&bc&&bc.postMessage({state:e,timestamp:Date.now(),tabId:tabId})}function logoutUser(){"undefined"==typeof wpdef_idle_params||wpdef_idle_params.stop||fetch(wpdef_idle_params.ajax_url+"?action=wpdef_logout",{method:"POST",credentials:"same-origin"}).then(function(){handleLogin(),wpdef_idle_params.stop=!0}).catch(function(){handleLogin(),wpdef_idle_params.stop=!0})}function handleLogin(){var e=window.location.href,t=wpdef_idle_params.login_url+"?redirect_to="+encodeURIComponent(e);window.location.href=t}function setActive(){"idle"!==currentState||arguments.length>0&&void 0!==arguments[0]&&arguments[0]||(currentState="active",broadcastState("active"))}function setIdle(){"idle"!==currentState&&(currentState="idle",broadcastState("idle"),logoutUser())}function resetIdleTimer(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];clearTimeout(idleTimer),e||setActive(),idleTimer=setTimeout(setIdle,idleThreshold)}var lastEventTime=0;function throttledResetIdleTimer(){var e=Date.now();e-lastEventTime<200||(lastEventTime=e,resetIdleTimer())}document.addEventListener("mousemove",throttledResetIdleTimer,{passive:!0}),document.addEventListener("wheel",throttledResetIdleTimer,{passive:!0}),document.addEventListener("scroll",throttledResetIdleTimer,{passive:!0}),document.addEventListener("keydown",resetIdleTimer),document.addEventListener("mousedown",resetIdleTimer),document.addEventListener("touchstart",resetIdleTimer),document.addEventListener("visibilitychange",function(){"visible"===document.visibilityState&&resetIdleTimer()}),resetIdleTimer(),supportsBroadcastChannel&&bc?(bc.onmessage=function(e){var t=e.data,d=t.state;t.tabId!==tabId&&"active"===d&&resetIdleTimer(!0)},window.addEventListener("pagehide",function(){bc.close()})):console.warn("BroadcastChannel API is not supported in this browser. Multi-tab idle detection will not work.");
2