From 54f3affd80401051db8464d6bed8ad4ed1e66fd1 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Tue, 7 Jun 2022 17:01:37 +0100 Subject: Add webview.js to some services that were generated without it. (#42) This had blocked users from manually generating a `service.css` which is what the documentation recommends as self-help to override styling. Co-authored-by: Vijay A --- recipes/anonaddy/package.json | 2 +- recipes/anonaddy/webview.js | 9 +++++++++ recipes/bitbucket/package.json | 2 +- recipes/bitbucket/webview.js | 9 +++++++++ recipes/epicgames/package.json | 2 +- recipes/epicgames/webview.js | 9 +++++++++ recipes/gitlab/package.json | 2 +- recipes/gitlab/webview.js | 9 +++++++++ recipes/home-assistant/package.json | 2 +- recipes/home-assistant/webview.js | 20 ++++++++++---------- recipes/tutanota/package.json | 2 +- recipes/tutanota/webview.js | 9 +++++++++ scripts/create.js | 4 ++-- scripts/sample_recipe/webview.js | 10 +++++++++- 14 files changed, 72 insertions(+), 19 deletions(-) create mode 100644 recipes/anonaddy/webview.js create mode 100644 recipes/bitbucket/webview.js create mode 100644 recipes/epicgames/webview.js create mode 100644 recipes/gitlab/webview.js create mode 100644 recipes/tutanota/webview.js diff --git a/recipes/anonaddy/package.json b/recipes/anonaddy/package.json index 19c7b68..4ed88f2 100644 --- a/recipes/anonaddy/package.json +++ b/recipes/anonaddy/package.json @@ -1,7 +1,7 @@ { "id": "anonaddy", "name": "AnonAddy", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://app.anonaddy.com/" diff --git a/recipes/anonaddy/webview.js b/recipes/anonaddy/webview.js new file mode 100644 index 0000000..46366f4 --- /dev/null +++ b/recipes/anonaddy/webview.js @@ -0,0 +1,9 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; \ No newline at end of file diff --git a/recipes/bitbucket/package.json b/recipes/bitbucket/package.json index 4a09f6e..7ff7086 100644 --- a/recipes/bitbucket/package.json +++ b/recipes/bitbucket/package.json @@ -1,7 +1,7 @@ { "id": "bitbucket", "name": "BitBucket", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://bitbucket.org/dashboard/overview" diff --git a/recipes/bitbucket/webview.js b/recipes/bitbucket/webview.js new file mode 100644 index 0000000..46366f4 --- /dev/null +++ b/recipes/bitbucket/webview.js @@ -0,0 +1,9 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; \ No newline at end of file diff --git a/recipes/epicgames/package.json b/recipes/epicgames/package.json index 14a8d4c..5025b41 100644 --- a/recipes/epicgames/package.json +++ b/recipes/epicgames/package.json @@ -1,7 +1,7 @@ { "id": "epicgames", "name": "Epic Games Store", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://www.epicgames.com/id/login?lang=en_US&redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fstore%2Fen-US%2F&noHostRedirect=true" diff --git a/recipes/epicgames/webview.js b/recipes/epicgames/webview.js new file mode 100644 index 0000000..46366f4 --- /dev/null +++ b/recipes/epicgames/webview.js @@ -0,0 +1,9 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; \ No newline at end of file diff --git a/recipes/gitlab/package.json b/recipes/gitlab/package.json index 29cf544..008b1c7 100644 --- a/recipes/gitlab/package.json +++ b/recipes/gitlab/package.json @@ -1,7 +1,7 @@ { "id": "gitlab", "name": "GitLab", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "config": { "serviceURL": "https://gitlab.com/users/sign_in", diff --git a/recipes/gitlab/webview.js b/recipes/gitlab/webview.js new file mode 100644 index 0000000..46366f4 --- /dev/null +++ b/recipes/gitlab/webview.js @@ -0,0 +1,9 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; \ No newline at end of file diff --git a/recipes/home-assistant/package.json b/recipes/home-assistant/package.json index 60e06e0..0a8ad6a 100644 --- a/recipes/home-assistant/package.json +++ b/recipes/home-assistant/package.json @@ -1,7 +1,7 @@ { "id": "home-assistant", "name": "Home Assistant", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "config": { "hasCustomUrl": true, diff --git a/recipes/home-assistant/webview.js b/recipes/home-assistant/webview.js index a449cc4..7a0ab47 100644 --- a/recipes/home-assistant/webview.js +++ b/recipes/home-assistant/webview.js @@ -1,12 +1,12 @@ module.exports = Ferdium => { - const getMessages = () => { - const badges = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-sidebar").shadowRoot.querySelectorAll(".notification-badge"); - if (badges.length > 0) { - var count = Ferdium.safeParseInt(badges[0].textContent.replace(/[^\p{N}]/gu, '')); - Ferdium.setBadge(count) - } else { - Ferdium.setBadge(0) - } - }; - Ferdium.loop(getMessages); + const getMessages = () => { + const badges = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-sidebar").shadowRoot.querySelectorAll(".notification-badge"); + if (badges.length > 0) { + var count = Ferdium.safeParseInt(badges[0].textContent.replace(/[^\p{N}]/gu, '')); + Ferdium.setBadge(count) + } else { + Ferdium.setBadge(0) + } + }; + Ferdium.loop(getMessages); }; diff --git a/recipes/tutanota/package.json b/recipes/tutanota/package.json index 678613f..a502009 100644 --- a/recipes/tutanota/package.json +++ b/recipes/tutanota/package.json @@ -1,7 +1,7 @@ { "id": "tutanota", "name": "Tutanota", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://mail.tutanota.com/" diff --git a/recipes/tutanota/webview.js b/recipes/tutanota/webview.js new file mode 100644 index 0000000..46366f4 --- /dev/null +++ b/recipes/tutanota/webview.js @@ -0,0 +1,9 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; \ No newline at end of file diff --git a/scripts/create.js b/scripts/create.js index 38d1688..1d20668 100644 --- a/scripts/create.js +++ b/scripts/create.js @@ -10,9 +10,9 @@ if (process.argv.length < 3) { For example: pnpm create WhatsApp pnpm create "Google Hangouts" -You can set "Folder name" to "FerdiDev" to use Ferdium's development instance instead: +You can set "Folder name" to "FerdiumDev" to use Ferdium's development instance instead: -pnpm create WhatsApp FerdiDev +pnpm create WhatsApp FerdiumDev `); throw new Error('Please provide the correct number of args!'); } diff --git a/scripts/sample_recipe/webview.js b/scripts/sample_recipe/webview.js index dc4a062..86bb422 100644 --- a/scripts/sample_recipe/webview.js +++ b/scripts/sample_recipe/webview.js @@ -1,8 +1,16 @@ -module.exports = () => { +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { // TODO: If your SNAME service has unread messages, uncomment these lines to implement the logic for updating the badges // const getMessages = () => { // // TODO: Insert your notification-finding code here // Ferdium.setBadge(0, 0); // }; // Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-70-g09d2