diff options
author | Ehsan Akhgari <ehsan@mozilla.com> | 2011-02-18 19:44:54 -0500 |
---|---|---|
committer | Ehsan Akhgari <ehsan@mozilla.com> | 2011-02-18 19:44:54 -0500 |
commit | ecae20f028473e4310929df022aa8136a9337021 (patch) | |
tree | cb2a5bd678d90fe3005fd0a4b7069a7423b4ce86 /data | |
parent | 284cc142f9bae029bc0feb42e90ce3408f497e6a (diff) | |
download | bugzilla-triage-ecae20f028473e4310929df022aa8136a9337021.tar.gz |
Actually listen for all mouse and keyboard interactions for the page to determine whether the user is using the page before redirecting
Diffstat (limited to 'data')
-rw-r--r-- | data/js/bug-page-mod.js | 11 |
1 files changed, 8 insertions, 3 deletions
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(); |