X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=static%2Fstatic%2Fmenu.js;h=023e62440757526865c0a33e05b8fdcf948d0526;hp=b73827eb6383bcff219200ee841e4b615a04ca97;hb=2fb0af2c1dd48272ffcc1d501324ff1f609331d4;hpb=d690eda36eba121aa79e4f456d5f0eb481be8b86 diff --git a/static/static/menu.js b/static/static/menu.js index b73827eb..023e6244 100644 --- a/static/static/menu.js +++ b/static/static/menu.js @@ -1,9 +1,9 @@ (function() { function explodeMenu(e) { - if (document.getElementById(e).className == 'menu hidden') { - document.getElementById(e).className = 'menu'; + if (e.className == 'menu hidden') { + e.className = 'menu'; } else { - document.getElementById(e).className = 'menu hidden'; + e.className = 'menu hidden'; } } @@ -13,23 +13,46 @@ for (var i = 0; i < max; i++) { var nodeObj = Nodes.item(i); if (nodeObj.className.indexOf("menu") > -1 && nodeObj.id != "recom") { - nodeObj.previousSibling.previousSibling.onclick = (function(nid) { + nodeObj.previousSibling.previousSibling.onclick = (function(node) { return function() { - explodeMenu(nid); + explodeMenu(node); }; - })(nodeObj.id); + })(nodeObj); } } } + function showExpert(a) + { + b=document.getElementsByClassName("expert"); + for(i=0;b.length>i;i++) + { + if(!a) {b[i].setAttribute("class","expert experthidden"); } + else {b[i].setAttribute("class","expert");} + } + b=document.getElementsByClassName("expertoff"); + for(i=0;b.length>i;i++) + { + b[i].setAttribute("class",""); + } + + } + function init(){ + initMenu(); + showExpert(false); + var expert = document.getElementById("expertbox"); + if(expert !== null) { + expert.onchange = (function(expert){return function(){showExpert(expert.checked)}})(expert); + } + } (function(oldLoad) { if (oldLoad == undefined) { - window.onload = initMenu; + window.onload = init; } else { window.onload = function() { - initMenu(); + init(); oldLoad(); } } })(window.onload); -})(); \ No newline at end of file +})();