diff options
Diffstat (limited to 'recipes/moodle/webview.js')
-rw-r--r-- | recipes/moodle/webview.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/recipes/moodle/webview.js b/recipes/moodle/webview.js index 2ac7aa4..af948c6 100644 --- a/recipes/moodle/webview.js +++ b/recipes/moodle/webview.js | |||
@@ -1,12 +1,23 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
1 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
2 | const getMessages = () => { | 8 | const getMessages = () => { |
3 | const directCountSelector = [...document.querySelectorAll('[data-region="count-container"]')]; | 9 | const directCountSelector = [ |
10 | ...document.querySelectorAll('[data-region="count-container"]'), | ||
11 | ]; | ||
4 | const totalMessageCount = directCountSelector.reduce( | 12 | const totalMessageCount = directCountSelector.reduce( |
5 | ((count, item) => count + Ferdium.safeParseInt(item.textContent)), | 13 | (count, item) => count + Ferdium.safeParseInt(item.textContent), |
6 | 0 | 14 | 0, |
7 | ); | 15 | ); |
8 | 16 | ||
9 | Ferdium.setBadge(totalMessageCount, 0); | 17 | Ferdium.setBadge(totalMessageCount, 0); |
10 | }; | 18 | }; |
19 | |||
11 | Ferdium.loop(getMessages); | 20 | Ferdium.loop(getMessages); |
21 | |||
22 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
12 | }; | 23 | }; |