aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Edgars <eandersons@users.noreply.github.com>2023-11-27 15:12:31 +0200
committerLibravatar GitHub <noreply@github.com>2023-11-27 06:12:31 -0700
commit82c9444088a632e2b654f2d65d952f5ed07b52bd (patch)
treec5e39bc6db3dbe0fd5fae59f89773e2c4b0e0ded /recipes
parentchore: update links in pr template (#471) (diff)
downloadferdium-recipes-82c9444088a632e2b654f2d65d952f5ed07b52bd.tar.gz
ferdium-recipes-82c9444088a632e2b654f2d65d952f5ed07b52bd.tar.zst
ferdium-recipes-82c9444088a632e2b654f2d65d952f5ed07b52bd.zip
Fix selectors in the Nextcloud Calendar recipe (#472)
Script and CSS was updated to add selectors for the latest Nextcloud (27). Previous selectors were left as is for backwards compatibility.
Diffstat (limited to 'recipes')
-rw-r--r--recipes/nextcloud-calendar/package.json2
-rw-r--r--recipes/nextcloud-calendar/service.css56
-rw-r--r--recipes/nextcloud-calendar/webview.js19
3 files changed, 42 insertions, 35 deletions
diff --git a/recipes/nextcloud-calendar/package.json b/recipes/nextcloud-calendar/package.json
index 6505652..3a21661 100644
--- a/recipes/nextcloud-calendar/package.json
+++ b/recipes/nextcloud-calendar/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "nextcloud-calendar", 2 "id": "nextcloud-calendar",
3 "name": "Nextcloud Calendar", 3 "name": "Nextcloud Calendar",
4 "version": "1.3.0", 4 "version": "1.3.1",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/csolisr/ferdium-recipes/tree/master/recipes/nextcloud-calendar/", 6 "repository": "https://github.com/csolisr/ferdium-recipes/tree/master/recipes/nextcloud-calendar/",
7 "config": { 7 "config": {
diff --git a/recipes/nextcloud-calendar/service.css b/recipes/nextcloud-calendar/service.css
index 6e04c63..000a634 100644
--- a/recipes/nextcloud-calendar/service.css
+++ b/recipes/nextcloud-calendar/service.css
@@ -1,41 +1,47 @@
1/* Hide all app links and contacts menu link in the top menu except for 1/*
2Calendar */ 2With `/* Legacy [asterisk]/` are marked those selectors that were working for
3#appmenu li:not([data-id="calendar"]), 3some Nextcloud version before 27 (24 or 25).
4#contactsmenu { 4*/
5
6/*Hide all interactive elements that are not related to the Calendar. */
7/* App links and contacts menu link in the top menu except for Calendar */
8#appmenu li:not([data-id="calendar"]), /* Legacy */
9.app-menu-main > .app-menu-entry:not([data-app-id="calendar"]), /* Nextcloud 27 */
10#unified-search,
11#contactsmenu,
12/* All settings options, except the option to log out */
13#settings #expanddiv li:not([data-id='logout']), /* Legacy */
14#header-menu-user-menu li:not([id='logout']), /* Nextcloud 27 */
15/* Notifications that are not related to Calendar */
16.notifications .notification-wrapper .notification:not([object_type="dav"]), /* Legacy */
17.notification-container .notification-wrapper .notification:not([data-app="dav"]), /* Nextcloud 27 */
18/* "Dismiss all notifications" as this action will dismiss also hidden
19notifications as this behaviour might not be desirable. */
20.notification-wrapper .dismiss-all, /* Legacy */
21.notification-container .dismiss-all /* Nextcloud 27 */ {
5 display: none; 22 display: none;
6} 23}
7 24
8/* Change the cursor to default for top menu Nextcloud home and Calendar 25/* Change the cursor to default for top menu Nextcloud home and Calendar
9links and disable them */ 26links and disable them */
10#nextcloud, 27#nextcloud,
11#appmenu li[data-id="calendar"] a { 28#appmenu li[data-id="calendar"] a, /* Legacy */
12 cursor:default; 29.app-menu-main li[data-app-id="calendar"] a /* Nextcloud 27 */ {
30 cursor: default;
13 pointer-events: none; 31 pointer-events: none;
14} 32}
15 33
16/* Hide all settings options, except the option to log out */
17#settings #expanddiv li:not([data-id='logout']) {
18 display: none;
19}
20
21/* Fix the margin of the dropdown */ 34/* Fix the margin of the dropdown */
22#settings #expanddiv, 35#settings #expanddiv, /* Legacy */
23#settings #expanddiv > ul { 36#settings #expanddiv > ul, /* Legacy */
24 min-height: 0; 37#header-menu-notifications, /* Nextcloud 27 */
38#header-menu-notifications > .header-menu__content, /* Nextcloud 27 */
39#header-menu-user-menu, /* Nextcloud 27 */
40#header-menu-user-menu > .header-menu__content /* Nextcloud 27 */ {
41 min-height: auto;
25} 42}
26 43
27/* Hide "More" link in the top menu */ 44/* Hide "More" link in the top menu */
28#more-apps { 45#more-apps {
29 display: none !important; 46 display: none !important;
30} 47}
31
32/* Hide notifications that are not related to calendar */
33.notifications .notification-wrapper .notification:not([object_type="dav"]) {
34 display: none;
35}
36
37/* Hide "Dismiss all notifications" as this action will dismiss also hidden
38notifications */
39.notification-wrapper .dismiss-all {
40 display: none;
41}
diff --git a/recipes/nextcloud-calendar/webview.js b/recipes/nextcloud-calendar/webview.js
index 2755cab..3ff240f 100644
--- a/recipes/nextcloud-calendar/webview.js
+++ b/recipes/nextcloud-calendar/webview.js
@@ -5,18 +5,19 @@ function _interopRequireDefault(obj) {
5const _path = _interopRequireDefault(require('path')); 5const _path = _interopRequireDefault(require('path'));
6 6
7module.exports = Ferdium => { 7module.exports = Ferdium => {
8 // With `// Legacy ` are marked those selectors that were working for some
9 // Nextcloud version before 27 (24 or 25).
10 const notificationElement = '.notification-wrapper .notification';
8 const getMessages = () => { 11 const getMessages = () => {
9 const directSelector = document.querySelectorAll( 12 Ferdium.setBadge(
10 '.notifications .notification-wrapper .notification[object_type="dav"]', 13 Ferdium.safeParseInt(
14 document.querySelectorAll(
15 `.notifications ${notificationElement}[object_type="dav"], ` + // Legacy
16 `.notification-container ${notificationElement}[data-app="dav"]`, // Nextcloud 27
17 )?.length,
18 ),
11 ); 19 );
12 const direct = directSelector
13 ? Ferdium.safeParseInt(directSelector.length)
14 : 0;
15
16 Ferdium.setBadge(direct);
17 }; 20 };
18
19 Ferdium.loop(getMessages); 21 Ferdium.loop(getMessages);
20
21 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); 22 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
22}; 23};