Difference between revisions of "Template:Hamburg/JS/notebook"

Line 16: Line 16:
  
 
function createNotebookNavigation() {
 
function createNotebookNavigation() {
   
+
 
 
     var entryList = document.getElementsByClassName("entry");
 
     var entryList = document.getElementsByClassName("entry");
  
Line 115: Line 115:
 
function getMonthById(i) {
 
function getMonthById(i) {
 
     var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
 
     var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
     return months[i-1];
+
     return months[i - 1];
 
}
 
}
  
Line 139: Line 139:
  
 
             if (currentElement.parentElement != navElement.parentElement) {    //only hides elements that are not a child of the focused nav element (toggle bug fix)
 
             if (currentElement.parentElement != navElement.parentElement) {    //only hides elements that are not a child of the focused nav element (toggle bug fix)
            currentElement.classList.add("hidden");
+
                currentElement.classList.add("hidden");
 
             }
 
             }
 
         }
 
         }
Line 163: Line 163:
 
     var notebookContainer = document.getElementById("notebook-container");
 
     var notebookContainer = document.getElementById("notebook-container");
  
var height = $("#notebook-navigation").height();
+
    var height = $("#notebook-navigation").height();
  
 
     notebookContainer.style.height = height;
 
     notebookContainer.style.height = height;
Line 178: Line 178:
 
     var entrys = document.getElementsByClassName("entry"),
 
     var entrys = document.getElementsByClassName("entry"),
 
         navElements = document.getElementsByClassName("notebook-navigation-layer3");
 
         navElements = document.getElementsByClassName("notebook-navigation-layer3");
 +
 +
  
 
     for (var i = 0; i < entrys.length; i++) {
 
     for (var i = 0; i < entrys.length; i++) {
Line 195: Line 197:
  
 
     if (navElement != null) {
 
     if (navElement != null) {
    navElement.parentElement.classList.add("active");
+
        navElement.parentElement.classList.add("active");
 +
    }
 +
 
 +
    if (id == null) {
 +
        entrys[0].classList.remove("hidden");
 
     }
 
     }
 
}
 
}

Revision as of 03:01, 19 December 2018