aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/tiktok/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/tiktok/webview.js')
-rw-r--r--recipes/tiktok/webview.js22
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 @@
1const _path = _interopRequireDefault(require('path'));
2
3function _interopRequireDefault(obj) {
4 return obj && obj.__esModule ? obj : { default: obj };
5}
6
7module.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};