From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- recipes/ex-google-voice/icon.png | Bin 0 -> 28956 bytes recipes/ex-google-voice/icon.svg | 15 +++++++++++++++ recipes/ex-google-voice/index.js | 3 +++ recipes/ex-google-voice/package.json | 15 +++++++++++++++ recipes/ex-google-voice/webview.js | 26 ++++++++++++++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 recipes/ex-google-voice/icon.png create mode 100644 recipes/ex-google-voice/icon.svg create mode 100644 recipes/ex-google-voice/index.js create mode 100644 recipes/ex-google-voice/package.json create mode 100644 recipes/ex-google-voice/webview.js (limited to 'recipes/ex-google-voice') diff --git a/recipes/ex-google-voice/icon.png b/recipes/ex-google-voice/icon.png new file mode 100644 index 0000000..5af7c7d Binary files /dev/null and b/recipes/ex-google-voice/icon.png differ diff --git a/recipes/ex-google-voice/icon.svg b/recipes/ex-google-voice/icon.svg new file mode 100644 index 0000000..103d596 --- /dev/null +++ b/recipes/ex-google-voice/icon.svg @@ -0,0 +1,15 @@ + + + + + + + diff --git a/recipes/ex-google-voice/index.js b/recipes/ex-google-voice/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/recipes/ex-google-voice/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Franz => Franz; \ No newline at end of file diff --git a/recipes/ex-google-voice/package.json b/recipes/ex-google-voice/package.json new file mode 100644 index 0000000..8b98c80 --- /dev/null +++ b/recipes/ex-google-voice/package.json @@ -0,0 +1,15 @@ +{ + "id": "ex-google-voice", + "name": "Google Voice", + "version": "0.3.2", + "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/ex-google-voice/webview.js b/recipes/ex-google-voice/webview.js new file mode 100644 index 0000000..1a91455 --- /dev/null +++ b/recipes/ex-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