diff options
author | 2019-09-28 12:10:25 +0200 | |
---|---|---|
committer | 2019-09-28 12:10:25 +0200 | |
commit | 728d339739b63e9bb59e457e4a84fe9a65b93fc9 (patch) | |
tree | a0fc6180ea26fa9ef397458e8eb6491031d6437d /uncompressed/slack | |
parent | Add list of recipes (diff) | |
download | ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.gz ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.zst ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.zip |
Add uncompressed recipes
Diffstat (limited to 'uncompressed/slack')
-rw-r--r-- | uncompressed/slack/README.md | 5 | ||||
-rw-r--r-- | uncompressed/slack/icon.svg | 26 | ||||
-rw-r--r-- | uncompressed/slack/index.js | 3 | ||||
-rw-r--r-- | uncompressed/slack/package.json | 17 | ||||
-rw-r--r-- | uncompressed/slack/service.css | 3 | ||||
-rw-r--r-- | uncompressed/slack/webview.js | 55 |
6 files changed, 109 insertions, 0 deletions
diff --git a/uncompressed/slack/README.md b/uncompressed/slack/README.md new file mode 100644 index 0000000..ef51d64 --- /dev/null +++ b/uncompressed/slack/README.md | |||
@@ -0,0 +1,5 @@ | |||
1 | # Slack for Franz | ||
2 | This is the official Franz recipe for Slack | ||
3 | |||
4 | ### How to create your own Franz recipes: | ||
5 | * [Read the documentation](https://github.com/meetfranz/plugins) | ||
diff --git a/uncompressed/slack/icon.svg b/uncompressed/slack/icon.svg new file mode 100644 index 0000000..97b01f1 --- /dev/null +++ b/uncompressed/slack/icon.svg | |||
@@ -0,0 +1,26 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <svg width="80px" height="80px" viewBox="0 0 80 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
3 | <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch --> | ||
4 | <title>Service/Slack</title> | ||
5 | <desc>Created with Sketch.</desc> | ||
6 | <g id="Service/Slack" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> | ||
7 | <g id="Slack_Mark"> | ||
8 | <g id="Group" transform="translate(0.000000, 42.000000)" fill="#E01E5A"> | ||
9 | <path d="M17.0033898,8.50169492 C17.0033898,13.0745763 13.2677966,16.8101695 8.69491525,16.8101695 C4.1220339,16.8101695 0.386440678,13.0745763 0.386440678,8.50169492 C0.386440678,3.92881356 4.1220339,0.193220339 8.69491525,0.193220339 L17.0033898,0.193220339 L17.0033898,8.50169492 Z" id="Path"></path> | ||
10 | <path d="M21.1898305,8.50169492 C21.1898305,3.92881356 24.9254237,0.193220339 29.4983051,0.193220339 C34.0711864,0.193220339 37.8067797,3.92881356 37.8067797,8.50169492 L37.8067797,29.3050847 C37.8067797,33.8779661 34.0711864,37.6135593 29.4983051,37.6135593 C24.9254237,37.6135593 21.1898305,33.8779661 21.1898305,29.3050847 L21.1898305,8.50169492 Z" id="Path"></path> | ||
11 | </g> | ||
12 | <g id="Group" fill="#36C5F0"> | ||
13 | <path d="M29.4983051,17.0033898 C24.9254237,17.0033898 21.1898305,13.2677966 21.1898305,8.69491525 C21.1898305,4.1220339 24.9254237,0.386440678 29.4983051,0.386440678 C34.0711864,0.386440678 37.8067797,4.1220339 37.8067797,8.69491525 L37.8067797,17.0033898 L29.4983051,17.0033898 Z" id="Path"></path> | ||
14 | <path d="M29.4983051,21.1898305 C34.0711864,21.1898305 37.8067797,24.9254237 37.8067797,29.4983051 C37.8067797,34.0711864 34.0711864,37.8067797 29.4983051,37.8067797 L8.69491525,37.8067797 C4.1220339,37.8067797 0.386440678,34.0711864 0.386440678,29.4983051 C0.386440678,24.9254237 4.1220339,21.1898305 8.69491525,21.1898305 L29.4983051,21.1898305 Z" id="Path"></path> | ||
15 | </g> | ||
16 | <g id="Group" transform="translate(42.000000, 0.000000)" fill="#2EB67D"> | ||
17 | <path d="M20.9966102,29.4983051 C20.9966102,24.9254237 24.7322034,21.1898305 29.3050847,21.1898305 C33.8779661,21.1898305 37.6135593,24.9254237 37.6135593,29.4983051 C37.6135593,34.0711864 33.8779661,37.8067797 29.3050847,37.8067797 L20.9966102,37.8067797 L20.9966102,29.4983051 Z" id="Path"></path> | ||
18 | <path d="M16.8101695,29.4983051 C16.8101695,34.0711864 13.0745763,37.8067797 8.50169492,37.8067797 C3.92881356,37.8067797 0.193220339,34.0711864 0.193220339,29.4983051 L0.193220339,8.69491525 C0.193220339,4.1220339 3.92881356,0.386440678 8.50169492,0.386440678 C13.0745763,0.386440678 16.8101695,4.1220339 16.8101695,8.69491525 L16.8101695,29.4983051 Z" id="Path"></path> | ||
19 | </g> | ||
20 | <g id="Group" transform="translate(42.000000, 42.000000)" fill="#ECB22E"> | ||
21 | <path d="M8.50169492,20.9966102 C13.0745763,20.9966102 16.8101695,24.7322034 16.8101695,29.3050847 C16.8101695,33.8779661 13.0745763,37.6135593 8.50169492,37.6135593 C3.92881356,37.6135593 0.193220339,33.8779661 0.193220339,29.3050847 L0.193220339,20.9966102 L8.50169492,20.9966102 Z" id="Path"></path> | ||
22 | <path d="M8.50169492,16.8101695 C3.92881356,16.8101695 0.193220339,13.0745763 0.193220339,8.50169492 C0.193220339,3.92881356 3.92881356,0.193220339 8.50169492,0.193220339 L29.3050847,0.193220339 C33.8779661,0.193220339 37.6135593,3.92881356 37.6135593,8.50169492 C37.6135593,13.0745763 33.8779661,16.8101695 29.3050847,16.8101695 L8.50169492,16.8101695 Z" id="Path"></path> | ||
23 | </g> | ||
24 | </g> | ||
25 | </g> | ||
26 | </svg> \ No newline at end of file | ||
diff --git a/uncompressed/slack/index.js b/uncompressed/slack/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/uncompressed/slack/index.js | |||
@@ -0,0 +1,3 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => Franz; \ No newline at end of file | ||
diff --git a/uncompressed/slack/package.json b/uncompressed/slack/package.json new file mode 100644 index 0000000..8df473a --- /dev/null +++ b/uncompressed/slack/package.json | |||
@@ -0,0 +1,17 @@ | |||
1 | { | ||
2 | "id": "slack", | ||
3 | "name": "Slack", | ||
4 | "version": "1.0.9", | ||
5 | "description": "Slack", | ||
6 | "main": "index.js", | ||
7 | "author": "Stefan Malzner <stefan@adlk.io>", | ||
8 | "license": "MIT", | ||
9 | "config": { | ||
10 | "serviceURL": "https://{teamId}.slack.com", | ||
11 | "hasNotificationSound": true, | ||
12 | "hasDirectMessages": true, | ||
13 | "hasIndirectMessages": true, | ||
14 | "hasTeamId": true, | ||
15 | "urlInputSuffix": ".slack.com" | ||
16 | } | ||
17 | } | ||
diff --git a/uncompressed/slack/service.css b/uncompressed/slack/service.css new file mode 100644 index 0000000..1dd6209 --- /dev/null +++ b/uncompressed/slack/service.css | |||
@@ -0,0 +1,3 @@ | |||
1 | #banner { | ||
2 | display: none !important; | ||
3 | } \ No newline at end of file | ||
diff --git a/uncompressed/slack/webview.js b/uncompressed/slack/webview.js new file mode 100644 index 0000000..98c6136 --- /dev/null +++ b/uncompressed/slack/webview.js | |||
@@ -0,0 +1,55 @@ | |||
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'); | ||
13 | |||
14 | if (teamMenu) { | ||
15 | teamMenu.click(); | ||
16 | const icon = document.querySelector('.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('.team_menu').remove(); | ||
26 | document.querySelector('#msg_input .ql-editor').focus(); | ||
27 | }, 10); | ||
28 | } | ||
29 | |||
30 | countTeamIconCheck += 1; | ||
31 | |||
32 | if (bgUrl) { | ||
33 | _electron.ipcRenderer.sendToHost('avatar', bgUrl); | ||
34 | } else if (countTeamIconCheck <= 5) { | ||
35 | setTimeout(() => { | ||
36 | getTeamIcon(countTeamIconCheck + 1); | ||
37 | }, 2000); | ||
38 | } | ||
39 | }; | ||
40 | |||
41 | const SELECTOR_CHANNELS_UNREAD = '.p-channel_sidebar__channel--unread:not(.p-channel_sidebar__channel--muted)'; | ||
42 | |||
43 | module.exports = Franz => { | ||
44 | const getMessages = () => { | ||
45 | const directMessages = document.querySelectorAll(`${SELECTOR_CHANNELS_UNREAD} .p-channel_sidebar__badge`).length; | ||
46 | const allMessages = document.querySelectorAll(SELECTOR_CHANNELS_UNREAD).length - directMessages; | ||
47 | Franz.setBadge(directMessages, allMessages); | ||
48 | }; | ||
49 | |||
50 | Franz.loop(getMessages); | ||
51 | setTimeout(() => { | ||
52 | getTeamIcon(); | ||
53 | }, 4000); | ||
54 | Franz.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
55 | }; \ No newline at end of file | ||