diff options
author | Ehsan Akhgari <ehsan@mozilla.com> | 2011-02-17 21:13:44 -0500 |
---|---|---|
committer | Ehsan Akhgari <ehsan@mozilla.com> | 2011-02-17 21:13:44 -0500 |
commit | f2e448b3c1ba270526f8a188eec6a565046c786b (patch) | |
tree | 30b4120874741cd0ab3add5f5b3f70055bff22f6 /data/js/bug-page-mod.js | |
parent | 0406fd5804e4c4303408f59c0df42d215bc0644e (diff) | |
download | bugzilla-triage-f2e448b3c1ba270526f8a188eec6a565046c786b.tar.gz |
Make the redirection a bit more graceful (allow canceling and redirect after 2 seconds)
Diffstat (limited to 'data/js/bug-page-mod.js')
-rw-r--r-- | data/js/bug-page-mod.js | 21 |
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); } } |