aboutsummaryrefslogblamecommitdiffstats
path: root/lib/main.js
blob: ac0186825ad48cb474060ce17dd5fc84b4c08b26 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                                                                                                                                                                                   
                   

                                                     
             


                               

                                        
                                   
                                   
 
                       
                       
                                                         
                                                            
                                       
 
                                                                 
                                               
                










                                                                                        



                                      
                                                                


                              

                                          
 
 

                                                                        
                       

                          

                   
 
                                                                                
 


                                               
                                               
  
                                                                         
                                  





                                       
                                                     
                                                                                    


                                           
 
                                                     










                                                                      
         
/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
/*global jetpack */
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
var utilMod = require("util");
var logMod = require("logger");

jetpack.future.import("pageMods");
jetpack.future.import("storage.simple");
jetpack.future.import("selection");
jetpack.future.import("clipboard");

var TriagedDistro = 13;
var NumberOfFrames = 7;
var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
var myStorage = jetpack.storage.simple;

// ==============================================================
// https://wiki.mozilla.org/Labs/Jetpack/JEP/24
var manifest = {
    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" : ""
            }
    ]
};
jetpack.future.import("storage.settings");


// TODO we should have an array SpecialFlags instead of multiple Boolean
// variables
var logSubmits = false;
var chipIDsGroupings = [];
var AddrArray = [];
var topRow = {};
var bottomRow = {};

// /////////////////////////////////////////////////////////////////////////////

let config = {};
config.matches = [
    "https://bugzilla.redhat.com/show_bug.cgi",
    "https://bugzilla.mozilla.org/show_bug.cgi"
];
utilMod.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) {
    config.gJSONData = parsedData;

    // Get card translation table
    let keys = "";
    for (let key in config.gJSONData) {
        keys += key + " ";
    }
    if ("PCIIDsURL" in config.gJSONData.configData) {
        utilMod.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
            config.PCI_ID_Array = response;
        });
    }

    config.logger = new logMod.Logger(myStorage.logs,
        config.gJSONData.constantData.bugzillalabelAbbreviations);
    
    let callback = function(doc) {
        if (config.gJSONData.configData.objectStyle = "RH") {
            let curPage = new RHBugzillaPage(doc);
        } else if (config.gJSONData.configData.objectStyle = "MoFo") {
            let curPage = new MozillaBugzilla(doc);
        }
    };

    jetpack.pageMods.add(callback, config);
}, this);