diff options
author | Matěj Cepl <mcepl@redhat.com> | 2009-12-23 16:21:20 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2009-12-23 16:21:20 +0100 |
commit | 02420e54dca24d0a3941ecb764bf83c87c775bf6 (patch) | |
tree | 601c2642b82ba290a47f8c6103c696c78359f435 | |
parent | 3ca3527d677889742f05cf504b63e54996bee904 (diff) | |
download | bugzilla-triage-02420e54dca24d0a3941ecb764bf83c87c775bf6.tar.gz |
A little less thats and custom JSON URL user interface
-rw-r--r-- | bugzillaBugTriage.js | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 5d5e761..9c1c127 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -505,16 +505,15 @@ BzPage.prototype.addTextToTextBox = function(id,string2BAdded) { * */ BzPage.prototype.checkComments = function () { - var that = this; var comments = this.dok.getElementById("comments"). getElementsByClassName("bz_comment"); Array.forEach(comments,function (item) { var email = item.getElementsByClassName("vcard")[0]. getElementsByTagName("a")[0].textContent; - if (new RegExp(that.reporter).test(email)) { + if (new RegExp(this.reporter).test(email)) { item.style.backgroundColor = ReporterColor.toString(); } - }); + },this); }; /** @@ -1390,6 +1389,7 @@ function BzPage(doc) { if (result) { this.password = password.value; myConfig.BZpassword = this.password; + jetpack.storage.simple.sync(); } } @@ -1433,8 +1433,8 @@ function BzPage(doc) { titleElement.style.backgroundColor = "olive"; titleElement.appendChild(this.createFixAllButton(badAttachments)); badAttachments.forEach(function (x,i,a) { - that.addTextLink(x); - }); + this.addTextLink(x); + },this); } // Dig out backtrace @@ -1469,16 +1469,17 @@ function BzPage(doc) { btAttachments.forEach(function (x) { attURL = "https://bugzilla.redhat.com/attachment.cgi?id=" + x[1]; console.log("attURL = " + attURL); - if (!that.btSnippet) { + console.log("btSnippet = " + this.btSnippet); + if (!this.btSnippet) { var btRaw = $.get(attURL,function (ret) { - that.btSnippet = that.parseBacktrace(ret); - if (that.btSnippet) { - that.addTextToTextBox("comment",that.btSnippet); - that.addTextToTextBox("cf_devel_whiteboard","btparsed"); + this.btSnippet = this.parseBacktrace(ret); + if (this.btSnippet) { + this.addTextToTextBox("comment",this.btSnippet); + this.addTextToTextBox("cf_devel_whiteboard","btparsed"); } }); } - }); + },this); } } @@ -1495,6 +1496,25 @@ function BzPage(doc) { this.checkComments(); this.buildButtons(topRow,bottomRow); + // UI for the customization JSON URL + var additionalButtons = this.dok.getElementById("bugzilla-body"). + getElementsByClassName("related_actions")[0]; + var customJSONURLUI = this.dok.createElement("li"); + customJSONURLUI.innerHTML = " - <a href='#' id='customJSONbutton'>" + + "change JSON URL</a>"; + additionalButtons.appendChild(customJSONURLUI); + this.dok.getElementById("customJSONbutton"). + addEventListener("click",function () { + var newURL = jetpack.tabs.focused.contentWindow. + prompt("URL for your JSON customization file"); + if (newURL) { + myConfig.JSONURL = newURL; + jetpack.storage.simple.sync(); + jetpack.tabs.focused.contentWindow.location.reload(); + } + },true); + + // set default assignee on change of the component this.dok.getElementById("component").addEventListener("change", function (){ that.component = that.getOptionValue("component"); |