diff options
Diffstat (limited to 'lib/main.js')
-rw-r--r-- | lib/main.js | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/lib/main.js b/lib/main.js index 3364971..ae7eece 100644 --- a/lib/main.js +++ b/lib/main.js @@ -13,38 +13,24 @@ // "use strict"; var util = require("util"); -var logger = require("logger"); var file = require("file"); var myStorage = require("simple-storage").storage; var browser = require("tab-browser"); -const JSONURL = "http://matej.ceplovi.cz/progs/data/RH_Data-packages.json"; -var myStorage = require("simple-storage"); +var JSONURL = "http://matej.ceplovi.cz/progs/data/RH_Data-packages.json"; var config = {}; -function initialize(callback) { - util.loadJSON(JSONURL, function(parsedData) { - config.gJSONData = parsedData; +var matches = [ + "https://bugzilla.redhat.com/show_bug.cgi.*", + "https://bugzilla.mozilla.org/show_bug.cgi.*" +]; - 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); +function initialize(callback) { + util.loadJSON(JSONURL, function(parsedData) { + config = {}; + callback(config); + }, this); } // TODO: sometime in the future we should include @@ -70,14 +56,8 @@ exports.main = function main(options, callbacks) { browser.whenContentLoaded( function(window) { var doc = window.document; - if (isOurPage(window, config.gJSONData.configData.matches)) { - console.log("dump config:\n" + config); - var curPage = {}; - if (config.gJSONData.configData.objectStyle = "RH") { - curPage = new require("rhbzpage").RHBugzillaPage(doc, config); - } else if (config.gJSONData.configData.objectStyle = "MoFo") { - curPage = new require("mozillabzpage").MozillaBugzilla(doc, config); - } + if (isOurPage(window, matches)) { + var curPage = new require("rhbzpage").RHBugzillaPage(doc, config); } else { console.log("Not our page: " + window.location.href); } |