diff options
Diffstat (limited to 'recipes/discord/webview.js')
-rw-r--r-- | recipes/discord/webview.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 8123ced..88a5c50 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js | |||
@@ -1,9 +1,10 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | // TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5 | 1 | // TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5 |
4 | 2 | ||
5 | const { desktopCapturer, remote: { BrowserWindow } } = require("electron"); | 3 | const { desktopCapturer, remote: { BrowserWindow } } = require('electron'); |
6 | const path = require('path'); | 4 | |
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
7 | 8 | ||
8 | window.navigator.mediaDevices.getDisplayMedia = () => { | 9 | window.navigator.mediaDevices.getDisplayMedia = () => { |
9 | return new Promise(async (resolve, reject) => { | 10 | return new Promise(async (resolve, reject) => { |
@@ -61,7 +62,7 @@ window.navigator.mediaDevices.getDisplayMedia = () => { | |||
61 | }) | 62 | }) |
62 | } | 63 | } |
63 | 64 | ||
64 | module.exports = (Franz, settings) => { | 65 | module.exports = (Ferdi, settings) => { |
65 | const getMessages = function getMessages() { | 66 | const getMessages = function getMessages() { |
66 | let count = 0; | 67 | let count = 0; |
67 | const container = document.querySelector('[role="tablist"] > [title="Chats"] > div'); | 68 | const container = document.querySelector('[role="tablist"] > [title="Chats"] > div'); |
@@ -79,11 +80,13 @@ module.exports = (Franz, settings) => { | |||
79 | } | 80 | } |
80 | } | 81 | } |
81 | 82 | ||
82 | Franz.setBadge(count); | 83 | Ferdi.setBadge(count); |
83 | }; | 84 | }; |
84 | 85 | ||
85 | Franz.injectCSS(path.join(__dirname, 'service.css')); | 86 | Ferdi.loop(getMessages); |
86 | Franz.loop(getMessages); | 87 | |
88 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
89 | |||
87 | document.addEventListener('click', event => { | 90 | document.addEventListener('click', event => { |
88 | const link = event.target.closest('a[href^="http"]'); | 91 | const link = event.target.closest('a[href^="http"]'); |
89 | const button = event.target.closest('button[title^="http"]'); | 92 | const button = event.target.closest('button[title^="http"]'); |