Difference between revisions of "Team:TUDelft/javascript/removal"

(Created page with "// Trying to minimize the impact that the fucking iGEM upload system has on the layout of the uploaded pages... Minimizing the impact of the already loaded stylesheet... $(do...")
 
 
Line 1: Line 1:
// Trying to minimize the impact that the fucking iGEM upload system has on the layout of the uploaded pages... Minimizing the impact of the already loaded stylesheet...
+
var coll = document.getElementsByClassName("collapsible");
 +
var i;
  
$(document).ready(function() {
+
for (i = 0; i < coll.length; i++) {
   $('div#content').removeAttr('id').attr('id', 'contentBox');
+
   coll[i].addEventListener("click", function() {
  $('a#top').remove();
+
    this.classList.toggle("activedropdown");
  $('div#top_title').remove();
+
    var content = this.nextElementSibling;
  $('div#HQ_page').removeAttr('id');
+
    if (content.style.maxHeight){
  $('div.mw-body').removeAttr('class');
+
      content.style.maxHeight = null;
  $('div#mw-content-text').removeAttr('id');
+
    } else {
  $('div#bodyContent').removeAttr('id');
+
      content.style.maxHeight = content.scrollHeight + "px";
  $('div.mw-content-ltr>p').addClass('meta');
+
    }
   $('div.mw-content-ltr').removeAttr('class').attr('id', 'Global');
+
   });
})
+
}

Latest revision as of 09:05, 12 September 2018

var coll = document.getElementsByClassName("collapsible"); var i;

for (i = 0; i < coll.length; i++) {

 coll[i].addEventListener("click", function() {
   this.classList.toggle("activedropdown");
   var content = this.nextElementSibling;
   if (content.style.maxHeight){
     content.style.maxHeight = null;
   } else {
     content.style.maxHeight = content.scrollHeight + "px";
   } 
 });

}