added idle clear timer

This commit is contained in:
ville rantanen
2018-05-30 11:32:06 +03:00
parent 73e42b8024
commit b2920ab3ac

View File

@@ -286,8 +286,7 @@ function keyboard_entry(ev) {
toggle_blank(); toggle_blank();
} }
if (/C/.test(k)) { if (/C/.test(k)) {
document.getElementById("filter").value=''; clear();
filter(ev);
} }
} }
@@ -426,6 +425,21 @@ function set_cookie(name,value) {
document.cookie = name + "=" + value.toString() + "&" + window.location.pathname + document.cookie = name + "=" + value.toString() + "&" + window.location.pathname +
";path=" + window.location.pathname + ";max-age="+ (60*60*2).toString() + ";"; ";path=" + window.location.pathname + ";max-age="+ (60*60*2).toString() + ";";
} }
function clear() {
document.getElementById("filter").value = '';
filter(true);
}
function resetTimer() {
clearTimeout(idleTimer);
idleTimer = setTimeout(clear, 20 * 60 * 1000); // 20 minutes
}
var idleTimer;
window.onload = resetTimer;
document.onmousemove = resetTimer;
document.onmouseclick = resetTimer;
document.onkeypress = resetTimer;
document.onkeyup = keyboard_entry; document.onkeyup = keyboard_entry;
document.onscroll = scroll_save; document.onscroll = scroll_save;
var linkReg=/([^\[]*)\[([^\]]+)\]\(([^\)]+)\)(.*)/; var linkReg=/([^\[]*)\[([^\]]+)\]\(([^\)]+)\)(.*)/;