JS Rally

Hide Rally's stupid header

by Bryan H

HTML

<div id="foo">
  <div class="bucko">
    My god, it's
  </div>
  <div class="smb-PageHeade buck">
    One (0)
  </div>

  <div class="chr-StatsBanner buck">
    Two (1)
  </div>
  <div class="chr-WithPositionSticky buck">
    Three (2)
  </div>
  <div class="bucko">
    Full of stars
  </div>
</div>

CSS

#foo {
  width: 50%;
  background: rgb(6, 0, 255);
  background: linear-gradient(13deg,  rgba(6, 0, 255, 1) 0%,  rgba(0, 0, 135, 1) 62%,  rgba(0, 212, 255, 1) 100%); 
  text-align: center;
  border: 2px blue inset;
}

.bucko {
  clear: both;
  border: 5px yellow outset;
  margin: 10px auto;
  font-size: xx-large;
  font-weight: bold;
  font-family: cursive;
  color: yellow;
  background-color: blue;
  width: 75%;
}

.buck {
  width: 30%;
  border: 3px blue dashed;
  color: white;
  
 /* display: block; */
  padding: 20px;
  font-size: x-large;
  font-variant: small-caps slashed-zero;
  margin: 25px auto 0 auto;
  background: rgb(2, 0, 36);
  background: linear-gradient(0deg, rgba(2, 0, 36, 1) 0%, rgba(9, 9, 121, 1) 62%, rgba(0, 212, 255, 1) 100%); 

}

JavaScript

let classes_to_close = [
  "smb-PageHeade",
  "chr-StatsBanner",
  "chr-WithPositionSticky"
];

var d = document.getElementById("foo");
if (d) {
  var b = document.createElement('button');
  b.appendChild(document.createTextNode('toggle collapse'));

  b.addEventListener('click', bug);
  d.appendChild(b);
}

function bug() {
  var ddst, i, dd;
  for (i in classes_to_close) {
    /* console.log("Class to close: [" + classes_to_close[i] + "]"); */
    dd = document.getElementsByClassName(classes_to_close[i])
    j=0;
      if (dd[j]) {
        /* console.log("DD: [" + dd[j].innerHTML + "] j:[" + j + ']')  */
        ddst = dd[j].style;
        /* console.log("Visible Style:[" + ddst.visibility + "]") */
        if (ddst.visibility == "hidden") {
          /* console.log("showing it") */
          ddst.visibility = "visible";
        } else {
          /* console.log("hiding it"); */
          ddst.visibility = "hidden";
        }
      }
    /*}*/
  }
}