var navcontents=""; var sidebarcontents=""; var resizesize=940; var sidebarPadding = 64; var collapseState = 0; function toggleCollapse() { var myClass = document.getElementsByClassName("canCollapse"); if (collapseState == 0) { var state = "inline-block"; collapseState = 1; } else { var state = ""; collapseState = 0; } for(var i = 0; i < myClass.length; i++) { myClass[i].style.display = state; } } function generateNavBar(sectionname,prefix) { if (prefix == null){ prefix = ""; } navcontents += ""; } //generates the sidebar with a given section name, filepath to the root (prefix), and the type of sidebar to generate function generateSideBar(sectionname,prefix,type) { if (type == "learn") { sidebarcontents += "" } else if (type == "build") { sidebarcontents += "" } setInterval(function(){ fitSideBar(); }, 100); } function fitSideBar() { if (window.innerWidth > resizesize) { if (document.getElementById('sidebar').offsetHeight != document.body.offsetHeight+sidebarPadding){ document.getElementById("sidebar").style.height = document.body.offsetHeight+sidebarPadding+"px"; console.log("resized"); } } else { document.getElementById("sidebar").style.height = ""; } } function generateFooter(prefix) { navcontents=""; navcontents += "" } //current section name will be compared against what is passed in as "correct" and return "selected" as a string. Meant to be used as a class. function checkSelected(correct,sectionname) { if (sectionname != null) { if (correct == sectionname) { return "selected"; } else { return ""; } } else { console.log("Webpage has no section name to compare against.") return ""; } } function echoString(node,mystring,bottom) { if (bottom != 1) { node.innerHTML = mystring+node.innerHTML+sidebarcontents; } else { node.innerHTML = node.innerHTML+mystring; } } function toggleClass(object,classname,screenwidth,e) { if ((document.body.offsetWidth <= screenwidth) && ( ( (e.target.tagName == "LI") && e.target.classList.contains( 'dropdown' ) ) || (e.target.tagName == "DIV") )) { object.classList.toggle(classname) } }