From: opi <opi@no-log.org>
Date: Sun, 28 Jun 2015 13:44:08 +0000 (+0200)
Subject: Menu + amélioration responsive.
X-Git-Url: https://nos-oignons.net/gitweb/website.git/commitdiff_plain/f870fb24b8631170bcb76d4443b6dd5d0fb16c5b

Menu + amélioration responsive.
---

diff --git a/local.css b/local.css
index df8babb..4fc4a40 100644
--- a/local.css
+++ b/local.css
@@ -97,7 +97,7 @@ thead td {
 
 
 .body-wrapper > header {
-    padding: 1em 0;
+    padding: 2em 0;
     border-bottom: solid 1px #ccc;
 }
 @media screen and (min-width: 400px) {
@@ -106,6 +106,7 @@ thead td {
   }
 }
 
+
 #logo {
     display: block;
 	width: 394px; /* same as .pageheader .header:margin-left */
@@ -121,11 +122,14 @@ thead td {
 
 /* {{{ .actions */
 .actions {
-	font-size: 80%;
+	font-size: 0.8em;
 	text-align: right;
 }
 .actions ul {
+  margin: 0;
+  padding: 0.5em;
   height: auto;
+  list-style-type: none;
 }
 
 .breadcrumb,
@@ -153,6 +157,9 @@ thead td {
   float: right;
   font-size: 0.9em;
 }
+@media screen and (max-width: 400px) {
+#otherlanguages {float: none;}
+}
 #otherlanguages,
 #otherlanguages a {
 	color: #b3b3b3;
@@ -164,6 +171,8 @@ thead td {
 
 #otherlanguages ul {
   padding: 0;
+  margin: 0;
+  list-style: none;
 }
 #otherlanguages ul li {
 	/*margin-left: 1em;*/
@@ -216,17 +225,33 @@ main {
 	padding: 0.3em 0.5em;
 	text-decoration: none;
 	border: 1px solid #f5f5f5;
-	color: #a756af;
-	background: transparent;
-	font-weight: normal;
-	font-size: 100%;
+  color: #a756af;
+  background: transparent;
+  font-weight: normal;
+  font-size: 1em;
 }
 
 
 .menu a:hover {
-	color: #57075f;
-	background: #eeeeee;
-	text-decoration: none;
+  color: #57075f;
+  background: #eeeeee;
+  text-decoration: none;
+}
+
+.menu select {
+  margin: 0.5em 2%;
+  width: 94%;
+  max-width: 94%;
+  background: #fff;
+  border: 1px solid #ccc;
+	color: #57075F;
+  font-size: 1.2em;
+  display: none;
+}
+
+@media screen and (max-width: 45em) {
+  .js .menu ul {display: none;}
+  .js .menu select {display: block;}
 }
 
 
@@ -254,15 +279,20 @@ main hr {
 }
 
 main h1 {
-	font-size: 180%;
+	font-size: 1.8em;
 	font-weight: bold;
+  /*text-shadow: 2px 2px 1px #444;*/
+  color: #57075F;
+}
+main h1.title {
+  margin-top: 0em;
+  font-size: 2em;
 	color: #ffa430;
-	/*text-shadow: 2px 2px 1px #444;*/
 }
-main h1.title {margin-top: 0.5em;}
 
 main h2 {
-  color: #ffa430
+  /*color: #ffa430*/
+  color: #57075F;
 }
 main h3 {
   color: #57075F;
@@ -270,7 +300,7 @@ main h3 {
 
 main h2,
 main .header {
-	font-size: 140%;
+	font-size: 1.4em;
 	font-weight: bold;
 }
 
@@ -279,7 +309,7 @@ main h2 + p {
 }
 
 main h3 {
-	font-size: 120%;
+	font-size: 1.2em;
 	font-weight: bold;
 	margin-bottom: 0;
 	padding-bottom: 0;
@@ -334,7 +364,7 @@ main .feedlink {
 	min-height: 2.8em;
 }
 main .feedlink .feedbutton {
-	font-size: 80%;
+	font-size: 0.8em;
 	color: #57075f !important;
 	background: transparent;
 	border: none;
@@ -346,7 +376,7 @@ main .feedlink .feedbutton:hover {
 }
 
 main .footnotes {
-	font-size: 80%;
+	font-size: 0.8em;
 }
 
 .half-section {
@@ -537,7 +567,7 @@ main .footnotes {
 
 .inlinepage .inlineheader .pagedate {
 	margin-top: 0;
-	font-size: 80%;
+	font-size: 0.8em;
 	font-style: normal;
 	color: #666;
 }
@@ -552,6 +582,12 @@ main .footnotes {
 	color: white;
 	background: #57075f;
 }
+@media screen and (max-width: 400px) {
+  #footer {
+    font-size: 0.85em;
+    padding: 0.5em 1em;
+  }
+}
 #footer > div {
     margin-top: 1em;
 }
@@ -567,12 +603,12 @@ main .footnotes {
 }
 
 #backlinks {
-	font-size: 80%;
+	font-size: 0.8em;
 	margin-top: 0;
 }
 
 #footer #pageinfo div {
-	font-size: 80%;
+	font-size: 0.8em;
 	margin-top: 0;
 	margin-bottom: 0;
 }
diff --git a/scripts.js b/scripts.js
new file mode 100644
index 0000000..28f09b5
--- /dev/null
+++ b/scripts.js
@@ -0,0 +1,32 @@
+document.addEventListener("DOMContentLoaded", function() {
+
+    // Add JS class
+    document.querySelector('body').classList.add('js');
+
+    // Create the dropdown base
+    var select = document.createElement("select");
+
+    // Create default option "Go to..."
+    var opt = document.createElement("option")
+    opt.setAttribute("selected", "selected")
+    opt.setAttribute("value", "")
+    opt.innerHTML = "Aller à ...";
+    select.appendChild(opt);
+
+    // Populate dropdown with menu items
+    [].forEach.call(document.querySelectorAll('nav.menu a'), function(el) {
+        var opt = document.createElement("option");
+        opt.setAttribute("value", el.href)
+        opt.innerHTML = el.text;
+        select.appendChild(opt);
+    });
+
+    // To make dropdown actually work
+    // To make more unobtrusive: http://css-tricks.com/4064-unobtrusive-page-changer/
+    select.addEventListener('change', function(el) {
+      window.location = select.value
+    });
+
+    // Add select to menuWrapper
+    document.querySelectorAll('nav.menu')[0].appendChild(select);
+});
\ No newline at end of file
diff --git a/templates/page.tmpl b/templates/page.tmpl
index 5c185a0..d0fa2be 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -15,7 +15,7 @@
 <TMPL_IF FAVICON>
     <link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/x-icon" />
 </TMPL_IF>
-    <link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
+    <!-- <link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" /> -->
 <TMPL_IF LOCAL_CSS>
     <link rel="stylesheet" href="<TMPL_VAR BASEURL><TMPL_VAR LOCAL_CSS>" type="text/css" />
 <TMPL_ELSE>
@@ -214,5 +214,6 @@
     <!-- <TMPL_IF HTML5></article><TMPL_ELSE></div></TMPL_IF> -->
 
 </div><!-- body-wrapper -->
+<script src="<TMPL_VAR PREVURL>scripts.js"></script>
 </body>
 </html>