expand all at once button for wiki/Documentation

Please see:

Any idea on how to add an expand all button (so not each one has to be manually clicked)?

//cc @fortasse

Seems like people have wanted it for years: Manual talk:Collapsible elements - MediaWiki

We could hack something up in javascript though, all the expandable elements share a class we can iterate through.

1 Like

Yes, if not too much gymnastics, that would be awesome!

I have the JS:

Array.from(document.getElementsByClassName("mw-collapsible-toggle-collapsed")).forEach(function(section){section.childNodes[1].click()});

for expanding and

Array.from(document.getElementsByClassName("mw-collapsible-toggle-expanded")).forEach(function(section){section.childNodes[1].click()});

for collapsing. I’m having trouble figuring out how to get the hooks in Mediawiki proper. I think we did something to do the “simple/complicated” documentation split, do you have any idea how the technical side of that @Patrick?

1 Like

Nevermind. I got Widgets and Templates confused.

Proof of concept here: https://www.whonix.org/w/index.php?title=Fortasse:Sandbox&stable=0
Widget here: Widget:Expand or Collapse All - Whonix

I’m not very stylish, so if you have ideas on how to “prettify” it, by all means. :slight_smile:

2 Likes

Do we need a collapse all button? Seems rather playful. I mean, if someone ever needs that, we could just say “just reload the page”. For perfection’s sake it would be one button, but even that is not really needed. I am more than happy about the “expand all” button. Could you add it to Whonix ™ Documentation please? I am fine with the styling, but if anyone has suggestions (and code?) to prettify it, why not.

Although when you “expand all” the page is huge. So if a user wants to easily navigate back to another major section, it is easier for them to hit “collapse all” for convenience.

Also, the standard web pages where you see functionality seem to have both. Better to follow normal standards (?)

Either way, thanks @fortasse! It’s a big improvement.

Now live on Whonix ™ Documentation . The widget should be reusable for any other pages that have mediawiki-style expandable sections, if needed.

2 Likes

Widget:Expand or Collapse All - Whonix was broken after upgrade to mediawiki 1.31.0 and mediawiki skin Foreground. (Either one broke it. Dunno which one.)

A fix was recently submitted: Widget talk:Expand or Collapse All - Whonix

Expand all / Collapse all is now working again on Whonix ™ Documentation.

Yay!

2 Likes

Would Widget:Expand or Collapse All - Whonix be useful for any other wiki pages?

Hi Patrick

Yes, I was thinking about using expand/collapse for Comments to use Qubes onionizing repos. Currently there are only - comment these lines / uncomment these lines. As @torjunkie pointed out it would be less confusing for users to CodeSelect and paste. The only issue with that is the large code blocks. All three of them together doesn’t look good IMO. This would partially solve this issue i.e. java script would need to be enabled for expand / collapse to function.

Qubes onion code block

# Main qubes updates repository
deb [arch=amd64] http://deb.qubes-os.org/r4.0/vm @DIST@ main
#deb-src http://deb.qubes-os.org/r4.0/vm @DIST@ main

# Qubes updates candidates repository
#deb [arch=amd64] http://deb.qubes-os.org/r4.0/vm @DIST@-testing main
#deb-src http://deb.qubes-os.org/r4.0/vm @DIST@-testing main

# Qubes security updates testing repository
#deb [arch=amd64] http://deb.qubes-os.org/r4.0/vm @DIST@-securitytesting main
#deb-src http://deb.qubes-os.org/r4.0/vm @DIST@-securitytesting main

# Qubes experimental/unstable repository
#deb [arch=amd64] http://deb.qubes-os.org/r4.0/vm @DIST@-unstable main
#deb-src http://deb.qubes-os.org/r4.0/vm @DIST@-unstable main


# Qubes Tor updates repositories
# Main qubes updates repository
#deb [arch=amd64] http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@ main
#deb-src http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@ main

# Qubes updates candidates repository
#deb [arch=amd64] http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@-testing main
#deb-src http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@-testing main

# Qubes security updates testing repository
#deb [arch=amd64] http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@-securitytesting main
#deb-src http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@-securitytesting main

# Qubes experimental/unstable repository
#deb [arch=amd64] http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@-unstable main
#deb-src http://deb.sik5nlgfc5qylnnsr57qrbm64zbdx6t4lreyhpon3ychmxmiem7tioad.onion/r4.0/vm @DIST@-unstable main
2 Likes

Adding the large code blocks look awful. They take up too much room and would defeat the purpose of comments to use onion repos IMO. I think it would be much easier to comment/uncomment for these instructions. So no need to add expand all at once button.

P.S. I have all the edits saved in a text file so if anyone would like to see how they would look please let me know.

1 Like

Thanks for trying 0brand. Just go for comment / un-comment then.