From 5d280d9fdec69f03b895c11c8954312dc328f1f7 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 1 Jul 2010 23:21:40 +0200 Subject: Add a configuration button for setting JSON file; fixes #15 --- lib/bzpage.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib') 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" + + "Configuration buttons"; + 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()); -- cgit