aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js135
1 files changed, 72 insertions, 63 deletions
diff --git a/lib/main.js b/lib/main.js
index 849da68..f3e9458 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -23,13 +23,13 @@ function isOurPage(window, matchingURLs) {
var url = window.location.href;
// like ["regexp-url1", "regexp-url2"]
- return matchingURLs.some(function (element,i,a) {
+ return matchingURLs.some(function(element, i, a) {
return new RegExp(element).test(url);
});
}
/**
- *
+ *
*/
function skipThisPage(doc) {
var stemURL = "https://HOSTNAME/show_bug.cgi?id=";
@@ -39,20 +39,21 @@ function skipThisPage(doc) {
var hostname = doc.location.hostname;
if (REArr) {
var bugNo = REArr[1];
- doc.location = stemURL.replace("HOSTNAME",hostname) + bugNo;
+ doc.location = stemURL.replace("HOSTNAME", hostname) + bugNo;
}
}
-var messageHandler = exports.messageHandler = function messageHandler(worker, msg) {
+var messageHandler = exports.messageHandler = function messageHandler(
+ worker, msg) {
switch (msg.cmd) {
case "LogMessage":
console.log(msg.data);
break;
case "ExecCmd":
- libbz.executeCommand(msg.data);
+ libbz.executeCommand(msg.data);
break;
case "AddLogRecord":
- logger.addLogRecord(msg.data);
+ logger.addLogRecord(msg.data);
break;
case "GenerateTS":
logger.generateTimeSheet();
@@ -65,12 +66,12 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms
break;
case "GetInstalledPackages":
// send message with packages back
- libbz.getInstalledPackages(msg.data, function (pkgsMsg) {
+ libbz.getInstalledPackages(msg.data, function(pkgsMsg) {
worker.postMessage(pkgsMsg);
});
break;
case "GetClipboard":
- libbz.getClipboard(function (clipboard) {
+ libbz.getClipboard(function(clipboard) {
worker.postMessage(new Message(msg.data, clipboard));
});
break;
@@ -91,18 +92,23 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms
break;
case "MakeXMLRPCall":
// url, login, method, params, callback
- libbz.makeXMLRPCCall(msg.data.url, msg.data.login, msg.data.method,
- msg.data.params, function(ret) {
- worker.postMessage(new Message(msg.data.callRPC, ret));
- });
+ libbz
+ .makeXMLRPCCall(msg.data.url, msg.data.login,
+ msg.data.method, msg.data.params, function(ret) {
+ worker.postMessage(new Message(msg.data.callRPC,
+ ret));
+ });
break;
case "GetURL":
- libbz.getURL(msg.data.url, function(stuff) {
- worker.postMessage(new Message(msg.data.backMessage, stuff));
- });
+ libbz.getURL(msg.data.url,
+ function(stuff) {
+ worker.postMessage(new Message(msg.data.backMessage,
+ stuff));
+ });
break;
case "OpenBugUpstream":
- libbz.createUpstreamBug(msg.data.url, msg.data.subject, msg.data.comment);
+ libbz.createUpstreamBug(msg.data.url, msg.data.subject,
+ msg.data.comment);
break;
case "testReady":
// we ignore it here, interesting only in unit test
@@ -113,36 +119,36 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms
};
var contentScriptLibraries = [
- self.data.url('lib/urltest.js'),
- self.data.url("lib/util.js"),
- self.data.url("lib/jumpNextBug.js"),
- self.data.url("lib/queries.js"),
- self.data.url("lib/preprocessDuplicates.js"),
- self.data.url("lib/viewSource.js"),
- self.data.url("lib/color.js"),
- self.data.url("lib/addNewLinks.js"),
- self.data.url("lib/bugzillaDOMFunctions.js"),
- self.data.url("lib/xorgBugCategories.js"),
- self.data.url("lib/otherButtons.js"),
- self.data.url("lib/makeBacktraceAttachment.js"),
- self.data.url("lib/fixingAttMIME.js"),
- self.data.url("lib/logging-front.js"),
- self.data.url('lib/bug-page-mod.js'),
- self.data.url("lib/rhbzpage.js"),
- self.data.url("lib/bzpage.js")
+ self.data.url('lib/urltest.js'),
+ self.data.url("lib/util.js"),
+ self.data.url("lib/jumpNextBug.js"),
+ self.data.url("lib/queries.js"),
+ self.data.url("lib/preprocessDuplicates.js"),
+ self.data.url("lib/viewSource.js"),
+ self.data.url("lib/color.js"),
+ self.data.url("lib/addNewLinks.js"),
+ self.data.url("lib/bugzillaDOMFunctions.js"),
+ self.data.url("lib/xorgBugCategories.js"),
+ self.data.url("lib/otherButtons.js"),
+ self.data.url("lib/makeBacktraceAttachment.js"),
+ self.data.url("lib/fixingAttMIME.js"),
+ self.data.url("lib/logging-front.js"),
+ self.data.url('lib/bug-page-mod.js'),
+ self.data.url("lib/rhbzpage.js"),
+ self.data.url("lib/bzpage.js")
];
-libbz.initialize(libbz.config, function () {
+libbz.initialize(libbz.config, function() {
pageMod.PageMod({
- include: [
- "https://bugzilla.redhat.com/show_bug.cgi?id=*",
- "https://bugzilla.mozilla.org/show_bug.cgi?id=*",
- "https://bugzilla.gnome.org/show_bug.cgi?id=*"
+ include : [
+ "https://bugzilla.redhat.com/show_bug.cgi?id=*",
+ "https://bugzilla.mozilla.org/show_bug.cgi?id=*",
+ "https://bugzilla.gnome.org/show_bug.cgi?id=*"
],
- contentScriptWhen: 'ready',
- contentScriptFile: contentScriptLibraries,
- onAttach: function onAttach(worker, msg) {
- worker.on('message', function (msg) {
+ contentScriptWhen : 'ready',
+ contentScriptFile : contentScriptLibraries,
+ onAttach : function onAttach(worker, msg) {
+ worker.on('message', function(msg) {
messageHandler(worker, msg);
});
}
@@ -150,34 +156,37 @@ libbz.initialize(libbz.config, function () {
});
pageMod.PageMod({
- include: [
- "https://bugzilla.redhat.com/process_bug.cgi",
- "https://bugzilla.redhat.com/post_bug.cgi",
- "https://bugzilla.redhat.com/attachment.cgi",
- "https://bugzilla.mozilla.org/process_bug.cgi",
- "https://bugzilla.mozilla.org/post_bug.cgi",
- "https://bugzilla.mozilla.org/attachment.cgi",
- "https://bugzilla.gnome.org/process_bug.cgi",
- "https://bugzilla.gnome.org/post_bug.cgi",
- "https://bugzilla.gnome.org/attachment.cgi"
+ include : [
+ "https://bugzilla.redhat.com/process_bug.cgi",
+ "https://bugzilla.redhat.com/post_bug.cgi",
+ "https://bugzilla.redhat.com/attachment.cgi",
+ "https://bugzilla.mozilla.org/process_bug.cgi",
+ "https://bugzilla.mozilla.org/post_bug.cgi",
+ "https://bugzilla.mozilla.org/attachment.cgi",
+ "https://bugzilla.gnome.org/process_bug.cgi",
+ "https://bugzilla.gnome.org/post_bug.cgi",
+ "https://bugzilla.gnome.org/attachment.cgi"
],
- contentScriptWhen: 'ready',
- contentScriptFile: self.data.url("lib/skip-bug.js")
+ contentScriptWhen : 'ready',
+ contentScriptFile : self.data.url("lib/skip-bug.js")
});
-
// Allow toggling of CC event displays using a context menu entry
contextMenu.Item({
- label: "Toggle CC History",
- contentScriptFile: [self.data.url('lib/urltest.js'),
- self.data.url('lib/cc-context.js')]
+ label : "Toggle CC History",
+ contentScriptFile : [
+ self.data.url('lib/urltest.js'),
+ self.data.url('lib/cc-context.js')
+ ]
});
contextMenu.Item({
- label: "Copy Check-in Comment",
- contentScriptFile: [self.data.url('lib/urltest.js'),
- self.data.url('lib/checkin-context.js')],
- onMessage: function (comment) {
- require("clipboard").set(comment);
+ label : "Copy Check-in Comment",
+ contentScriptFile : [
+ self.data.url('lib/urltest.js'),
+ self.data.url('lib/checkin-context.js')
+ ],
+ onMessage : function(comment) {
+ require("clipboard").set(comment);
}
});