-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiming_test2.html
64 lines (52 loc) · 1.11 KB
/
timing_test2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<html lang="en">
<head>
<title>Timer Test</title>
<script type="text/javascript">
<!--
function InactivityTimer(path, delay) {
// private instance var
var timeout;
// private functions
function logout() {
if (confirm('This page is set to refresh in 20 seconds. Would you like more time?'))
{reset}
else {
alert("you've been logged out");
window.location.href = path || "/";
}
}
function reset() {
stop();
start();
}
function start() {
if (!timeout) {
timeout = setTimeout(logout, delay || 5000);
}
}
function stop() {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
}
// export public api
this.start = start;
this.stop = stop;
this.reset = reset;
// init
document.addEventListener("mousemove", reset);
document.addEventListener("keypress", reset);
}
function startTimer() {
var timer = new InactivityTimer("/logout", 5000);
}
-->
</script>
</head>
<body>
<p>Timer test</p>
<button onclick="startTimer()">Start timer</button>
<embed src="simpleform.pdf" width="500" height="600">
</body>
</html>