MediaWiki:Minerva.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 2: Line 2:


// Template:TLP drawer
// Template:TLP drawer
function TLPExpand(x) {
  var y = "tlp-children-".concat(x); //outputs something like "tlp-children-1.21"
  var z = document.getElementById(y); //outputs something like document.getElementById("tlp-children-1.21")
  var a = "tlp-button-text-".concat(x); //outputs something like "tlp-button-text-1.21"
  var b = document.getElementById(a); //outputs something like document.getElementById("tlp-button-text-1.21")
  if (z.style.display === "block") {
    z.style.display = "none";
    b.innerHTML = "Expand";
  } else {
    z.style.display = "block";
    b.innerHTML = "Collapse";
  }
}
const TLPPropositions = ["1",
const TLPPropositions = ["1",
"1.1",
"1.1",
Line 544: Line 529:
"7"];
"7"];


TLPPropositions.forEach(TLPExpandAll);
function TLPExpandAll () {


function TLPExpandAll(x) {
  TLPPropositions.forEach(TLPExpandOne);
var y = "tlp-children-".concat(x); //outputs something like "tlp-children-1.21"
 
var z = document.getElementById(y); //outputs something like document.getElementById("tlp-children-1.21")
  function TLPExpandOne(x) {
var a = "tlp-button-text-".concat(x); //outputs something like "tlp-button-text-1.21"
    var y = "tlp-children-".concat(x); //outputs something like "tlp-children-1.21"
var b = document.getElementById(a); //outputs something like document.getElementById("tlp-button-text-1.21")
    var z = document.getElementById(y); //outputs something like document.getElementById("tlp-children-1.21")
z.style.display = "block";
    var a = "tlp-button-text-".concat(x); //outputs something like "tlp-button-text-1.21"
b.innerHTML = "Collapse";
    var b = document.getElementById(a); //outputs something like document.getElementById("tlp-button-text-1.21")
    z.style.display = "block";
    b.innerHTML = "Collapse";
  }
}
 
function TLPCollapseAll () {
 
  TLPPropositions.forEach(TLPCollapseOne);
 
  function TLPCollapseOne(x) {
    var y = "tlp-children-".concat(x); //outputs something like "tlp-children-1.21"
    var z = document.getElementById(y); //outputs something like document.getElementById("tlp-children-1.21")
    var a = "tlp-button-text-".concat(x); //outputs something like "tlp-button-text-1.21"
    var b = document.getElementById(a); //outputs something like document.getElementById("tlp-button-text-1.21")
    z.style.display = "none";
    b.innerHTML = "Expand";
  }
}
}