mirror of https://github.com/kc0bfv/ticky_tacky_dark.git

Karl
01.26.2020 71b93fb760c17d5f7b22f47c1b8b50c2b57c2165
layouts/partials/head.html
@@ -1,52 +1,41 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{- if isset .Params "description" -}} {{- $.Scratch.Set "description" .Params.description -}}
{{- else -}}
    {{- if isset .Site.Params "description" -}} {{- $.Scratch.Set "description" .Site.Params.description -}} {{- end -}}
{{- end }}
{{ with $.Scratch.Get "description" -}}<meta name="description" content="{{ . }}">{{- end }}
{{- if isset .Params "author" -}} {{- $.Scratch.Set "author" .Params.author -}}
{{- else -}}
    {{- if isset .Site.Params "author" -}} {{- $.Scratch.Set "author" .Site.Params.author -}} {{- end -}}
{{- end }}
{{ with $.Scratch.Get "author" -}}<meta name="author" content="{{ . }}">{{- end }}
<link rel="icon" href="{{ .Site.Params.favicon | relURL }}">
<title>{{ .Site.Title }}{{ with .Params.title }} - {{ . }}{{ end }}</title>
{{ with .Params.actualurl }}
{{ $description := .Params.description | default .Site.Params.description }}
{{- with $description }}<meta name="description" content="{{ . }}">{{ end }}
{{ $author := .Params.author.name | default .Site.Author.name }}
{{- with $author }}<meta name="author" content="{{ . }}">{{ end }}
<link rel="icon" href="{{ .Site.Params.favicon | relURL }}">
{{- template "_internal/opengraph.html" . }}
{{- template "_internal/twitter_cards.html" . }}
{{ with .Params.actualurl -}}
<meta http-equiv="refresh" content="0;URL='{{ . | relURL }}'" />
{{ end }}
<!-- SEO Prefs -->
{{- end }}
<meta name="robots" content="index,follow">
<meta name="referrer" content="origin-when-cross-origin">
{{ with .Site.Params.googlesiteverification }}<meta name="google-site-verification" content="{{ . }}">{{ end }}
{{ with .Site.Params.msvalidate }}<meta name="msvalidate.01" content="{{ . }}">{{ end }}
<!-- Site Generator -->
<meta name="generator" content="Hugo {{ hugo.Version }}">
<!-- Bootstrap CSS -->
{{ hugo.Generator }}
{{ with .OutputFormats.Get "RSS" }}
<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" />
<link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" />
{{ end }}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!--My CSS-->
<link rel="stylesheet" href="{{ "css/myscreen.css" | relURL }}" type="text/css" media="screen">
<link rel="stylesheet" href="{{ "css/myprint.css" | relURL }}" type="text/css" media="print">
<meta name="theme-color" content="black">
{{ template "_internal/google_analytics_async.html" . }}
{{- template "_internal/google_analytics_async.html" . }}
<noscript>
    <style>
        {{ with .Site.Params.headerimages }}
        {{ with .Site.Params.images }}
            #headerimg {
                background-image: url({{ index . 0 | safeURL | absURL }});
                background-size: cover;
            }
        {{ end }}
        {{ with .Params.sideimages }}
        {{ with .Params.images }}
            #sideimage {
                background-image: url({{ index . 0 | safeURL | absURL }});
                background-size: cover;
@@ -54,3 +43,62 @@
        {{ end }}
    </style>
</noscript>
<script>
    function toggleDisplay( elementID ) {
        elem = document.getElementById(elementID);
        if( elem.style.display == "none" ) {
            elem.style.display = "block";
        } else if( elem.style.display == "block" ) {
            elem.style.display = "none";
        }
    }
    {{ with .Site.Params.images }}
    function randomHeaderImg() {
        let images = [
            {{- $last_elem := sub (len .) 1 -}}
            {{ range $index, $component := . -}}
                {{ . | absURL }}{{ if lt $index $last_elem }},{{ end }}
            {{- end -}}
        ];
        let img_ind = Math.ceil(Math.random() * images.length) - 1;
        let sel_url = images[img_ind]
        let img = new Image();
        img.onload = function() {
            function set_img(old_onload) {
                let element = document.getElementById("headerimg");
                element.src = sel_url;
                if( old_onload ){ old_onload() }
            }
            if( document.readyState === "complete" ) { set_img() }
            else { window.onload = set_img(window.onload) }
        }
        img.src = sel_url;
    }
    randomHeaderImg();
    {{ end }}
    {{ with .Params.images }}
    function randomSideImg() {
        let images = [
            {{- $last_elem := sub (len .) 1 -}}
            {{ range $index, $component := . -}}
                {{ . | absURL }}{{ if lt $index $last_elem }},{{ end }}
            {{- end -}}
        ];
        let img_ind = Math.ceil(Math.random() * images.length) - 1;
        let sel_url = images[img_ind]
        let img = new Image();
        img.onload = function() {
            function set_img(old_onload) {
                let element = document.getElementById("sideimage");
                element.src = sel_url;
                if( old_onload ){ old_onload() }
            }
            if( document.readyState === "complete" ) { set_img() }
            else { window.onload = set_img(window.onload) }
        }
        img.src = sel_url;
    }
    randomSideImg();
    {{ end }}
</script>