various fixes
This commit is contained in:
parent
1fd9adcb52
commit
46bd223627
29 changed files with 6093 additions and 152 deletions
|
@ -7,58 +7,7 @@
|
|||
{{ define "main-type" }}{{ .Params.mainType }}{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
<script>
|
||||
// Source: https://css-tricks.com/the-complete-guide-to-lazy-loading-images/
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var lazyloadImages;
|
||||
|
||||
if ("IntersectionObserver" in window) {
|
||||
lazyloadImages = document.querySelectorAll(".lazy");
|
||||
var imageObserver = new IntersectionObserver(function(entries, observer) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.isIntersecting) {
|
||||
console.log("Ding");
|
||||
var image = entry.target;
|
||||
image.classList.remove("lazy");
|
||||
imageObserver.unobserve(image);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
lazyloadImages.forEach(function(image) {
|
||||
imageObserver.observe(image);
|
||||
});
|
||||
} else {
|
||||
var lazyloadThrottleTimeout;
|
||||
lazyloadImages = document.querySelectorAll(".lazy");
|
||||
|
||||
function lazyload () {
|
||||
if(lazyloadThrottleTimeout) {
|
||||
clearTimeout(lazyloadThrottleTimeout);
|
||||
}
|
||||
|
||||
lazyloadThrottleTimeout = setTimeout(function() {
|
||||
var scrollTop = window.pageYOffset;
|
||||
lazyloadImages.forEach(function(img) {
|
||||
if(img.offsetTop < (window.innerHeight + scrollTop)) {
|
||||
img.src = img.dataset.src;
|
||||
img.classList.remove('lazy');
|
||||
}
|
||||
});
|
||||
if(lazyloadImages.length == 0) {
|
||||
document.removeEventListener("scroll", lazyload);
|
||||
window.removeEventListener("resize", lazyload);
|
||||
window.removeEventListener("orientationChange", lazyload);
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
document.addEventListener("scroll", lazyload);
|
||||
window.addEventListener("resize", lazyload);
|
||||
window.addEventListener("orientationChange", lazyload);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="/js/lazy-images.js"></script>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-header" }}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
{{ define "header-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
<script id="Map-script" src="/js/leaflet.js"></script>
|
||||
<script id="Map-script" src="/js/leaflet/leaflet.js"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ with .Params.locations }}
|
||||
<link rel="stylesheet" href="/css/leaflet.css">
|
||||
<link rel="stylesheet" href="/css/leaflet/leaflet.css">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
@ -44,16 +44,9 @@
|
|||
if (map.getZoom() < 10) map.setZoom(10);
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ with .Params.scripts }}
|
||||
{{ if in . "mathjax" }}
|
||||
<script src="/js/polyfill.js"></script>
|
||||
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
|
||||
<script src="/js/mathjax/config.js"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if $.HasShortcode "chart" }}
|
||||
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
|
||||
<script id="Charts-script" src="/js/chart.js"></script>
|
||||
<script id="Charts-script" src="/js/chart/chart.js"></script>
|
||||
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}" integrity="{{ $chartsConfigJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -130,11 +123,11 @@
|
|||
{{ end }}
|
||||
</div>
|
||||
|
||||
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .FuzzyWordCount | lang.NumFmt 0 }}</span> words</p>
|
||||
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .FuzzyWordCount | lang.FormatNumberCustom 0 }}</span> words</p>
|
||||
|
||||
<p class="article-header__publish-date">Published: <time class="dt-published" datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}" itemprop="datePublished">{{ .PublishDate.Format "January 2" }}<sup>{{ if in (slice 1 21 31) .PublishDate.Day}}st{{ else if in (slice 2 22) .PublishDate.Day}}nd{{ else if in (slice 3 23) .PublishDate.Day}}rd{{ else }}th{{ end }}</sup>, 1{{ .PublishDate.Format "2006" | lang.NumFmt 0 }} <abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time></p>
|
||||
<p class="article-header__publish-date">Published: <time class="dt-published" datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}" itemprop="datePublished">{{ .PublishDate.Format "January 2" }}<sup>{{ if in (slice 1 21 31) .PublishDate.Day}}st{{ else if in (slice 2 22) .PublishDate.Day}}nd{{ else if in (slice 3 23) .PublishDate.Day}}rd{{ else }}th{{ end }}</sup>, 1{{ .PublishDate.Format "2006" | lang.FormatNumberCustom 0 }} <abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time></p>
|
||||
|
||||
<p class="article-header__modified-date">Last modified: <time class="dt-updated" datetime="{{ .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}" itemprop="dateModified">{{ .Lastmod.Format "January 2" }}<sup>{{ if in (slice 1 21 31) .Lastmod.Day}}st{{ else if in (slice 2 22) .Lastmod.Day}}nd{{ else if in (slice 3 23) .Lastmod.Day}}rd{{ else }}th{{ end }}</sup>, 1{{ .Lastmod.Format "2006" | lang.NumFmt 0 }} <abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time></p>
|
||||
<p class="article-header__modified-date">Last modified: <time class="dt-updated" datetime="{{ .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}" itemprop="dateModified">{{ .Lastmod.Format "January 2" }}<sup>{{ if in (slice 1 21 31) .Lastmod.Day}}st{{ else if in (slice 2 22) .Lastmod.Day}}nd{{ else if in (slice 3 23) .Lastmod.Day}}rd{{ else }}th{{ end }}</sup>, 1{{ .Lastmod.Format "2006" | lang.FormatNumberCustom 0 }} <abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time></p>
|
||||
|
||||
<p style="display: none">Author{{ with .Params.authors }}s{{ end }}:
|
||||
{{- with .Params.authors -}}
|
||||
|
@ -216,9 +209,9 @@
|
|||
<ul>
|
||||
{{- range . -}}
|
||||
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
|
||||
<li><a class="button" href="{{ .link }}">{{ .title | safeHTML }}</a></li>
|
||||
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
|
||||
{{ else }}
|
||||
<li><a class="button" href="{{ . }}">Link</a></li>
|
||||
<li><a href="{{ . }}">Link</a></li>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
|
@ -229,9 +222,9 @@
|
|||
<ul>
|
||||
{{- range . -}}
|
||||
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
|
||||
<li><a class="button" href="{{ .link }}">{{ .title | safeHTML }}</a></li>
|
||||
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
|
||||
{{ else }}
|
||||
<li><a class="button" href="{{ . }}">Link</a></li>
|
||||
<li><a href="{{ . }}">Link</a></li>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue