08.04.2024, 10:11
Use this revised version. The timeout timer is reset when a plan changes (either by user interaction or by calling showPlan):
Code:
$(function() {
var timeout = 5 // in seconds
var ticks = 0
var events = 'vclick vmousedown vmouseout touchend'
setInterval(function() {
ticks++
if (ticks == timeout) {
window.location = '/logout'
}
}, 1000)
function reset() {
ticks = 0
}
$(document).on(events, reset)
$(document.body).on('showplan', reset)
$('iframe').on('load', function() {
try {
$(this).contents().find('html').on(events, reset)
} catch (e) {}
})
})