Can I toggle expand all Expand Macros in a page?

Ray Dogum November 21, 2017

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"

4 answers

2 accepted

6 votes
Answer accepted
Timothy Cameron
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 27, 2018
Ray Dogum March 27, 2018

@Shannon S - Can you confirm Tim's workaround is legit before I try it? Thanks!

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2018

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

Ray Dogum March 27, 2018

Thank you @Timothy Cameron!!
Works great :)

Karl M Kovaciny March 28, 2018

For those who can't read Medium at work, make a bookmarklet with this URL 


javascript:(function()%7B%24(".expand-control").each(function()%7B %24(this).trigger("click")%3B%7D)%7D)()

 but replace : with a colon.

tiffany
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2020

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

Thomas Kramer August 17, 2020

Does not work for me either

David Yohler October 17, 2023

Had the same issue for Confluence Cloud.  Edited the script slightly for the expand class:

javascript:(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:(function(){$(".css-15263az").each(function(){ $(this).trigger("click");})})()

  5. Save

Daniel Rykheer August 19, 2024

Here's the new/correct script as per the latest naming of the class:

javascript:(function(){ $(".css-snhnyn").each(function(){ $(this).trigger("click"); });})()

2 votes
Answer accepted
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2017

Hi Ray,

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

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

Ray Dogum November 22, 2017

Thanks Shannon, I'll follow this new request and hope for an update soon.

2 votes
L. Sheppard March 28, 2018

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

0 votes
jdeklerk January 12, 2024

For those on DC adding link for answered cross post:
How to create an "Expand All" button for Confluence

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events