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/redditchat/README.md | 5 +++ recipes/redditchat/icon.png | Bin 0 -> 45205 bytes recipes/redditchat/icon.svg | 94 ++++++++++++++++++++++++++++++++++++++++ recipes/redditchat/index.js | 2 + recipes/redditchat/package.json | 13 ++++++ recipes/redditchat/webview.js | 23 ++++++++++ 6 files changed, 137 insertions(+) create mode 100644 recipes/redditchat/README.md create mode 100644 recipes/redditchat/icon.png create mode 100644 recipes/redditchat/icon.svg create mode 100644 recipes/redditchat/index.js create mode 100644 recipes/redditchat/package.json create mode 100644 recipes/redditchat/webview.js (limited to 'recipes/redditchat') diff --git a/recipes/redditchat/README.md b/recipes/redditchat/README.md new file mode 100644 index 0000000..3afa883 --- /dev/null +++ b/recipes/redditchat/README.md @@ -0,0 +1,5 @@ +# Reddit Chat for Franz +This is the unofficial Franz recipe for Reddit Chat. Still In Development + +### How to create your own Franz recipes: +* [Read the documentation](https://github.com/meetfranz/plugins) diff --git a/recipes/redditchat/icon.png b/recipes/redditchat/icon.png new file mode 100644 index 0000000..d29dcc6 Binary files /dev/null and b/recipes/redditchat/icon.png differ diff --git a/recipes/redditchat/icon.svg b/recipes/redditchat/icon.svg new file mode 100644 index 0000000..e9ac1b8 --- /dev/null +++ b/recipes/redditchat/icon.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/recipes/redditchat/index.js b/recipes/redditchat/index.js new file mode 100644 index 0000000..2fee1a8 --- /dev/null +++ b/recipes/redditchat/index.js @@ -0,0 +1,2 @@ +// just pass through Franz +module.exports = Franz => Franz; \ No newline at end of file diff --git a/recipes/redditchat/package.json b/recipes/redditchat/package.json new file mode 100644 index 0000000..9830971 --- /dev/null +++ b/recipes/redditchat/package.json @@ -0,0 +1,13 @@ +{ + "id": "redditchat", + "name": "Reddit Chat", + "version": "1.0.0", + "description": "Reddit Chat", + "main": "index.js", + "author": "Alex Bloom { + // Regular expression for (*) or (1), will extract the asterisk or the number + const titleRegEx = /^\(([\*\d])\)/; + const getMessages = function unreadCount() { + var directCount = 0; + var indirectCount = 0; + + var matchArr = document.title.match(titleRegEx); + if (matchArr) { + if (matchArr[1] === '*') { + indirectCount = 1; + } else { + directCount = Number(matchArr[1]); + } + } + + Franz.setBadge(directCount, indirectCount); + } + + Franz.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2