diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2022-07-05 00:00:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-04 23:00:33 +0000 |
commit | 95c5fc18d6e9bef47268e6a932d88de9e8cca0d5 (patch) | |
tree | 6254558570f315072e9af33afc54e1d4f55c3adf /recipes/tiktok/webview.js | |
parent | Fix outlook issue by changing the service URL (#104) (diff) | |
download | ferdium-recipes-95c5fc18d6e9bef47268e6a932d88de9e8cca0d5.tar.gz ferdium-recipes-95c5fc18d6e9bef47268e6a932d88de9e8cca0d5.tar.zst ferdium-recipes-95c5fc18d6e9bef47268e6a932d88de9e8cca0d5.zip |
Add Tiktok recipe (#105)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'recipes/tiktok/webview.js')
-rw-r--r-- | recipes/tiktok/webview.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/recipes/tiktok/webview.js b/recipes/tiktok/webview.js new file mode 100644 index 0000000..6f78019 --- /dev/null +++ b/recipes/tiktok/webview.js | |||
@@ -0,0 +1,22 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | ||
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
6 | |||
7 | module.exports = Ferdium => { | ||
8 | const getMessages = () => { | ||
9 | const selNotifications = document.querySelector("div.tiktok-1b4xcc5-DivHeaderInboxContainer.e18kkhh40 > sup"); | ||
10 | const selDM = document.querySelector("div.tiktok-1ibfxbr-DivMessageIconContainer.e1nx07zo0 > sup"); | ||
11 | |||
12 | const countNotifications = (selNotifications != null) ? Ferdium.safeParseInt(selNotifications.outerText) : 0; | ||
13 | const countDM = (selDM != null) ? Ferdium.safeParseInt(selDM.outerText) : 0; | ||
14 | |||
15 | const count = countNotifications + countDM; | ||
16 | |||
17 | Ferdium.setBadge(count); | ||
18 | }; | ||
19 | Ferdium.loop(getMessages); | ||
20 | |||
21 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
22 | }; | ||