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/telegram-react/README.md | 7 +++++++ recipes/telegram-react/icon.png | Bin 0 -> 15968 bytes recipes/telegram-react/icon.svg | 27 +++++++++++++++++++++++++++ recipes/telegram-react/index.js | 4 ++++ recipes/telegram-react/package.json | 14 ++++++++++++++ recipes/telegram-react/webview.js | 19 +++++++++++++++++++ 6 files changed, 71 insertions(+) create mode 100644 recipes/telegram-react/README.md create mode 100644 recipes/telegram-react/icon.png create mode 100644 recipes/telegram-react/icon.svg create mode 100644 recipes/telegram-react/index.js create mode 100644 recipes/telegram-react/package.json create mode 100644 recipes/telegram-react/webview.js (limited to 'recipes/telegram-react') diff --git a/recipes/telegram-react/README.md b/recipes/telegram-react/README.md new file mode 100644 index 0000000..fbd7ca6 --- /dev/null +++ b/recipes/telegram-react/README.md @@ -0,0 +1,7 @@ +# Telegram for Ferdi + +This is the official Ferdi recipe for Telegram + +### How to create your own Franz recipes: + +- [Read the documentation](https://github.com/getferdi/recipes/tree/master/docs) diff --git a/recipes/telegram-react/icon.png b/recipes/telegram-react/icon.png new file mode 100644 index 0000000..3a3135e Binary files /dev/null and b/recipes/telegram-react/icon.png differ diff --git a/recipes/telegram-react/icon.svg b/recipes/telegram-react/icon.svg new file mode 100644 index 0000000..5cfd9c5 --- /dev/null +++ b/recipes/telegram-react/icon.svg @@ -0,0 +1,27 @@ + + + + telegram + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipes/telegram-react/index.js b/recipes/telegram-react/index.js new file mode 100644 index 0000000..6343150 --- /dev/null +++ b/recipes/telegram-react/index.js @@ -0,0 +1,4 @@ +"use strict"; + +module.exports = Franz => Franz; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlbGVncmFtL2luZGV4LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJGcmFueiJdLCJtYXBwaW5ncyI6Ijs7QUFBQUEsT0FBT0MsT0FBUCxHQUFpQkMsU0FBU0EsS0FBMUIiLCJmaWxlIjoidGVsZWdyYW0vaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IEZyYW56ID0+IEZyYW56O1xuIl19 \ No newline at end of file diff --git a/recipes/telegram-react/package.json b/recipes/telegram-react/package.json new file mode 100644 index 0000000..538b37a --- /dev/null +++ b/recipes/telegram-react/package.json @@ -0,0 +1,14 @@ +{ + "id": "telegram-react", + "name": "Telegram React", + "version": "1.0.1", + "description": "Telegram React", + "main": "index.js", + "author": "Amine Mouafik ", + "license": "MIT", + "config": { + "serviceURL": "https://evgeny-nadymov.github.io/telegram-react/", + "hasDirectMessages": true, + "hasNotificationSound": true + } +} diff --git a/recipes/telegram-react/webview.js b/recipes/telegram-react/webview.js new file mode 100644 index 0000000..223e914 --- /dev/null +++ b/recipes/telegram-react/webview.js @@ -0,0 +1,19 @@ +"use strict"; + +const path = require("path"); + +module.exports = Franz => { + const getMessages = function getMessages() { + let count = 0; + const elements = document.querySelectorAll(".dialog-badge:not(.dialog-badge-muted)"); + if (elements) { + for (let i = 0; i < elements.length; i += 1) { + if (elements[i].querySelector("span").innerHTML !== 0) { + count += parseInt(elements[i].querySelector("span").innerHTML); + } + } + } + Franz.setBadge(count); + }; + Franz.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2