aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/simplenote/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/simplenote/webview.js')
-rw-r--r--recipes/simplenote/webview.js25
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
3var _path = _interopRequireDefault(require("path"));
4
5function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
7module.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};