optimization pass
authorkengrimes <ken@kengrimes.com>
Wed, 11 Apr 2018 06:31:51 +0000 (23:31 -0700)
committerkengrimes <ken@kengrimes.com>
Wed, 11 Apr 2018 06:31:51 +0000 (23:31 -0700)
layouts/_default/baseof.html
layouts/_default/single.html
layouts/partials/speedycard.html
static/css/speedy.css
static/js/speedy.js

index 3f7a35d..96e0c13 100644 (file)
     <header>
       {{- $sp := .Site.GetPage "section" .Section }}
       {{- $sh := cond (or (not $sp.Params.header) (not (fileExists (printf "static/%s" $sp.Params.header)))) (cond (or (not .Site.Home.Params.header) (not (fileExists (printf "static/%s" .Site.Home.Params.header)))) "/img/speedy.png" .Site.Home.Params.header) $sp.Params.header }}
-      {{- $sc := cond (or (not $sp.Params.caption)) (cond (not .Site.Home.Params.caption) .Site.Title .Site.Home.Params.caption) $sp.Params.caption }}
       {{- $ph := cond (or (not .Params.header) (not (fileExists (printf "static/%s" .Params.header)))) $sh .Params.header }}
       <img src="{{ $ph }}">
       <div>
-        {{ $caption := cond (not .Params.caption) $sc .Params.caption }}
-        {{- if (eq (printf "%T" $caption) "string") }}
-        {{- $caption -}}
+        {{- if not .Page.Params.heading }}
+        {{ .Page.Title }}
+        {{- else if eq (printf "%T" .Page.Params.heading) "string" }}
+        {{ .Page.Params.heading }}
         {{- else }}
-        {{- index $caption 0 }}
-        {{- if (gt (len $caption) 1) }}
-        {{- range after 1 $caption -}}
+        {{- index .Page.Params.heading 0 }}
+        {{- if (gt (len .Page.Params.heading) 1) }}
+        {{- range after 1 .Page.Params.heading -}}
         <br>
         {{ . }}
         {{- end -}}
         {{- $pg := . }}
         {{- range .Site.Menus.main }}
         <a href="{{ absURL .URL }}">
-          <summary>{{ .Name }}</summary>
+          <summary>{{ .Title }}</summary>
           <svg{{- if or ($pg.InSection .Page) (eq .Page $pg) }} class="selected"{{ end }}>
-            <use xlink:href="{{ relURL `/img/nav.svg` | safeHTML }}#{{ .Name }}"/>
+            <use xlink:href="{{ relURL `/img/nav.svg` | safeHTML }}#{{ .Title }}"/>
           </svg>
         </a>
         {{- end }}
       </div>
       <footer>
-        {{ cond (not .Page.Title) .Page.Name .Page.Title }}
+        {{ cond (not $sp.Params.menu.main.title) $sp.Title $sp.Params.menu.main.title }}
       </footer>
     </nav>
     <main>
index 44a9d4a..24a73d4 100644 (file)
@@ -1,7 +1,7 @@
 {{- define "main" -}}
 {{- if (gt (len (findRE "<h1" .Content)) 0) }}
     <article>
-    {{ replaceRE "(<h1.*</h1>)" "</article>\n$1\n<article>" .Content | strings.TrimLeft "\n " | replaceRE "\n" "\n      " | safeHTML }}
+    {{ replaceRE "(<h1.*</h1>)" "</article>\n$1\n<article>" .Content | strings.TrimLeft "\n " | safeHTML }}
 {{- else -}}
     <article>
       {{ .Content | replaceRE "\n" "\n      " | safeHTML }}
index c4e0a42..44d3bff 100644 (file)
@@ -4,5 +4,19 @@
   <div style="font-size: 0.5em; float: right;">{{ .Params.categories }}</div>
   <div>{{ .PublishDate.Format "January 2 2006" }}</div>
   {{.Title}}
+  {{ if .Params.caption }}
+  {{- if (eq (printf "%T" .Params.caption) "string") }}
+  {{- .Params.caption -}}
+  {{- else }}
+  {{- index .Params.caption 0 }}
+  {{- if (gt (len .Params.caption) 1) }}
+  {{- range after 1 .Params.caption -}}
+  <br>
+  {{ . }}
+  {{- end -}}
+  {{- end -}}
+  {{- end }}
+  {{ else }}
   <div>{{ truncate 100 .Summary }}</div>
+  {{- end }}
 </a><br>
index 2be1306..a277f34 100644 (file)
@@ -40,8 +40,17 @@ h1 {
   font-size: 1.66em;
 }
 h2 {
+  text-align: center;
   text-decoration: underline;
-  font-size: 1.33em;
+  font-size: 1.48em;
+}
+h3 {
+  text-align: center;
+  font-size: 1.32em;
+}
+h4 {
+  text-align: center;
+  font-size: 1.24em;
 }
 body {
   margin: 0;
@@ -56,9 +65,9 @@ body > header {
 }
 body > main {
   margin: 0 1vw;
-  font-size: calc(10pt + 0.25vw); /* at least 60 chars wide */
-  /* font-size: 1.8rem; */
-  font-family: sans;
+  font-size: calc(11pt + 0.22vw);
+  font-family: sans-serif;
+  overflow: hidden;
 }
 body > footer {
   font-size: 0.8rem;
@@ -258,6 +267,33 @@ ul.pagination > li.disabled {
 .center {
   text-align: center;
 }
+.center-justify {
+  display: flex;
+  justify-content: center;
+}
+.float-right {
+  float: right;
+}
+.float-left {
+  float: left;
+}
+pre {
+  display: block;
+  border-radius: 3px;
+  background-color: white;
+  box-shadow: 1px 1px 1px black;
+}
+article > code,
+article > p > code,
+article > ol > li > code,
+article > ul > li > code {
+  border-radius: 3px;
+  background-color: white;
+  box-shadow: 1px 1px 1px black;
+}
+table {
+  display: block;
+}
 @media screen and (orientation:landscape) {
   body > main > article {
     margin: 1vh 1vw 1vw 1vh;
index 069b2d4..abd4d6f 100644 (file)
@@ -30,7 +30,7 @@ window.onload = () => {
   const navUp = () => nav.style.top = Math.min(parseInt(nav.style.top,10) + (oldScrollY - window.scrollY), 0) + 'px'
   const navDown = () => nav.style.top = Math.max(parseInt(nav.style.top,10) - (window.scrollY - oldScrollY), -nav.offsetHeight) + 'px'
   nav.style.top = 0 + 'px'
-  window.onscroll = () => {
+  const navUpdate = () => {
     if (window.matchMedia("(orientation: portrait)").matches) {
       if (window.scrollY < oldScrollY) /* up */ {
         if (upDelay-- <= 0)
@@ -46,7 +46,9 @@ window.onload = () => {
       }
       oldScrollY = window.scrollY
     }
+    window.requestAnimationFrame(navUpdate)
   }
+  navUpdate();
 }
   
 const resizeIFrame = (iframe) => {