From 48c07ad8f8bc69f71ccbfe36642210e9b840c1c1 Mon Sep 17 00:00:00 2001 From: mindcombatant <9550058+mindcombatant@users.noreply.github.com> Date: Mon, 15 May 2023 00:00:50 +0000 Subject: Add Nextcloud Deck Recipe (#360) --- recipes/nextcloud-deck/README.md | 23 +++++++++++++++++++++ recipes/nextcloud-deck/icon.svg | 9 ++++++++ recipes/nextcloud-deck/index.js | 1 + recipes/nextcloud-deck/package.json | 14 +++++++++++++ recipes/nextcloud-deck/service.css | 41 +++++++++++++++++++++++++++++++++++++ recipes/nextcloud-deck/webview.js | 20 ++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 recipes/nextcloud-deck/README.md create mode 100644 recipes/nextcloud-deck/icon.svg create mode 100644 recipes/nextcloud-deck/index.js create mode 100644 recipes/nextcloud-deck/package.json create mode 100644 recipes/nextcloud-deck/service.css create mode 100644 recipes/nextcloud-deck/webview.js (limited to 'recipes/nextcloud-deck') diff --git a/recipes/nextcloud-deck/README.md b/recipes/nextcloud-deck/README.md new file mode 100644 index 0000000..e438ccb --- /dev/null +++ b/recipes/nextcloud-deck/README.md @@ -0,0 +1,23 @@ +# Ferdium recipe for Nextcloud News + +Nextcloud Deck is a kanban style organization tool aimed at personal planning and project organization for teams integrated with Nextcloud. + +To add Nextcloud Deck service to Ferdium, Nextcloud server address should be provided in the field "Custom server". + +## Credits + +This recipe is based on [`recipe-nextcloud-tasks`](https://github.com/meetfranz/recipe-nextcloud-tasks). + +Icon was sourced from (`deck.svg`, as `favicon.svg` seems to be malformed currently) and I added the rounded blue square in the background. If someone can find or make an icon that better matches the other Nextcloud services, please do. + +## Links + +Ferdium: + +- [Ferdium](https://ferdium.org/) +- [Ferdium recipes](https://github.com/ferdium/ferdium-recipes) + +Nextcloud: + +- [Nextcloud](https://nextcloud.com/) +- [Nextcloud Deck](https://apps.nextcloud.com/apps/deck) diff --git a/recipes/nextcloud-deck/icon.svg b/recipes/nextcloud-deck/icon.svg new file mode 100644 index 0000000..badb802 --- /dev/null +++ b/recipes/nextcloud-deck/icon.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/recipes/nextcloud-deck/index.js b/recipes/nextcloud-deck/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/nextcloud-deck/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/nextcloud-deck/package.json b/recipes/nextcloud-deck/package.json new file mode 100644 index 0000000..7d2be65 --- /dev/null +++ b/recipes/nextcloud-deck/package.json @@ -0,0 +1,14 @@ +{ + "id": "nextcloud-deck", + "name": "Nextcloud Deck", + "version": "1.0.0", + "license": "MIT", + "repository": "https://github.com/mindcombatant/ferdium-recipes/tree/master/recipes/nextcloud-deck/", + "config": { + "hasNotificationSound": true, + "hasTeamId": true, + "urlInputPrefix": "https://", + "urlInputSuffix": "/apps/deck/", + "serviceURL": "https://{teamId}/apps/deck/" + } +} diff --git a/recipes/nextcloud-deck/service.css b/recipes/nextcloud-deck/service.css new file mode 100644 index 0000000..0bfd055 --- /dev/null +++ b/recipes/nextcloud-deck/service.css @@ -0,0 +1,41 @@ +/* Hide all app links and contacts menu link in the top menu except for +Deck */ +#appmenu li:not([data-id='deck']), +#contactsmenu { + display: none; +} + +/* Change the cursor to the default for Nextcloud home and Deck +links in the top menu and disable them */ +#nextcloud, +#appmenu li[data-id='deck'] a { + cursor: default; + pointer-events: none; +} + +/* Hide all settings options, except the option to log out */ +#settings #expanddiv li:not([data-id='logout']) { + display: none; +} + +/* Fix the margin of the dropdown */ +#settings #expanddiv, +#settings #expanddiv > ul { + min-height: 0; +} + +/* Hide "More" link in the top menu */ +#more-apps { + display: none !important; +} + +/* Hide notifications that are not related to Deck */ +.notifications .notification-wrapper .notification:not([object_type="deck"]) { + display: none; +} + +/* Hide "Dismiss all notifications" as this action will dismiss also hidden +notifications */ +.notification-wrapper .dismiss-all { + display: none; +} diff --git a/recipes/nextcloud-deck/webview.js b/recipes/nextcloud-deck/webview.js new file mode 100644 index 0000000..33bf0c5 --- /dev/null +++ b/recipes/nextcloud-deck/webview.js @@ -0,0 +1,20 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + const getMessages = () => { + const directSelector = document.querySelector( + '.subscriptions-feed .app-navigation-entry-utils-counter', + ); + const direct = directSelector ? Ferdium.safeParseInt(directSelector.textContent) : 0; + + Ferdium.setBadge(direct); + }; + + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-54-g00ecf