diff options
author | Yoga Setiawan <ariokidev@gmail.com> | 2020-10-07 21:22:48 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-07 15:22:48 +0100 |
commit | 986926a804f1ea00c070a9143b66dedb6913bf07 (patch) | |
tree | 43503ff3f244d0e32597329871f62b6d7581bace /recipes/simplenote/webview.js | |
parent | Add recipe for YouTrack (#318) (diff) | |
download | ferdium-recipes-986926a804f1ea00c070a9143b66dedb6913bf07.tar.gz ferdium-recipes-986926a804f1ea00c070a9143b66dedb6913bf07.tar.zst ferdium-recipes-986926a804f1ea00c070a9143b66dedb6913bf07.zip |
Add recipe for Simplenote (#317)
Diffstat (limited to 'recipes/simplenote/webview.js')
-rw-r--r-- | recipes/simplenote/webview.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/recipes/simplenote/webview.js b/recipes/simplenote/webview.js new file mode 100644 index 0000000..87b1192 --- /dev/null +++ b/recipes/simplenote/webview.js | |||
@@ -0,0 +1,25 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | var _path = _interopRequireDefault(require("path")); | ||
4 | |||
5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
6 | |||
7 | module.exports = Ferdi => { | ||
8 | const getMessages = function getMessages() { | ||
9 | let count = 0; | ||
10 | |||
11 | if (window.location.pathname.includes('messaging')) { | ||
12 | count = document.querySelectorAll('.msg-conversation-card__unread-count').length; | ||
13 | } else { | ||
14 | const element = document.querySelector('.nav-item--messaging .nav-item__badge-count'); | ||
15 | |||
16 | if (element) { | ||
17 | count = parseInt(element.innerHTML, 10); | ||
18 | } | ||
19 | } | ||
20 | |||
21 | Ferdi.setBadge(count); | ||
22 | }; | ||
23 | |||
24 | Ferdi.loop(getMessages); | ||
25 | }; | ||