Difference between revisions of "Template:TU Darmstadt/JS"

 
Line 22: Line 22:
 
   });
 
   });
  
   for (var m of ul.getElementsByClassName('multiple')) {
+
   var mul = ul.getElementsByClassName('multiple');
 +
  for (var i = 0; i < mul.length; i++) {
 +
    var m = mul[i];
 
     m.addEventListener('click', function () {
 
     m.addEventListener('click', function () {
       for (var r of ul.getElementsByClassName('multiple')) {
+
       for (var j = 0; j < mul.length; j++) {
 +
        var r = mul[j];
 
         r.classList.remove('clicked');
 
         r.classList.remove('clicked');
 
       }
 
       }
Line 36: Line 39:
  
 
   var as = document.getElementById('toc').getElementsByTagName('a');
 
   var as = document.getElementById('toc').getElementsByTagName('a');
   for (var a of as) {
+
   for (var i = 0; i < as.length; i++) {
 +
    var a = as[i];
 
     a.addEventListener('click', function () {
 
     a.addEventListener('click', function () {
       for (var oa of as) {
+
       for (var j = 0; j < as.length; j++) {
 +
        var oa = as[j];
 
         oa.classList.remove('active');
 
         oa.classList.remove('active');
 
       }
 
       }
Line 59: Line 64:
 
     var activeA = null;
 
     var activeA = null;
 
     var nextIsActive = false;
 
     var nextIsActive = false;
     for (var a of as) {
+
     for (var i = 0; i < as.length; i++) {
 +
      var a = as[i];
 
       a.classList.remove('active');
 
       a.classList.remove('active');
 
  
 
       if (nextIsActive || and(!a.parentElement.classList.contains('toclevel-1'), !activeA)) {
 
       if (nextIsActive || and(!a.parentElement.classList.contains('toclevel-1'), !activeA)) {

Latest revision as of 17:18, 17 October 2018