diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-05-19 15:47:15 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-05-19 15:47:15 +0200 |
commit | f5e3ed70f03e4bf2b6a890fa8fdb62739945d7c9 (patch) | |
tree | d6164f56a79f1a0aa13a17cd68b80de918675453 /bugzillaBugTriage.js | |
parent | 34a1a44af2e30b81195d703451e2d0b76a910b1a (diff) | |
download | bugzilla-triage-f5e3ed70f03e4bf2b6a890fa8fdb62739945d7c9.tar.gz |
Added some javadocs.
Added protection against double-firings.
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r-- | bugzillaBugTriage.js | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 2efcd7d..be74536 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -32,7 +32,7 @@ var manifest = { { name : "enabledPacks", type : "text", - label : "comment packs should be enabled", + label : "comment packs which should be enabled", "default" : "" } ] @@ -323,7 +323,11 @@ hlpr.removeCSVValue = function removeCSVValue(str, value) { /** * Load text from URL * - * @param + * @param URL String + * @param cb_function Function to be called when the download happens with + * the downloaded body of the HTTP message as the only parameter + * @param what optional Object argument representing this for this call + * @return none */ hlpr.loadText = function(URL, cb_function, what) { if (what === undefined) { // missing optional argument @@ -344,7 +348,15 @@ hlpr.loadText = function(URL, cb_function, what) { req.send(""); }; -// Initialization +/** + * Load JSON from URL + * + * @param URL String + * @param cb_function Function to be called when the download happens with + * the downloaded JSON as the only parameter + * @param what optional Object argument representing this for this call + * @return none + */ hlpr.loadJSON = function(URL, cb_function, what) { if (what === undefined) { // missing optional argument what = this; @@ -362,7 +374,6 @@ hlpr.loadJSON = function(URL, cb_function, what) { // originally from // http://www.mjijackson.com/2008/02\ // /rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - function Color(r, g, b) { this.Luminosity = 0.85; this.Desaturated = 0.4; @@ -866,6 +877,12 @@ BZPage.prototype.createNewButton = function(location, after, pkg, id) { let newId = id + "_btn"; let label = cmdObj["name"]; + // protection against double-firings + if (this.doc.getElementById(newId)) { + console.error("Element with id " + newId + "already exists!"); + return ; + } + // creation of button might be conditional on existence of data in constantData if ("ifExist" in cmdObj) { if (!(cmdObj["ifExist"] in this.constantData)) { @@ -1382,6 +1399,7 @@ RHBugzillaPage = function(doc) { let that = this; this.reqCounter = 0; + this.signaturesCounter = 0; this.chipMagicInterestingLine = ""; this.login = this.getLogin(); @@ -1421,7 +1439,10 @@ RHBugzillaPage = function(doc) { let signatureFedoraString = config.gJSONData.configData.signature; this.doc.forms.namedItem("changeform").addEventListener("submit", function() { - that.addStuffToTextBox("comment", signatureFedoraString); + if (this.signaturesCounter < 1) { + that.addStuffToTextBox("comment", signatureFedoraString); + this.signaturesCounter += 1; + } }, false); } |