aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-07-01 23:21:40 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-07-01 23:21:40 +0200
commit5d280d9fdec69f03b895c11c8954312dc328f1f7 (patch)
treebb12c41c89face209d4ba453f2639c6d733eadd1 /lib
parentf65017d9f5c1903c68455ab7750fc5d635c633a1 (diff)
downloadbugzilla-triage-5d280d9fdec69f03b895c11c8954312dc328f1f7.tar.gz
Add a configuration button for setting JSON file; fixes #15
Diffstat (limited to 'lib')
-rw-r--r--lib/bzpage.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index c88825d..f81b3da 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -29,6 +29,7 @@ var BZPage = function BZPage(win, config) {
this.ReporterColor = new Color(255, 255, 166); // RGB 255, 255, 166; HSL 60, 2,
// 83
// initialize dynamic properties
+ var that = this;
this.win = win;
this.doc = win.document;
this.packages = this.getInstalledPackages(config);
@@ -56,6 +57,28 @@ var BZPage = function BZPage(win, config) {
this.setUpLogging();
}
+ // configuration button
+ var additionalButtons = this.doc.querySelector("#bugzilla-body *.related_actions");
+ var configurationButtonUI = this.doc.createElement("li");
+ configurationButtonUI.innerHTML = "\u00A0-\u00A0<a href='#' id='configurationButton'>"
+ + "Configuration buttons</a>";
+ additionalButtons.appendChild(configurationButtonUI);
+ this.doc.getElementById("configurationButton").addEventListener(
+ "click",
+ function(evt) {
+ var prfNm = BSTPrefNS+"JSONURL";
+ var url = preferences.get(prfNm,"");
+
+ var reply = that.win.prompt("New location of JSON configuration file",url);
+ if (reply) {
+ preferences.set(prfNm,reply.trim());
+ that.win.alert("For now, you should really restart Firefox!");
+ }
+
+ evt.stopPropagation();
+ evt.preventDefault();
+ }, false);
+
this.submitHandlerInstalled = false;
this.bugNo = util.getBugNo(this.doc.location.toString());