From 57de982a9300a6a71a5a5d1dac54c5c070cf48b7 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Sun, 12 Sep 2021 18:24:42 +0530 Subject: New recipe: 'devRant' (#706) --- recipes/devRant/icon.svg | 53 ++++++++++++++++++++++++++++++++++++++++++++ recipes/devRant/index.js | 2 ++ recipes/devRant/package.json | 11 +++++++++ recipes/devRant/service.css | 5 +++++ recipes/devRant/webview.js | 32 ++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 recipes/devRant/icon.svg create mode 100644 recipes/devRant/index.js create mode 100644 recipes/devRant/package.json create mode 100644 recipes/devRant/service.css create mode 100644 recipes/devRant/webview.js (limited to 'recipes') diff --git a/recipes/devRant/icon.svg b/recipes/devRant/icon.svg new file mode 100644 index 0000000..eae80e2 --- /dev/null +++ b/recipes/devRant/icon.svg @@ -0,0 +1,53 @@ + + + + diff --git a/recipes/devRant/index.js b/recipes/devRant/index.js new file mode 100644 index 0000000..7e19dff --- /dev/null +++ b/recipes/devRant/index.js @@ -0,0 +1,2 @@ +module.exports = Ferdi => { +}; diff --git a/recipes/devRant/package.json b/recipes/devRant/package.json new file mode 100644 index 0000000..4aa3517 --- /dev/null +++ b/recipes/devRant/package.json @@ -0,0 +1,11 @@ +{ + "id": "devRant", + "name": "devRant", + "version": "1.0.0", + "license": "MIT", + "repository": "https://github.com/emamut/recipe-devrant", + "config": { + "serviceURL": "https://devrant.com/", + "hasNotificationSound": true + } +} diff --git a/recipes/devRant/service.css b/recipes/devRant/service.css new file mode 100644 index 0000000..2d8c1a6 --- /dev/null +++ b/recipes/devRant/service.css @@ -0,0 +1,5 @@ +.app-wrapper-web .app { + width: 100% !important; + height: 100% !important; + top: 0 !important; +} diff --git a/recipes/devRant/webview.js b/recipes/devRant/webview.js new file mode 100644 index 0000000..e7e41a5 --- /dev/null +++ b/recipes/devRant/webview.js @@ -0,0 +1,32 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +setTimeout(() => { + const elem = document.querySelector('.landing-title.version-title'); + if (elem && elem.innerText.toLowerCase().includes('google chrome')) { + window.location.reload(); + } +}, 1000); + +window.addEventListener('beforeunload', async () => { + Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); + Ferdi.releaseServiceWorkers(); +}); + +module.exports = (Ferdi) => { + const getMessages = function getMessages() { + const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); + let count = 0; + for (let i = 0; i < elements.length; i += 1) { + if (elements[i].querySelectorAll('.P6z4j').length === 1 && elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { + count += 1; + } + } + + Ferdi.setBadge(count); + }; + + Ferdi.loop(getMessages); + Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-54-g00ecf