diff options
author | Bennett <hello@vantezzen.io> | 2020-09-22 20:56:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 19:56:48 +0100 |
commit | 6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch) | |
tree | 9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /uncompressed/slack/webview.js | |
parent | Updated logos for Outlook/OWA (diff) | |
download | ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.gz ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.zst ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.zip |
Unpack recipes and update recipes icons (#292)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'uncompressed/slack/webview.js')
-rw-r--r-- | uncompressed/slack/webview.js | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/uncompressed/slack/webview.js b/uncompressed/slack/webview.js deleted file mode 100644 index f7bccfc..0000000 --- a/uncompressed/slack/webview.js +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | var _electron = require("electron"); | ||
4 | |||
5 | var _path = _interopRequireDefault(require("path")); | ||
6 | |||
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
8 | |||
9 | const getTeamIcon = function getTeamIcon(count = 0) { | ||
10 | let countTeamIconCheck = count; | ||
11 | let bgUrl = null; | ||
12 | const teamMenu = document.querySelector('#team-menu-trigger, .p-ia__sidebar_header__team_name'); | ||
13 | |||
14 | if (teamMenu) { | ||
15 | teamMenu.click(); | ||
16 | const icon = document.querySelector('.c-team_icon'); | ||
17 | |||
18 | if (icon) { | ||
19 | bgUrl = window.getComputedStyle(icon, null).getPropertyValue('background-image'); | ||
20 | bgUrl = /^url\((['"]?)(.*)\1\)$/.exec(bgUrl); | ||
21 | bgUrl = bgUrl ? bgUrl[2] : ''; | ||
22 | } | ||
23 | |||
24 | setTimeout(() => { | ||
25 | document.querySelector('.ReactModal__Overlay').click(); | ||
26 | }, 10); | ||
27 | } | ||
28 | |||
29 | countTeamIconCheck += 1; | ||
30 | |||
31 | if (bgUrl) { | ||
32 | _electron.ipcRenderer.sendToHost('avatar', bgUrl); | ||
33 | } else if (countTeamIconCheck <= 5) { | ||
34 | setTimeout(() => { | ||
35 | getTeamIcon(countTeamIconCheck + 1); | ||
36 | }, 2000); | ||
37 | } | ||
38 | }; | ||
39 | |||
40 | const SELECTOR_CHANNELS_UNREAD = '.p-channel_sidebar__channel--unread:not(.p-channel_sidebar__channel--muted)'; | ||
41 | |||
42 | module.exports = Franz => { | ||
43 | const getMessages = () => { | ||
44 | const directMessages = document.querySelectorAll(`${SELECTOR_CHANNELS_UNREAD} .p-channel_sidebar__badge, .p-channel_sidebar__link--unread:not([data-sidebar-link-id="Punreads"]):not([data-sidebar-link-id="Pdrafts"]):not([data-sidebar-link-id="Pdms"])`).length; | ||
45 | const allMessages = document.querySelectorAll(SELECTOR_CHANNELS_UNREAD).length - directMessages; | ||
46 | Franz.setBadge(directMessages, allMessages); | ||
47 | }; | ||
48 | |||
49 | Franz.loop(getMessages); | ||
50 | setTimeout(() => { | ||
51 | getTeamIcon(); | ||
52 | }, 4000); | ||
53 | Franz.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
54 | }; | ||