diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2023-09-25 16:56:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 16:56:14 -0600 |
commit | 9bfc14a932bd266bc61d72b03fc844561254df6a (patch) | |
tree | b1007076c149fbfb45b7fae3c8d50ae1fa6885c9 /recipes/slack/webview.js | |
parent | Add new steamchat recipe icon. (#429) (diff) | |
download | ferdium-recipes-9bfc14a932bd266bc61d72b03fc844561254df6a.tar.gz ferdium-recipes-9bfc14a932bd266bc61d72b03fc844561254df6a.tar.zst ferdium-recipes-9bfc14a932bd266bc61d72b03fc844561254df6a.zip |
feat: support for the new slack ui (#425)
- update selector for team menu to work with new and old slack ui
- bump slack recipe to v1.6.0
Diffstat (limited to 'recipes/slack/webview.js')
-rw-r--r-- | recipes/slack/webview.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/recipes/slack/webview.js b/recipes/slack/webview.js index bd28ba9..f6b5af3 100644 --- a/recipes/slack/webview.js +++ b/recipes/slack/webview.js | |||
@@ -38,12 +38,23 @@ module.exports = Ferdium => { | |||
38 | const getTeamIcon = function getTeamIcon(count = 0) { | 38 | const getTeamIcon = function getTeamIcon(count = 0) { |
39 | let countTeamIconCheck = count; | 39 | let countTeamIconCheck = count; |
40 | let bgUrl = null; | 40 | let bgUrl = null; |
41 | const teamMenu = document.querySelector( | 41 | // INFO: A new Slack UI was introduced in August 2023 and will be rolled out gradually, |
42 | // therefore we need to support both old and new UI for the time being | ||
43 | // See more: https://slack.com/blog/productivity/a-redesigned-slack-built-for-focus | ||
44 | const oldSlackUiTeamMenu = document.querySelector( | ||
42 | '#team-menu-trigger, .p-ia__sidebar_header__team_name', | 45 | '#team-menu-trigger, .p-ia__sidebar_header__team_name', |
43 | ); | 46 | ); |
47 | const newSlackUiTeamMenu = document.querySelector( | ||
48 | '.p-ia4_home_header_menu__button', | ||
49 | ); | ||
50 | |||
51 | if (oldSlackUiTeamMenu || newSlackUiTeamMenu) { | ||
52 | if (oldSlackUiTeamMenu) { | ||
53 | oldSlackUiTeamMenu.click(); | ||
54 | } else if (newSlackUiTeamMenu) { | ||
55 | newSlackUiTeamMenu.click(); | ||
56 | } | ||
44 | 57 | ||
45 | if (teamMenu) { | ||
46 | teamMenu.click(); | ||
47 | const icon = document.querySelector('.c-team_icon'); | 58 | const icon = document.querySelector('.c-team_icon'); |
48 | 59 | ||
49 | if (icon) { | 60 | if (icon) { |