Can I toggle expand all Expand Macros in a page?
Asked by Ray Dogum:

I have multiple Expand macros in a page that collects weekly meeting notes in a table. I use the Expand macros because the comments column can get very long and it creates a really long page. In order to reduce the long page, I can collapse the comments and it shrinks the rows.

However, I cannot do CRTL+F to find text within a collapsed section. Is there a way to expand and collapse all the Expand macros on a page in one click?

This would really improve my workflow. Also open to other creative suggestions.

I could imagine a button on top of the page called "Expand all" / "Collapse all"


Answers:
author: Timothy Cameron
body: This is how we solved it <https://medium.com/@timcameron/expanding-all-in-confluence-db0d3cd711f0>

comments: author: Ray Dogum
body: [@Shannon S](/t5/user/viewprofilepage/user-id/510046) - Can you confirm Tim's workaround is legit before I try it? Thanks!


author: AnnWorley
body: Hi Ray,

Just barging in because Shannon is not around. I tried Tim's workaround and it worked for me in Confluence 6.8 and on Confluence Cloud.

Thanks,

Ann


author: Ray Dogum
body: Thank you [@Timothy Cameron](/t5/user/viewprofilepage/user-id/1182579)!!  
Works great :)


author: Karl M Kovaciny
body: For those who can't read Medium at work, make a bookmarklet with this URL

```

javascript&colon;(function()%7B%24(".expand-control").each(function()%7B %24(this).trigger("click")%3B%7D)%7D)()
```

but replace \&colon; with a colon.


author: tiffany
body: This isn't working for me... Is there something that needs to be updated in the code?


author: Thomas Kramer
body: Does not work for me either


author: David Yohler
body: Had the same issue for Confluence Cloud. Edited the script slightly for the expand class:  

javascript\&colon;(function()%7B%24(%22.**css-15263az** %22).each(function()%7B%20%24(this).trigger(%22click%22)%3B%7D)%7D)()  

Bold for emphasis. Not sure if / how long that will work, but it is working for me because the "inspect" shows that as the expand class.  

Additionally, got it to work for Edge browser manually as well:

1. Bookmark a favorite page, any page will do.

2. Right click to Edit

3. Change name to: Expand ALL

4. Change URL to: javascript\&colon;(function(){$(".css-15263az").each(function(){ $(this).trigger("click");})})()

5. Save


author: Daniel Rykheer
body: Here's the new/correct script as per the latest naming of the class:

*javascript\&colon;(function(){ $(".++**css-snhnyn**++").each(function(){ $(this).trigger("click"); });})()*


author: Shannon S
body: Hi Ray,

Since this is not yet a feature, I went ahead and created the request for you:

* [CONFSERVER-54308](https://jira.atlassian.com/browse/CONFSERVER-54308)

Perhaps other users that happen upon your question will have other suggestions, but please feel free to vote and comment on that issue above with your usage case.

Kind regards,

Shannon

comments: author: Ray Dogum
body: Thanks Shannon, I'll follow this new request and hope for an update soon.


author: L. Sheppard
body: There's also another fix that doesn't rely on users having to add a button in the browser, instead the page author can add code on the page that will do it. I tested on a page in Server version 6.2.3 and it works. I'll also get our admin to create a custom macro so it will be available to all our users. It's in this community thread in the post from Ben Coughlan Nov 16, 2015 about inserting an HTML macro and using the code Ben provided:

<https://community.atlassian.com/t5/Questions/How-to-create-an-quot-Expand-All-quot-button-for-Confluence/qaq-p/294206>


author: jdeklerk
body: For those on DC adding link for answered cross post:  
[How to create an "Expand All" button for Confluence](https://community.atlassian.com/t5/Confluence-questions/How-to-create-an-quot-Expand-All-quot-button-for-Confluence/qaq-p/294206)


Tags: expand