diff --git a/generate.py b/generate.py index 2b05cba..8f2847f 100644 --- a/generate.py +++ b/generate.py @@ -9,7 +9,7 @@ def rjs(f, z): result.append("var x = document.getElementsByClassName(z);") result.append("for (var i = 0; i < x.length; i++) { x[i].style.display = 'inline-block'; }") result.append("var x = document.getElementById(z);") - result.append("x.onclick = function() { while(z.length > " + str(len(z)) + ") { key({keyCode: 27}); } }") + result.append("x.onclick = function() { collapse('" + str(z) + "');}") result.append("}") if type(f[2]) != str: for l in f[2]: @@ -20,7 +20,7 @@ def rjs2(f, z): result = [] if type(f[2]) != str: result.append("if (z == '"+z+"') {") - result.append("document.getElementById(z+'" + f[1] + "').onclick = function() { key({keyCode:" + str(ord(f[1].upper())) + " }) };") + result.append("document.getElementById(z+'" + f[1] + "').onclick = function() { if (z != \""+z+"\") { collapse(\""+z+"\") } key({keyCode:" + str(ord(f[1].upper())) + " }) };") result.append("}") for l in f[2]: result.append(rjs2(l, z + f[1])) @@ -33,7 +33,7 @@ def rhtml(f, z): href = ["href='"+f[2]+"'"] if len(z) > 0: href = ["style='display: none;'"] - result.append(''.join(["", f[0], ""])) + result.append(''.join(["", f[0], ""])) if type(f[2]) != str: result.append("") for l in f[2]: @@ -88,6 +88,20 @@ master = [""" """) -master.append("""
""") +master.append("""
""") for f in l: master.append(rhtml(f, "")) master.append("""
""")