diff options
Diffstat (limited to 'recipes/withspectrum')
-rw-r--r-- | recipes/withspectrum/package.json | 2 | ||||
-rw-r--r-- | recipes/withspectrum/webview.js | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/recipes/withspectrum/package.json b/recipes/withspectrum/package.json index 4381afa..1315bee 100644 --- a/recipes/withspectrum/package.json +++ b/recipes/withspectrum/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "withspectrum", | 2 | "id": "withspectrum", |
3 | "name": "Spectrum", | 3 | "name": "Spectrum", |
4 | "version": "1.2.0", | 4 | "version": "1.3.0", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://spectrum.chat" | 7 | "serviceURL": "https://spectrum.chat" |
diff --git a/recipes/withspectrum/webview.js b/recipes/withspectrum/webview.js index d31d0a7..7c0def1 100644 --- a/recipes/withspectrum/webview.js +++ b/recipes/withspectrum/webview.js | |||
@@ -1,11 +1,22 @@ | |||
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 element = document.querySelector('[href="/notifications"] > div'); | 9 | const element = document.querySelector('[href="/notifications"] > div'); |
4 | const content = window.getComputedStyle(element, ':after').getPropertyValue('content').match(/\d+/); | 10 | const content = window |
11 | .getComputedStyle(element, ':after') | ||
12 | .getPropertyValue('content') | ||
13 | .match(/\d+/); | ||
5 | const notifications = Number(content); | 14 | const notifications = Number(content); |
6 | 15 | ||
7 | Ferdium.setBadge(notifications); | 16 | Ferdium.setBadge(notifications); |
8 | }; | 17 | }; |
9 | 18 | ||
10 | Ferdium.loop(getMessages); | 19 | Ferdium.loop(getMessages); |
20 | |||
21 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
11 | }; | 22 | }; |