From 2af2d0bfefd43ed1cf8c16a7d05c18a02027066f Mon Sep 17 00:00:00 2001 From: Francisco Marques Date: Thu, 8 Oct 2020 03:21:23 +0100 Subject: Add recipe for Disqus (#322) --- recipes/disqus/README.md | 7 ++++++ recipes/disqus/icon.png | Bin 0 -> 15270 bytes recipes/disqus/icon.svg | 57 ++++++++++++++++++++++++++++++++++++++++++++ recipes/disqus/index.js | 3 +++ recipes/disqus/package.json | 12 ++++++++++ recipes/disqus/webview.js | 24 +++++++++++++++++++ 6 files changed, 103 insertions(+) create mode 100644 recipes/disqus/README.md create mode 100644 recipes/disqus/icon.png create mode 100644 recipes/disqus/icon.svg create mode 100644 recipes/disqus/index.js create mode 100644 recipes/disqus/package.json create mode 100644 recipes/disqus/webview.js (limited to 'recipes') diff --git a/recipes/disqus/README.md b/recipes/disqus/README.md new file mode 100644 index 0000000..7b00ad9 --- /dev/null +++ b/recipes/disqus/README.md @@ -0,0 +1,7 @@ +# Disqus for Ferdi + +This is a Ferdi recipe for [Disqus](https://disqus.com/) + +## Release notes + +1.0.0: First version \ No newline at end of file diff --git a/recipes/disqus/icon.png b/recipes/disqus/icon.png new file mode 100644 index 0000000..649823f Binary files /dev/null and b/recipes/disqus/icon.png differ diff --git a/recipes/disqus/icon.svg b/recipes/disqus/icon.svg new file mode 100644 index 0000000..5b96298 --- /dev/null +++ b/recipes/disqus/icon.svg @@ -0,0 +1,57 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/recipes/disqus/index.js b/recipes/disqus/index.js new file mode 100644 index 0000000..cd5b37c --- /dev/null +++ b/recipes/disqus/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Ferdi => Ferdi; diff --git a/recipes/disqus/package.json b/recipes/disqus/package.json new file mode 100644 index 0000000..fb723e6 --- /dev/null +++ b/recipes/disqus/package.json @@ -0,0 +1,12 @@ +{ + "id": "disqus", + "name": "Disqus", + "version": "1.0.0", + "description": "disqus", + "main": "index.js", + "author": "Ferdi ", + "license": "MIT", + "config": { + "serviceURL": "https://disqus.com/home/" + } +} \ No newline at end of file diff --git a/recipes/disqus/webview.js b/recipes/disqus/webview.js new file mode 100644 index 0000000..797db5f --- /dev/null +++ b/recipes/disqus/webview.js @@ -0,0 +1,24 @@ +"use strict"; + +var _path = _interopRequireDefault(require("path")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +let getInnerInt = selector => { + const element = document.querySelector(selector); + return element && parseInt(element.innerText); +} + +module.exports = Ferdi => { + const getMessages = function getMessages() { + let direct = ( + getInnerInt("header div[data-role='unread-notification-count']") || + getInnerInt("a.has-notifs div.notif-count") || + 0 + ); + + Ferdi.setBadge(direct); + }; + + Ferdi.loop(getMessages); +}; -- cgit v1.2.3-54-g00ecf