aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-03-23 20:18:23 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-03-23 20:18:23 +0100
commit2e5993bc9bd0d468f4e9d12dd39e0548ba9adda1 (patch)
treef31a0d612efbfa5beb78e4718768c55c650f14d8 /lib/main.js
parentc662ccddab2cbcc6d13f49a21c04a6aea808f457 (diff)
downloadbugzilla-triage-2e5993bc9bd0d468f4e9d12dd39e0548ba9adda1.tar.gz
Fix indentation and else for Mozilla coding guidelines.
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js228
1 files changed, 114 insertions, 114 deletions
diff --git a/lib/main.js b/lib/main.js
index b553f6f..2e79e3a 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -6,7 +6,7 @@
// http://hg.mozilla.org/users/ehsan.akhgari_gmail.com/extensions/file/tip/bugzillatweaks
// http://hg.mozilla.org/users/ehsan.akhgari_gmail.com/extensions/file/ecfa0f028b81/bugzillatweaks/lib/main.js
// http://hg.mozilla.org/users/avarma_mozilla.com/atul-packages/file/42ac1e99a107/packages\
-// /facebook-acquaintances/lib/main.js#l11
+// /facebook-acquaintances/lib/main.js#l11
// http://ehsanakhgari.org/blog/2010-05-31/my-experience-jetpack-sdk#comment-1253
//
"use strict";
@@ -19,138 +19,138 @@ var logger = require("logger");
var Message = require("util").Message;
function isOurPage(window, matchingURLs) {
- var url = window.location.href;
+ var url = window.location.href;
- // like ["regexp-url1", "regexp-url2"]
- return matchingURLs.some(function (element,i,a) {
- return new RegExp(element).test(url);
- });
+ // like ["regexp-url1", "regexp-url2"]
+ return matchingURLs.some(function (element,i,a) {
+ return new RegExp(element).test(url);
+ });
}
/**
*
*/
function skipThisPage(doc) {
- var stemURL = "https://HOSTNAME/show_bug.cgi?id=";
- var titleElems = doc.getElementsByTagName("title");
- var titleStr = titleElems[0].textContent;
- var REArr = new RegExp("[bB]ug\\s+([0-9]+)").exec(titleStr);
- var hostname = doc.location.hostname;
- if (REArr) {
- var bugNo = REArr[1];
- doc.location = stemURL.replace("HOSTNAME",hostname) + bugNo;
- }
+ var stemURL = "https://HOSTNAME/show_bug.cgi?id=";
+ var titleElems = doc.getElementsByTagName("title");
+ var titleStr = titleElems[0].textContent;
+ var REArr = new RegExp("[bB]ug\\s+([0-9]+)").exec(titleStr);
+ var hostname = doc.location.hostname;
+ if (REArr) {
+ var bugNo = REArr[1];
+ doc.location = stemURL.replace("HOSTNAME",hostname) + bugNo;
+ }
}
var messageHandler = exports.messageHandler = function messageHandler(worker, msg) {
- switch (msg.cmd) {
- case "LogMessage":
- console.log(msg.data);
- break;
- case "ExecCmd":
- libbz.executeCommand(msg.data);
- break;
- case "AddLogRecord":
- logger.addLogRecord(msg.data);
- break;
- case "GenerateTS":
- logger.generateTimeSheet();
- break;
- case "ClearTS":
- logger.clearTimeSheet();
- break;
- case "ImportTS":
- logger.importTimeSheet();
- break;
- case "GetInstalledPackages":
- // send message with packages back
- libbz.getInstalledPackages(msg.data, function (pkgsMsg) {
- worker.postMessage(pkgsMsg);
- });
- break;
- case "GetClipboard":
- libbz.getClipboard(function (clipboard) {
- worker.postMessage(new Message(msg.data, clipboard));
- });
- break;
- case "SetClipboard":
- libbz.setClipboard(msg.data);
- break;
- case "ChangeJSONURL":
- libbz.changeJSONURL();
- break;
- case "OpenURLinPanel":
- libbz.openURLInNewPanel(msg.data);
- break;
- case "OpenURLinTab":
- libbz.openURLInNewTab(msg.data);
- break;
- case "OpenStringInPanel":
- libbz.openStringInNewPanel(msg.data);
- 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));
- });
- break;
- case "GetURL":
- 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);
- break;
- case "testReady":
- // we ignore it here, interesting only in unit test
- break;
- default:
- console.error(msg.toSource());
- }
+ switch (msg.cmd) {
+ case "LogMessage":
+ console.log(msg.data);
+ break;
+ case "ExecCmd":
+ libbz.executeCommand(msg.data);
+ break;
+ case "AddLogRecord":
+ logger.addLogRecord(msg.data);
+ break;
+ case "GenerateTS":
+ logger.generateTimeSheet();
+ break;
+ case "ClearTS":
+ logger.clearTimeSheet();
+ break;
+ case "ImportTS":
+ logger.importTimeSheet();
+ break;
+ case "GetInstalledPackages":
+ // send message with packages back
+ libbz.getInstalledPackages(msg.data, function (pkgsMsg) {
+ worker.postMessage(pkgsMsg);
+ });
+ break;
+ case "GetClipboard":
+ libbz.getClipboard(function (clipboard) {
+ worker.postMessage(new Message(msg.data, clipboard));
+ });
+ break;
+ case "SetClipboard":
+ libbz.setClipboard(msg.data);
+ break;
+ case "ChangeJSONURL":
+ libbz.changeJSONURL();
+ break;
+ case "OpenURLinPanel":
+ libbz.openURLInNewPanel(msg.data);
+ break;
+ case "OpenURLinTab":
+ libbz.openURLInNewTab(msg.data);
+ break;
+ case "OpenStringInPanel":
+ libbz.openStringInNewPanel(msg.data);
+ 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));
+ });
+ break;
+ case "GetURL":
+ 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);
+ break;
+ case "testReady":
+ // we ignore it here, interesting only in unit test
+ break;
+ default:
+ console.error(msg.toSource());
+ }
};
var contentScriptLibraries = [
- self.data.url("lib/jumpNextBug.js"),
- self.data.url("lib/util.js"),
- self.data.url("lib/color.js"),
- self.data.url("lib/logging-front.js"),
- self.data.url("lib/rhbzpage.js"),
- self.data.url("lib/bzpage.js")
+ self.data.url("lib/jumpNextBug.js"),
+ self.data.url("lib/util.js"),
+ self.data.url("lib/color.js"),
+ self.data.url("lib/logging-front.js"),
+ self.data.url("lib/rhbzpage.js"),
+ self.data.url("lib/bzpage.js")
];
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=*"
- ],
- contentScriptWhen: 'ready',
- contentScriptFile: contentScriptLibraries,
- onAttach: function onAttach(worker, msg) {
- worker.on('message', function (msg) {
- messageHandler(worker, msg);
- });
- }
- });
-});
-
-pageMod.PageMod({
+ 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"
+ "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: self.data.url("lib/skip-bug.js")
+ contentScriptFile: contentScriptLibraries,
+ onAttach: function onAttach(worker, msg) {
+ worker.on('message', function (msg) {
+ messageHandler(worker, msg);
+ });
+ }
+ });
+});
+
+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"
+ ],
+ contentScriptWhen: 'ready',
+ contentScriptFile: self.data.url("lib/skip-bug.js")
});
// tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=679515");