Skip to content

Instantly share code, notes, and snippets.

@blewert
Created October 10, 2019 11:35
Show Gist options
  • Save blewert/962a182d65b68cce4a37b8bb4ecafce5 to your computer and use it in GitHub Desktop.
Save blewert/962a182d65b68cce4a37b8bb4ecafce5 to your computer and use it in GitHub Desktop.
var timeout = 30 * 1000;
var lastKeyPress = +(new Date());
setInterval(update, 100);
function update()
{
var diff = +(new Date()) - lastKeyPress;
if(diff > timeout)
window.location.href = "../..";
}
window.addEventListener("keyup", function()
{
lastKeyPress = +(new Date());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment