diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/lib/bzpage.js | 88 | ||||
-rw-r--r-- | data/lib/rpcutils.js | 4 | ||||
-rw-r--r-- | data/lib/util.js | 6 |
3 files changed, 50 insertions, 48 deletions
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js index 4bba873..8d7606f 100644 --- a/data/lib/bzpage.js +++ b/data/lib/bzpage.js @@ -22,7 +22,7 @@ var equivalentComponents = null; * central handler processing messages from the main script. */ self.on('message', function onMessage(msg) { - console.myDebug("onMessage - incoming : msg.cmd = " + msg.cmd); + myDebug("onMessage - incoming : msg.cmd = " + msg.cmd); switch (msg.cmd) { case "ReloadThePage": document.location.reload(true); @@ -84,7 +84,7 @@ function executeCommand(cmdObj) { * Object with the appropriate parameters for the command */ function centralCommandDispatch (cmdLabel, cmdParams) { - console.myDebug("centralCommandDispatch : cmdLabel = " + cmdLabel); + myDebug("centralCommandDispatch : cmdLabel = " + cmdLabel); switch (cmdLabel) { case "name": case "position": @@ -362,53 +362,55 @@ function startup() { var logoutLink = Array.some(document.links, function (x) { return x.search === "?logout=1" ; }); - if (document.getElementById("brElementPlace_location")) { - console.error("Hit multiple firing protection!") - return null; // This should just finish whole content script without - // doing any harm to anybody. - } - else { - console.myDebug("Didn't hit multiple firing protection!"); - } + if (logoutLink) { + if (document.getElementById("brElementPlace_location")) { + console.error("Hit multiple firing protection!") + return null; // This should just finish whole content script without + // doing any harm to anybody. + } + else { + myDebug("Didn't hit multiple firing protection!"); + } - // Prepare for query buttons - // element ID brElementPlace_location is later used in JSON files - // Stay with this add_comment element even if RH BZ upgrades, this seems - // to be generally much more stable (even with other bugzillas, e.g. - // b.gnome.org) - // then some getElementById. - var commentArea = document.getElementsByClassName("bz_section_additional_comments")[0]; - if (commentArea) { - var brElementPlacer = commentArea.getElementsByTagName("br"); - brElementPlacer = brElementPlacer[0]; - if (brElementPlacer) { - brElementPlacer.setAttribute("id","brElementPlacer_location"); - brElementPlacer.parentNode.insertBefore(document.createElement("br"), - brElementPlacer); + // Prepare for query buttons + // element ID brElementPlace_location is later used in JSON files + // Stay with this add_comment element even if RH BZ upgrades, this seems + // to be generally much more stable (even with other bugzillas, e.g. + // b.gnome.org) + // then some getElementById. + var commentArea = document.getElementsByClassName("bz_section_additional_comments")[0]; + if (commentArea) { + var brElementPlacer = commentArea.getElementsByTagName("br"); + brElementPlacer = brElementPlacer[0]; + if (brElementPlacer) { + brElementPlacer.setAttribute("id","brElementPlacer_location"); + brElementPlacer.parentNode.insertBefore(document.createElement("br"), + brElementPlacer); + } } - } - // Prepare for adding external bugs - var a0Elements = document.getElementsByName("a0"); - if (a0Elements.length > 0) { - var extBugsHeadline = a0Elements[a0Elements.length - 1]; - extBugsHeadline.setAttribute("id", "external_bugs_headline"); - } + // Prepare for adding external bugs + var a0Elements = document.getElementsByName("a0"); + if (a0Elements.length > 0) { + var extBugsHeadline = a0Elements[a0Elements.length - 1]; + extBugsHeadline.setAttribute("id", "external_bugs_headline"); + } - // TODO Probably could be ignored ... used only once on line 973 of - // rhbzpage.js - // if (parseAbrtBacktraces && this.RE.Abrt.test(getSummary())) { - // title = document.getElementById("short_desc_nonedit_display").textContent; + // TODO Probably could be ignored ... used only once on line 973 of + // rhbzpage.js + // if (parseAbrtBacktraces && this.RE.Abrt.test(getSummary())) { + // title = document.getElementById("short_desc_nonedit_display").textContent; - // So, now we know we are logged in, so we can get to - // the real work. - setConfigurationButton(); - submitHandlerInstalled = false; + // So, now we know we are logged in, so we can get to + // the real work. + setConfigurationButton(); + submitHandlerInstalled = false; - self.postMessage(new Message("GetInstalledPackages", { - location: window.location.href, - login: getLogin() - })); + self.postMessage(new Message("GetInstalledPackages", { + location: window.location.href, + login: getLogin() + })); + } } startup(); diff --git a/data/lib/rpcutils.js b/data/lib/rpcutils.js index ee8804a..74b3ded 100644 --- a/data/lib/rpcutils.js +++ b/data/lib/rpcutils.js @@ -13,7 +13,7 @@ function makeJSONRPCCall(method, params, callback) { "params": params }; - console.myDebug("makeJSONRPCCall(" + method + + myDebug("makeJSONRPCCall(" + method + "): out = " + JSON.stringify(msg)); var req = new XMLHttpRequest(); @@ -21,7 +21,7 @@ function makeJSONRPCCall(method, params, callback) { req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(req.status == 200) { - console.myDebug("makeJSONRPCCall (" + method + + myDebug("makeJSONRPCCall (" + method + "): in = " + req.responseText); var JSONresponse = JSON.parse(req.responseText); if ("error" in JSONresponse) { diff --git a/data/lib/util.js b/data/lib/util.js index 35150d5..2782f0c 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -224,7 +224,7 @@ function getISODate(dateStr) { */ function ISODateString(d) { function pad(n) { - return n<10 ? '0'+n : n + return (n<10 ? '0'+n : n); } return d.getUTCFullYear()+'-' @@ -401,10 +401,10 @@ NotLoggedinException.prototype.toString = function () { return this.name + ': "' + this.message + '"'; }; -console.myDebug = function myDebug(str) { +function myDebug(str) { if (typeof config !== "undefined") { if (config.debuggingVerbose) { console.log(str); } } -}; +}
\ No newline at end of file |