aboutsummaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan@mozilla.com>2011-02-17 21:13:44 -0500
committerEhsan Akhgari <ehsan@mozilla.com>2011-02-17 21:13:44 -0500
commitf2e448b3c1ba270526f8a188eec6a565046c786b (patch)
tree30b4120874741cd0ab3add5f5b3f70055bff22f6 /data
parent0406fd5804e4c4303408f59c0df42d215bc0644e (diff)
downloadbugzilla-triage-f2e448b3c1ba270526f8a188eec6a565046c786b.tar.gz
Make the redirection a bit more graceful (allow canceling and redirect after 2 seconds)
Diffstat (limited to 'data')
-rw-r--r--data/js/bug-page-mod.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/data/js/bug-page-mod.js b/data/js/bug-page-mod.js
index fcddcbd..f511c7c 100644
--- a/data/js/bug-page-mod.js
+++ b/data/js/bug-page-mod.js
@@ -54,12 +54,29 @@ function tweakBugzilla(d) {
if (/\/(process_bug|attachment).cgi$/.test(d.location.href)) {
var bug = getBugNumber(d);
if (bug) {
- d.body.innerHTML = "Changes submitted; reloading bug " + bug;
var url = d.location.href;
url = url.replace("process_bug.cgi", "show_bug.cgi");
url = url.replace("attachment.cgi", "show_bug.cgi");
url += "?id=" + bug;
- d.location.href = url;
+ var timer = d.defaultView.setTimeout(function() {
+ d.location.href = url;
+ }, 2000);
+ var redirectMsg = d.createElement("div");
+ redirectMsg.setAttribute("style", "font-weight: bold; text-align: center; border: 1px solid gray; margin: 10px 0; color: gray;");
+ redirectMsg.appendChild(d.createTextNode("Changes submitted, reloading bug " + bug + " in 2 seconds... ("));
+ var cancelLink = d.createElement("a");
+ cancelLink.setAttribute("href", "javascript:void(0)");
+ cancelLink.setAttribute("style", "color: black;");
+ cancelLink.addEventListener("click", function(event) {
+ event.preventDefault = true;
+ d.defaultView.clearTimeout(timer);
+ redirectMsg.parentNode.removeChild(redirectMsg);
+ }, false);
+ cancelLink.appendChild(d.createTextNode("Cancel"));
+ redirectMsg.appendChild(cancelLink);
+ redirectMsg.appendChild(d.createTextNode(")"));
+ var header = d.getElementById("header");
+ header.insertBefore(redirectMsg, header.firstChild);
}
}