Difference between revisions of "Template:Expand All"

From BTAWiki
Jump to navigation Jump to search
(Test)
 
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<button onclick="expand()">Expand all</button>
+
<div id="mw-collapsible-text"></div>
<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>
 

Latest revision as of 00:30, 28 July 2021