From 69359f938bb730d9c221661200bcffd5041f8a19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pontus=20=C3=96stlund?= <ponost@roxen.com>
Date: Fri, 9 Dec 2016 00:55:01 +0100
Subject: [PATCH] Fixed the bug (I think) that didn't print out the Pike
 version and extraction date in the refdoc when Tools.AutoDoc.FLAG_NO_DYNAMIC
 is set.

E.g. fixes the refdoc on the Pike site.

Did some more aesthetical fixes to the refdoc, mainly for mobiles.
---
 .../autodoc_to_split_html.pike                |  2 +-
 refdoc/structure/modref.css                   | 73 +++++++++++++++++--
 refdoc/structure/modref.js                    | 57 +++++++++++++++
 3 files changed, 123 insertions(+), 9 deletions(-)

diff --git a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike
index 37420a4a3d..f8b1b633d8 100644
--- a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike
+++ b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike
@@ -1525,7 +1525,7 @@ int low_main(string doc_file, string template_file, string outdir,
                           "$version$":"",
                           "$date$":"",
                           "$generated$":"",
-                          "$nodynamic$":""
+                          "$nodynamic$":"<script>PikeDoc.NO_DYNAMIC = true;</script>"
                        ]) );
   } else {
     template = replace(template,
diff --git a/refdoc/structure/modref.css b/refdoc/structure/modref.css
index e6e1962b9e..7d78a0cba9 100644
--- a/refdoc/structure/modref.css
+++ b/refdoc/structure/modref.css
@@ -270,7 +270,7 @@ em {
 	opacity: 0;
 }
 
-.navbar .sidebar a { display: block; text-decoration: none; }
+.navbar .sidebar a { display: block; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
 
 .sidebar a.mod-protected {
 	color: #999;
@@ -402,7 +402,7 @@ hr {
 
 h1, h2, h3, h4 {
 	color: #323232;
-	line-height: 1;
+	line-height: 1.1;
 }
 
 h1 {
@@ -560,7 +560,56 @@ pre code .nested:hover { opacity: 1; }
 	}
 }
 
-@media screen and (max-width: 800px) {
+@media screen and (max-width: 767px) {
+	.sidebar {
+		opacity: 1;
+	}
+
+	// .sidebar {
+	// 	display: none;
+	// }
+	// .sidebar.open {
+	// 	display: block;
+	// }
+
+	.sidebar > div {
+		columns: 3;
+	}
+
+	// .navbar .head {
+	// 	display: block;
+	// 	vertical-align: middle;
+	// }
+	// .navbar .head:hover {
+	// 	background: #4c4c4c;
+	// 	border-left-color: #3c3c3c;
+	// }
+	// .navbar .head:before {
+	// 	content: '+';
+	// 	display: inline-block;
+	// 	background: #666;
+	// 	border-radius: 16px;
+	// 	color: #333;
+	// 	width: 19px;
+	// 	height: 19px;
+	// 	padding: 0px 5px 0px 5px;
+	// 	margin-right: 8px;
+	// 	// vertical-align: middle;
+	// 	transition: background .2s ease-out;
+	// }
+	// .navbar .head.open:before {
+	// 	background: #999;
+	// }
+	// .navbar .head.top:before {
+	// 	content: '';
+	// 	display: inline;
+	// 	background: transparent;
+	// 	margin: 0;
+	// 	padding: 0;
+	// 	width: inital;
+	// 	height: initial;
+	// }
+
 	.content {
 		width: 100%;
 		float: none;
@@ -623,10 +672,10 @@ pre code .nested:hover { opacity: 1; }
 		margin-top: 5px;
 	}
 
-	header a {
+	body header a {
+		display: block;
 		height: 26px;
-		width: 120px;
-		transition: transform .3s ease-in;
+		transition: all .3s ease-in;
 	}
 
 	body.scrolled {
@@ -635,11 +684,12 @@ pre code .nested:hover { opacity: 1; }
 
 	body.scrolled header {
 		box-shadow: 0px 1px 5px 0px rgba(0,0,0,.4);
-		padding: 0px 20px;
+		padding: 1px 20px;
 	}
 
 	body.scrolled header a {
-		transform: scale(.9);
+		// transform: scale(.8);
+		height: 22px;
 	}
 
 	.menu-open {
@@ -720,6 +770,13 @@ pre code .nested:hover { opacity: 1; }
 	}
 }
 
+/* iPhone 6 and smaller */
+@media screen and (max-width: 414px) {
+	.sidebar > div {
+		columns: 2;
+	}
+}
+
 @media screen and (max-width: 600px) {
 	.traditional {
 		padding: 10px;
diff --git a/refdoc/structure/modref.js b/refdoc/structure/modref.js
index d644339c59..209a21c560 100644
--- a/refdoc/structure/modref.js
+++ b/refdoc/structure/modref.js
@@ -152,12 +152,69 @@ function onBurgerClick() {
   return false;
 }
 
+// function nextElem(node, type) {
+//   var n = node.nextSibling;
+
+//   if (!n) {
+//     return null;
+//   }
+
+//   if (type) {
+//     if (type[1] === '.') {
+//       while (n && !n.classList.contains(type)) {
+//         n = n.nextSibling;
+//       }
+//     }
+//     else if (type[1] === '#') {
+//       while (n && n.getAttribute('id') !== type) {
+//         n = n.nextSibling;
+//       }
+//     }
+//     else {
+//       while (n  && n.nodeName.toLowerCase() !== type) {
+//         n = n.nextSibling;
+//       }
+//     }
+//   }
+//   else {
+//     while (n && n.nodeType !== 1) {
+//       n = n.nextSibling;
+//     }
+//   }
+
+//   return n;
+// }
+
+// function onNavbarHeadClick(e) {
+//   e.stopPropagation();
+//   e.preventDefault();
+
+//   var x = this;
+
+//   if (this.parentNode.nodeName === 'A') {
+//     x = this.parentNode;
+//   }
+
+//   var nb = nextElem(x, 'div');
+//   if (nb) {
+//     this.classList.toggle('open');
+//     nb.classList.toggle('open');
+//   }
+// }
+
 function setMobileMode() {
   document.removeEventListener('scroll', onPageScroll);
   document.addEventListener('scroll', onMobilePageScroll, false);
   burger.removeEventListener('click', onBurgerClick);
   burger.addEventListener('click', onBurgerClick, false);
   navbar.classList.remove('sticky');
+  // navbar.querySelectorAll('b.head').forEach(function(el) {
+  //   if (el.classList.contains('top')) {
+  //     return;
+  //   }
+
+  //   el.addEventListener('click', onNavbarHeadClick, false);
+  // });
   iAmSticky = false;
 }
 
-- 
GitLab