From 65b68b9b5976a07669aec1fdb69bd17b0ae95e72 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sun, 20 Jun 2021 09:41:19 +0530 Subject: Renamed 'glowingbear' --> 'glowing-bear' and 'ex-google-voice' --> 'google-voide'. --- recipes/google-voice/icon.png | Bin 0 -> 5969 bytes recipes/google-voice/icon.svg | 1 + recipes/google-voice/index.js | 3 +++ recipes/google-voice/package.json | 15 +++++++++++++++ recipes/google-voice/webview.js | 26 ++++++++++++++++++++++++++ 5 files changed, 45 insertions(+) create mode 100644 recipes/google-voice/icon.png create mode 100644 recipes/google-voice/icon.svg create mode 100644 recipes/google-voice/index.js create mode 100644 recipes/google-voice/package.json create mode 100644 recipes/google-voice/webview.js (limited to 'recipes/google-voice') diff --git a/recipes/google-voice/icon.png b/recipes/google-voice/icon.png new file mode 100644 index 0000000..1148ac5 Binary files /dev/null and b/recipes/google-voice/icon.png differ diff --git a/recipes/google-voice/icon.svg b/recipes/google-voice/icon.svg new file mode 100644 index 0000000..faeb8dc --- /dev/null +++ b/recipes/google-voice/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/google-voice/index.js b/recipes/google-voice/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/recipes/google-voice/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Franz => Franz; \ No newline at end of file diff --git a/recipes/google-voice/package.json b/recipes/google-voice/package.json new file mode 100644 index 0000000..5bbf5c9 --- /dev/null +++ b/recipes/google-voice/package.json @@ -0,0 +1,15 @@ +{ + "id": "google-voice", + "name": "google-voice", + "version": "0.3.3", + "description": "Google Voice", + "main": "index.js", + "author": "Behind The Math ", + "license": "MIT", + "repository": "https://github.com/BehindTheMath/franz-recipe-google-voice", + "config": { + "serviceURL": "https://www.google.com/voice", + "hasTeamID": false, + "message": "Google Voice gives you one number for all your phones, voicemail as easy as email, free US long distance, low rates on international calls, and many calling features like transcripts, call blocking, call screening, conference calling, SMS, and more." + } +} diff --git a/recipes/google-voice/webview.js b/recipes/google-voice/webview.js new file mode 100644 index 0000000..1a91455 --- /dev/null +++ b/recipes/google-voice/webview.js @@ -0,0 +1,26 @@ +"use strict"; + +module.exports = Franz => { + function parseQuery(query) { + const el = document.querySelector(query); + return el && parseInt(el.innerHTML) || 0; + } + + function getMessages() { + const el = document.querySelector('.msgCount'); + let count; + + if (el) { + count = parseInt(el.innerHTML.replace(/[\(\) ]/gi, '')) || 0; + } else { + const count_messages = parseQuery('gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]'); + const count_calls = parseQuery('gv-nav-tab[tooltip="Calls"] div[aria-label="Unread count"]'); + const count_voicemails = parseQuery('gv-nav-tab[tooltip="Voicemail"] div[aria-label="Unread count"]'); + count = count_messages + count_calls + count_voicemails; + } + + Franz.setBadge(count); + } + + Franz.loop(getMessages); +}; \ No newline at end of file -- cgit v1.2.3-70-g09d2