/* == Algorithm for show/unshow == Each hint/file is given a number, hint# or file# When we say showOnly with a class name we add the rules to the css #content div {display:none}, #content div.className {display:block} When going back to showAll we remove these results */ /* CSS utils */ function css_del(n) { var css = document.styleSheets[0]; for (var i = 0; i < n; i++) css.deleteRule(css.cssRules.length-1); } function css_add(s) { var css = document.styleSheets[0]; css.insertRule(s, css.cssRules.length); } /* Show/Hide logic */ var last = ""; function show(id) { if (id == last) return; if (id == "") { css_del(3); css_add(".errors-all {font-weight: bold;}"); } else { if (last == "") { css_del(1); css_add(".errors-content > ol > li {display:none;}"); } else { css_del(2); } css_add(".errors-content > ol > li." + id + " {display:list-item;}"); css_add("#" + id + "{font-weight:bold;}"); } last = id; }