From 16aee2fb8612acd87441c83ad7513c4f4b79bd67 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 21 Jul 2010 13:53:52 +0200 Subject: Add a alert as a prompt to prompts library and use it. --- lib/bzpage.js | 6 +++--- lib/prompts.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/bzpage.js b/lib/bzpage.js index e5797fd..ff84aa9 100644 --- a/lib/bzpage.js +++ b/lib/bzpage.js @@ -466,10 +466,10 @@ BZPage.prototype.setConfigurationButton = function setConfigurationButton () { var prfNm = BTSPrefNS+"JSONURL"; var url = preferences.get(prfNm,""); - var reply = prompts.prompt("New location of JSON configuration file",url); + var reply = prompts.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!"); + preferences.set(prfNm, reply.trim()); + prompts.alert("For now, you should really restart Firefox!"); } evt.stopPropagation(); diff --git a/lib/prompts.js b/lib/prompts.js index 8f7942e..779ef8d 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -8,6 +8,17 @@ var {Cc,Ci} = require("chrome"); // just for JSLINT var Cc, Ci = {}; var promptTitle = "Bugzilla Triage Script"; +/** + * shows the text in a simple window + * + * @return none + */ +exports.alert = function alert(msg) { + var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Ci.nsIPromptService); + prompts.alert(null, promptTitle, msg); +}; + /** * general prompts for a string method * -- cgit