From 476d2438144447e726066172137021923a7d25a6 Mon Sep 17 00:00:00 2001 From: Cody Swartz Date: Sat, 19 Jan 2019 16:09:11 -0800 Subject: [PATCH 1/2] Fixes #15 --- functions/phone-parser.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/phone-parser.js b/functions/phone-parser.js index 09c20db..3c97d7b 100644 --- a/functions/phone-parser.js +++ b/functions/phone-parser.js @@ -24,19 +24,22 @@ function extractPhoneNumberDigits(text) { * @return boolean */ function isValidSelection(selection) { - var tenDigitNumber; + var tenDigitNumber; + const selectionText = selection.selectionText; + const alertCode = `alert('The selection needs to be a valid phone number\\nYou selected:\\n\\n' + '${selectionText}');`; + try { tenDigitNumber = extractPhoneNumberDigits(selection.selectionText); } catch(err) { - alert('The selection needs to be a number\nYou selected:\n\n' + selection.selectionText); + browser.tabs.executeScript({code : alertCode}); return false; } var numberTest = /^\d{10}$/; if( !numberTest.test(tenDigitNumber) ){ - alert('The selection needs to be a valid phone number\nYou selected:\n\n' + selection.selectionText); + browser.tabs.executeScript({code : alertCode}); return false; } return true; From fa64678b223249146e1241d9445fae4cca836132 Mon Sep 17 00:00:00 2001 From: Cody Swartz Date: Sat, 19 Jan 2019 16:11:22 -0800 Subject: [PATCH 2/2] Release v1.2 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 16964b4..5668f81 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Guardian Group Phone Dork FF", - "version": "1.1", + "version": "1.2", "description": "A Firefox extension for invoking search queries with a phone number.",