From 6e3b762716ac057051b2d4799102d492a8956fdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Wed, 2 Jul 2014 09:13:44 +0200 Subject: [PATCH] Extract inlineJs for menu. Cleanup "default.css" --- static/default.css | 9 ++++++--- static/menu.js | 35 +++++++++++++++++++++++++++++++++ templates/base.html | 47 ++++++++++++++------------------------------- 3 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 static/menu.js diff --git a/static/default.css b/static/default.css index c30b848f..aaeebe85 100644 --- a/static/default.css +++ b/static/default.css @@ -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 index 00000000..b73827eb --- /dev/null +++ b/static/menu.js @@ -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 diff --git a/templates/base.html b/templates/base.html index 6347e401..0620f543 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,30 +1,11 @@ - + $title$ - + - +

@@ -37,13 +18,13 @@