aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan@mozilla.com>2010-05-31 01:17:03 -0400
committerEhsan Akhgari <ehsan@mozilla.com>2010-05-31 01:17:03 -0400
commitf748ed05d4bb4d1d4ea32591fdfc79f02f4389be (patch)
treeb89127536efa6e0c98b1471717c9a542890b9efd /lib/main.js
parent7e1331bc3b30b58679d18cd38b05b6df5b6636e8 (diff)
downloadbugzilla-triage-f748ed05d4bb4d1d4ea32591fdfc79f02f4389be.tar.gz
Don't show our context menu options on other pages
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/main.js b/lib/main.js
index 1de348f..0b66097 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -1,14 +1,21 @@
exports.main = function(options, callback) {
require("tab-browser").whenContentLoaded(
function(window) {
- if (window.location.protocol == "https:" &&
- /bugzilla(-[a-zA-Z]+)*\.mozilla\.org/.test(window.location.href)) {
+ if (onBugzillaPage(window)) {
tweakBugzilla(window.document);
}
}
);
};
+function onBugzillaPage(window) {
+ if ("window" in window) {
+ window = window.window;
+ }
+ return window.location.protocol == "https:" &&
+ /bugzilla(-[a-zA-Z]+)*\.mozilla\.org/.test(window.location.href);
+}
+
function tweakBugzilla(d) {
// run on both bugzilla.m.o and bugzilla-stage-tip.m.o
if (!/bugzilla(-[a-zA-Z]+)*\.mozilla\.org/.test(d.location.href))
@@ -72,6 +79,7 @@ function tweakBugzilla(d) {
var style = d.getElementById("bztw_cc");
var ccMenuItem = contextMenu.Item({
label: "Toggle CC History",
+ context: onBugzillaPage,
onClick: function() style.disabled = !style.disabled
});
contextMenu.add(ccMenuItem);
@@ -155,6 +163,7 @@ function tweakBugzilla(d) {
message = message.textContent;
var copyCheckinCommentItem = contextMenu.Item({
label: "Copy Check-in Comment",
+ context: onBugzillaPage,
onClick: function() require("clipboard").set(message)
});
contextMenu.add(copyCheckinCommentItem);