diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-06-17 18:20:03 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-06-17 18:20:03 +0200 |
commit | 9279d5bc3902ab0b18af3a3f8440b8ddd884dec5 (patch) | |
tree | 1f642276cfbd30c70cae6307253020206d87e235 /lib/main.js | |
parent | 620ca44cfa360d6e100215619acab8ae1eb10f34 (diff) | |
download | bugzilla-triage-9279d5bc3902ab0b18af3a3f8440b8ddd884dec5.tar.gz |
Inheritance works, now there are jetpack-prototype-related bugs
Diffstat (limited to 'lib/main.js')
-rw-r--r-- | lib/main.js | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/lib/main.js b/lib/main.js index cb803f8..f083b3f 100644 --- a/lib/main.js +++ b/lib/main.js @@ -13,44 +13,95 @@ // "use strict"; var util = require("util"); -var file = require("file"); +var logger = require("logger"); var myStorage = require("simple-storage").storage; var browser = require("tab-browser"); var JSONURL = "http://matej.ceplovi.cz/progs/data/RH_Data-packages.json"; -var config = {}; +var TriagedDistro = 13; +var NumberOfFrames = 7; +var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi"; -var matches = [ - "https://bugzilla.redhat.com/show_bug.cgi.*", - "https://bugzilla.mozilla.org/show_bug.cgi.*" +var config = {}; +config.matches = [ + "https://bugzilla.redhat.com/show_bug.cgi", + "https://bugzilla.mozilla.org/show_bug.cgi" ]; -function initialize(callback) { - util.loadJSON(JSONURL, function(parsedData) { - config = {}; - callback(config); - }, this); -} +// ============================================================== +// https://wiki.mozilla.org/Labs/Jetpack/JEP/24 +var WillBemanifest = { + settings : [ + { + name : "BZpassword", + type : "password", + label : "Bugzilla password" + }, + { + name : "JSONURL", + type : "text", + label : "Configuration file URL", + "default" : "http://mcepl.fedorapeople.org/scripts/BugZappers_data.json" + }, + { + name : "enabledPacks", + type : "text", + label : "comment packs which should be enabled", + "default" : "" + } + ] +}; +// TODO: sometime in the future we should include +// also skip-process.js functionality and these URLs +// "https://bugzilla.redhat.com/process_bug.cgi", +// "https://bugzilla.redhat.com/post_bug.cgi", +// "https://bugzilla.mozilla.org/post_bug.cgi", +// "https://bugzilla.mozilla.org/process_bug.cgi" function isOurPage(window, matchingURLs) { if ("window" in window) { window = window.window; } var url = window.location.href; + // like ["regexp-url1", "regexp-url2"] return matchingURLs.some(function (element,i,a) { return new RegExp(element).test(url); }); } +function initialize(callback) { + util.loadJSON(JSONURL, function(parsedData) { + config.gJSONData = parsedData; + + var keys = "", key = ""; + for (key in config.gJSONData) { + keys += key + " "; + } + console.log("loaded JSON object keys: " + keys); + + // Get card translation table + if ("PCIIDsURL" in config.gJSONData.configData) { + util.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) { + config.PCI_ID_Array = response; + }); + } + + config.logger = new logger.Logger(myStorage.logs, + config.gJSONData.constantData.bugzillalabelAbbreviations); + + callback(config); + }, this); +} + exports.main = function main(options, callbacks) { initialize(function (config) { browser.whenContentLoaded( function(window) { var doc = window.document; var construct = require("rhbzpage").RHBugzillaPage; - if (isOurPage(window, matches)) { + if (isOurPage(window, config.matches)) { var curPage = new construct(doc, config); } else { console.log("Not our page: " + window.location.href); |