Extract inlineJs for menu. Cleanup "default.css"
authorFelix Dörre <felix@dogcraft.de>
Wed, 2 Jul 2014 07:13:44 +0000 (09:13 +0200)
committerFelix Dörre <felix@dogcraft.de>
Wed, 2 Jul 2014 07:13:44 +0000 (09:13 +0200)
static/default.css
static/menu.js [new file with mode: 0644]
templates/base.html

index c30b848f7d1e442f69b9778c7b1e8c61b3140941..aaeebe85c4ecdb5ea564a048f82c349c8c16634b 100644 (file)
@@ -482,17 +482,17 @@ td.storyLeft {
 
 /************* relatedLinks styles **************/
 
-.relatedLinks {
+#pageNav div {
        margin: 0px;
        padding: 0px 0px 10px 10px;
        border-bottom: 1px solid #cccccc;
 }
 
-.relatedLinks h3 {
+#pageNav div h3 {
        padding: 10px 0px 2px 0px;
 }
 
-.relatedLinks a {
+#pageNav div a {
        display: block;
 }
 
@@ -729,3 +729,6 @@ div.footerbar {
 
 .accountdetail.suffix {
 }
+ul.menu.hidden{
+       display: none;
+}
\ No newline at end of file
diff --git a/static/menu.js b/static/menu.js
new file mode 100644 (file)
index 0000000..b73827e
--- /dev/null
@@ -0,0 +1,35 @@
+(function() {
+       function explodeMenu(e) {
+               if (document.getElementById(e).className == 'menu hidden') {
+                       document.getElementById(e).className = 'menu';
+               } else {
+                       document.getElementById(e).className = 'menu hidden';
+               }
+       }
+
+       function initMenu() {
+               var Nodes = document.getElementsByTagName('ul');
+               var max = Nodes.length;
+               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) {
+                                       return function() {
+                                               explodeMenu(nid);
+                                       };
+                               })(nodeObj.id);
+                       }
+               }
+       }
+       (function(oldLoad) {
+               if (oldLoad == undefined) {
+                       window.onload = initMenu;
+               } else {
+                       window.onload = function() {
+                               initMenu();
+                               oldLoad();
+                       }
+               }
+       })(window.onload);
+
+})();
\ No newline at end of file
index 6347e4016b4a1476d6b011f9998d098197026229..0620f543876dbd983c1e9066390232efe31f3ab3 100644 (file)
@@ -1,30 +1,11 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html>
 <html>
 <head>
 <title>$title$</title>
 <link rel="stylesheet" href="/static/default.css" type="text/css">
-<script language="javascript" type="text/javascript">
-       function explode(e) {
-               if (document.getElementById(e).style.display == 'none') {
-                       document.getElementById(e).style.display = 'block';
-               } else {
-                       document.getElementById(e).style.display = 'none';
-               }
-       }
-
-       function hideall() {
-               var Nodes = document.getElementsByTagName('ul');
-               var max = Nodes.length;
-               for (var i = 0; i < max; i++) {
-                       var nodeObj = Nodes.item(i);
-                       if (nodeObj.className == "menu" && nodeObj.id != "recom") {
-                               nodeObj.style.display = 'none';
-                       }
-               }
-       }
-</script>
+<script src="/static/menu.js"></script>
 </head>
-<body onload="hideall();">
+<body>
        <div id="pagecell1">
                <div id="pageName">
                        <br>
                        </div>
                </div>
                <div id="pageNav">
-                       <div class="relatedLinks">
+                       <div>
                                <h3>CAcert.org beitreten</h3>
                                <a href="/register">Beitreten</a> <a
                                        href="/policy/CAcertCommunityAgreement.php">Vereinbarung der
                                        Gemeinschaft (Community Agreement)</a> <a href="/index.php?id=3">Stammzertifikat</a>
                        </div>
-                       <div class="relatedLinks">
+                       <div>
                                <h3 class="pointer">Mein Konto</h3>
                                <a href="/login">Anmelden mit
                                        Kennwort</a> <a href="">Kennwort
@@ -52,9 +33,9 @@
                                        im Net-Cafe</a> <a href="/login">Anmelden
                                        mit Zertifikat</a>
                        </div>
-                       <div class="relatedLinks">
-                               <h3 class="pointer" onclick="explode('misc')">+ Über CAcert.org</h3>
-                               <ul class="menu" id="misc" style="display: none;">
+                       <div>
+                               <h3 class="pointer">+ Über CAcert.org</h3>
+                               <ul class="menu hidden" id="misc">
                                        <li><a href="http://blog.cacert.org/">CAcert-Nachrichten</a></li>
                                        <li><a href="http://wiki.CAcert.org/">Wiki-Dokumentation</a></li>
                                        <li><a href="/policy/">Richtlinien</a></li>
@@ -68,9 +49,9 @@
                                </ul>
                        </div>
 
-                       <div class="relatedLinks">
-                               <h3 class="pointer" onclick="explode('trans')">+ Übersetzungen</h3>
-                               <ul class="menu" id="trans" style="display: none;">
+                       <div>
+                               <h3 class="pointer">+ Übersetzungen</h3>
+                               <ul class="menu hidden" id="trans">
                                        <li><a href="/index.php?id=0&amp;lang=ar">العربية</a></li>
                                        <li><a href="/index.php?id=0&amp;lang=bg">Български</a></li>
                                        <li><a href="/index.php?id=0&amp;lang=cs">Čeština</a></li>
@@ -97,9 +78,9 @@
                                        <li><a href="/index.php?id=0&amp;lang=zh-tw">中文(臺灣)</a></li>
                                </ul>
                        </div>
-                       <div class="relatedLinks">
-                               <h3 class="pointer" onclick="explode('recom')">Werbung</h3>
-                               <ul class="menu" id="recom"></ul>
+                       <div>
+                               <h3 class="pointer">Werbung</h3>
+                               <ul class="menu hidden" id="recom"></ul>
                        </div>
                </div>
                <div id="content">