From ecae20f028473e4310929df022aa8136a9337021 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Feb 2011 19:44:54 -0500 Subject: Actually listen for all mouse and keyboard interactions for the page to determine whether the user is using the page before redirecting --- data/js/bug-page-mod.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'data/js') diff --git a/data/js/bug-page-mod.js b/data/js/bug-page-mod.js index 3c9b410..f5eea92 100644 --- a/data/js/bug-page-mod.js +++ b/data/js/bug-page-mod.js @@ -61,11 +61,16 @@ function tweakBugzilla(d) { function cancelRedirection() { d.defaultView.clearTimeout(timer); redirectMsg.parentNode.removeChild(redirectMsg); + d.body.removeEventListener("mousedown", interactionDetector, false); + d.body.removeEventListener("keydown", interactionDetector, false); } + function interactionDetector() { + cancelRedirection(); + } + d.body.addEventListener("mousedown", interactionDetector, false); + d.body.addEventListener("keydown", interactionDetector, false); var timer = d.defaultView.setTimeout(function() { - // don't redirect if the user is using the page (for now, we just see - // if they have scrolled the page, in which case we assume that they - // are using the page, or if they've selected anything on the page.) + // don't redirect if the user is using the page. if (d.defaultView.scrollY > 0 || d.defaultView.getSelection().rangeCount > 0) { cancelRedirection(); -- cgit