From 9255fb5813b3bc07a0881e0ff90f8abf9daae453 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Thu, 8 Oct 2015 17:17:02 +0200 Subject: [PATCH] Added prompts for domain and URL whitelist adding in notification as mentioned in issue #40. --- lib/notifications.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/notifications.js b/lib/notifications.js index 8537b16..2a4b770 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -62,14 +62,27 @@ exports.notify = function(window, callingStackMsg){ label: _("whitelistURL"), accessKey: "", callback: function(){ - lists.appendTo("white", "^" + notification.url.replace(/([\\\+\*\?\[\^\]\$\(\)\{\}\=\!\|\.])/g, "\\$1") + "$"); + var url = browser.contentWindow.prompt( + "Input URL RegExp to add to white list:", + "^" + notification.url.replace(/([\\\+\*\?\[\^\]\$\(\)\{\}\=\!\|\.])/g, "\\$1") + "$" + ); + if (url){ + lists.appendTo("white", url); + } } }, { label: _("whitelistDomain"), accessKey: "", callback: function(){ - lists.appendTo("white", notification.domain); + var domain = browser.contentWindow.prompt( + "Input domain to add to white list:", + notification.domain + ); + if (domain){ + lists.appendTo("white", domain); + } + } }, {