diff options
Diffstat (limited to 'recipes/stackoverflow/webview.js')
-rw-r--r-- | recipes/stackoverflow/webview.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/recipes/stackoverflow/webview.js b/recipes/stackoverflow/webview.js new file mode 100644 index 0000000..4d20768 --- /dev/null +++ b/recipes/stackoverflow/webview.js | |||
@@ -0,0 +1,20 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = (Ferdi) => { | ||
6 | const getMessages = function getMessages() { | ||
7 | const elements = document.querySelectorAll('.CxUIE, .unread'); | ||
8 | let count = 0; | ||
9 | for (let i = 0; i < elements.length; i += 1) { | ||
10 | if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { | ||
11 | count += 1; | ||
12 | } | ||
13 | } | ||
14 | |||
15 | Ferdi.setBadge(count); | ||
16 | }; | ||
17 | |||
18 | Ferdi.loop(getMessages); | ||
19 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
20 | }; | ||