- for(var i = 0; i < directions.length; i++) {
- directions[i].children[0].onclick = function(event) {
- event.preventDefault();
- var node = event.currentTarget;
- if(menuLoc != 10) {
- menuLoc = 0;
- menu.setAttribute("class", "top");
- window.history.pushState("object or string", "Title", node.href);
- } else {
- window.history.pushState("object or string", "Title", node.href);
- }
+ function menuOperator(position, token="") {
+ event.preventDefault();
+ var node = event.currentTarget;
+ menu.setAttribute("class", position);
+ for(var i = 0; i < links.length; i++) {
+ links[i].children[0].removeAttribute("class");
+ }
+ node.setAttribute("class", "selected " + token);
+ for(var i = 0; i < content.children.length; i++) {
+ content.children[i].setAttribute("class", "hidden")
+ }
+ var name = node.getAttribute("data-name");
+ if(name) {
+ var article = document.getElementById(name);
+ article.setAttribute("class", "selected");
+ }
+ window.history.pushState("object or string", "Title", node.href);
+ }
+
+ for(var i = 0; i < links.length - 1; i++) {
+ links[i].children[0].onclick = function(event) {
+ menuOperator("top");