Skip to content

Commit

Permalink
Merge pull request #17 from osu-cascades/dev
Browse files Browse the repository at this point in the history
Dev - Release v1.2
  • Loading branch information
ctsstc authored Jan 20, 2019
2 parents f4c2ccf + fa64678 commit 68b86a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions functions/phone-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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.",

Expand Down

0 comments on commit 68b86a3

Please sign in to comment.