Template:Expand All

From BTAWiki
Revision as of 00:12, 28 July 2021 by Turtrus (talk | contribs) (Test)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<button onclick="expand()">Expand all</button> <button onclick="collapse()">Collapse all</button> <script> function collapse() {

   var x = document.getElementsByClassName("mw-collapsible-text");
   var i;
   for (i = 0; i < x.length; i++) {
   if ( x[i].innerHTML == mw.message( 'collapsible-collapse' ).plain() ) {
       x[i].click(); }
   }

} function expand() {

   var x = document.getElementsByClassName("mw-collapsible-text");
   var i;
   for (i = 0; i < x.length; i++) {
   if ( x[i].innerHTML == mw.message( 'collapsible-expand' ).plain() ) {
       x[i].click(); }
   }

} </script>