From 728d339739b63e9bb59e457e4a84fe9a65b93fc9 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Sat, 28 Sep 2019 12:10:25 +0200 Subject: Add uncompressed recipes --- uncompressed/ex-google-voice/icon.svg | 15 +++++++++++++++ uncompressed/ex-google-voice/index.js | 3 +++ uncompressed/ex-google-voice/package.json | 15 +++++++++++++++ uncompressed/ex-google-voice/webview.js | 26 ++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 uncompressed/ex-google-voice/icon.svg create mode 100644 uncompressed/ex-google-voice/index.js create mode 100644 uncompressed/ex-google-voice/package.json create mode 100644 uncompressed/ex-google-voice/webview.js (limited to 'uncompressed/ex-google-voice') diff --git a/uncompressed/ex-google-voice/icon.svg b/uncompressed/ex-google-voice/icon.svg new file mode 100644 index 0000000..df2a521 --- /dev/null +++ b/uncompressed/ex-google-voice/icon.svg @@ -0,0 +1,15 @@ + + + + + + + diff --git a/uncompressed/ex-google-voice/index.js b/uncompressed/ex-google-voice/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/uncompressed/ex-google-voice/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Franz => Franz; \ No newline at end of file diff --git a/uncompressed/ex-google-voice/package.json b/uncompressed/ex-google-voice/package.json new file mode 100644 index 0000000..8b98c80 --- /dev/null +++ b/uncompressed/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/uncompressed/ex-google-voice/webview.js b/uncompressed/ex-google-voice/webview.js new file mode 100644 index 0000000..1a91455 --- /dev/null +++ b/uncompressed/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