From 95c5fc18d6e9bef47268e6a932d88de9e8cca0d5 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Tue, 5 Jul 2022 00:00:33 +0100 Subject: Add Tiktok recipe (#105) Co-authored-by: Vijay A --- recipes/tiktok/icon.svg | 1 + recipes/tiktok/index.js | 1 + recipes/tiktok/package.json | 9 +++++++++ recipes/tiktok/webview.js | 22 ++++++++++++++++++++++ recipes/whatsapp/package.json | 2 +- recipes/whatsapp/webview-unsafe.js | 2 +- 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 recipes/tiktok/icon.svg create mode 100644 recipes/tiktok/index.js create mode 100644 recipes/tiktok/package.json create mode 100644 recipes/tiktok/webview.js diff --git a/recipes/tiktok/icon.svg b/recipes/tiktok/icon.svg new file mode 100644 index 0000000..c043135 --- /dev/null +++ b/recipes/tiktok/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/tiktok/index.js b/recipes/tiktok/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/tiktok/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/tiktok/package.json b/recipes/tiktok/package.json new file mode 100644 index 0000000..5d8e794 --- /dev/null +++ b/recipes/tiktok/package.json @@ -0,0 +1,9 @@ +{ + "id": "tiktok", + "name": "Tiktok", + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://tiktok.com" + } +} 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 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + const getMessages = () => { + const selNotifications = document.querySelector("div.tiktok-1b4xcc5-DivHeaderInboxContainer.e18kkhh40 > sup"); + const selDM = document.querySelector("div.tiktok-1ibfxbr-DivMessageIconContainer.e1nx07zo0 > sup"); + + const countNotifications = (selNotifications != null) ? Ferdium.safeParseInt(selNotifications.outerText) : 0; + const countDM = (selDM != null) ? Ferdium.safeParseInt(selDM.outerText) : 0; + + const count = countNotifications + countDM; + + Ferdium.setBadge(count); + }; + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; diff --git a/recipes/whatsapp/package.json b/recipes/whatsapp/package.json index 3693582..8ddccfe 100644 --- a/recipes/whatsapp/package.json +++ b/recipes/whatsapp/package.json @@ -1,7 +1,7 @@ { "id": "whatsapp", "name": "WhatsApp", - "version": "3.4.2", + "version": "3.4.3", "license": "MIT", "config": { "serviceURL": "https://web.whatsapp.com", diff --git a/recipes/whatsapp/webview-unsafe.js b/recipes/whatsapp/webview-unsafe.js index 726014f..b6b365b 100644 --- a/recipes/whatsapp/webview-unsafe.js +++ b/recipes/whatsapp/webview-unsafe.js @@ -1,6 +1,6 @@ const PUSHSTATE_NORMAL = 0; const PUSHSTATE_THROTTLE = 1; -const PUSHSTATE_DISABLE = 2; +// const PUSHSTATE_DISABLE = 2; const PUSHSTATE_THROTTLE_THRESHOLD = 1; -- cgit v1.2.3-70-g09d2