The following is a Greasemonkey script for expanding all mail folders automatically when opening Nextcloud Mail in Firefox. This is an update for [How To] Auto Expand mail folders using GreaseMonkey which works with Nextcloud 31.
In Firefox install the add-on: Greasemonkey – Get this Extension for 🦊 Firefox (en-US)
Then in the Greasemonkey addon create a new script and paste the script below.
ATTENTION:
- Make sure to replace cloud.example.com in the lines starting with @namespace and @include with your Nextcloud domain
- Replace the text ‘Alle abonnierten Postfächer anzeigen’ with the English, French, Spanish, etc. text that you click in Nextcloud Mail to expand all of your subscribed folders. It needs to be exactly the text that the button shows, probably sth. like ‘Show all subscribed mailboxes’ in English.
// ==UserScript==
// @name Nextcloud Mail: Expand all folders
// @namespace https://cloud.example.com/
// @include https://cloud.example.com/apps/mail/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @require https://gist.githubusercontent.com/BrockA/2625891/raw/waitForKeyElements.js
// @version 1
// @grant none
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
waitForKeyElements(
'span.app-navigation-entry__name:contains("Alle abonnierten Postfächer anzeigen")',
function(elem) {
console.log('[NC Mail Expander] Click expand button', elem);
elem.click();
},
true
);
A polite request to the Nextcloud Mail developers: Please allow users to display exactly the mail folders they want when opening Nextcloud Mail as it can also get very messy when having multiple mailboxes. An example for a feature request in this regard is: Collapse mailboxes to 1 line each with display of unread messages from the inbox · Issue #9300 · nextcloud/mail · GitHub