aboutsummaryrefslogtreecommitdiffstats
path: root/lib/old-main.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/old-main.js')
-rw-r--r--lib/old-main.js106
1 files changed, 106 insertions, 0 deletions
diff --git a/lib/old-main.js b/lib/old-main.js
new file mode 100644
index 0000000..db81448
--- /dev/null
+++ b/lib/old-main.js
@@ -0,0 +1,106 @@
+/*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
+//
+// Links to read through
+// http://ehsanakhgari.org/blog/2010-01-07/bugzilla-tweaks-enhanced
+// 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
+// http://ehsanakhgari.org/blog/2010-05-31/my-experience-jetpack-sdk#comment-1253
+//
+"use strict";
+var util = require("util");
+var logger = require("logger");
+var file = require("file");
+var myStorage = require("simple-storage").storage;
+
+var TriagedDistro = 13;
+var NumberOfFrames = 7;
+var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
+
+let config = {};
+config.matches = [
+ "https://bugzilla.redhat.com/show_bug.cgi",
+ "https://bugzilla.mozilla.org/show_bug.cgi"
+];
+
+
+// ==============================================================
+// 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");
+
+// /////////////////////////////////////////////////////////////////////////////
+function isOurPage(window) {
+ if ("window" in window) {
+ window = window.window;
+ }
+
+ if (window.location.protocol == "https:") {
+ // like ["name1": "url1", "name2":"url2"]
+ // FIXME the real name of bugzillaPageModLocation array
+ for (var loc in bugzillaPageModLocation) {
+ if (bugzillaPageModLocation[loc].test(window.location.href)) {
+ return true;
+ }
+ }
+ }
+ // we haven't found a conforming bugzilla
+ return false;
+}
+
+
+function initialize() {
+
+}
+
+util.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) {
+ util.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
+ config.PCI_ID_Array = response;
+ });
+ }
+
+ config.logger = new logger.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);