let's try !publish!

This commit is contained in:
Marcell Mars 2020-12-19 00:23:52 +01:00
parent 676f232539
commit ee16267b90
19 changed files with 642 additions and 574 deletions

View file

@ -307,6 +307,10 @@ body {
color: black;
}
#preview {
display: none;
}
sup,
sub {
vertical-align: baseline;

View file

@ -1,83 +1,115 @@
window.addEventListener('scroll', function(e) {
if (document.querySelector('body').clientWidth > 767) {
let rightcolumn = document.querySelector('.rightcolumn');
let mantletitle = document.querySelector('.mantletitle') || document.querySelector('.crusttitle') || false;
window.addEventListener("scroll", function (e) {
if (document.querySelector("body").clientWidth > 767) {
let rightcolumn = document.querySelector(".rightcolumn");
let mantletitle =
document.querySelector(".mantletitle") ||
document.querySelector(".crusttitle") ||
false;
if (!mantletitle) {
return
return;
}
let mantlebar = document.querySelector('.mantlebar')
let grid = document.querySelector('.grid')
let mantlebar = document.querySelector(".mantlebar");
let grid = document.querySelector(".grid");
let gridrect = mantletitle.getBoundingClientRect();
if ((document.querySelector('body').clientHeight - (grid.clientHeight + mantletitle.clientHeight + 32)) < window.innerHeight) {
return
if (
document.querySelector("body").clientHeight -
(grid.clientHeight + mantletitle.clientHeight + 32) <
window.innerHeight
) {
return;
}
if (gridrect.top < 20 && !grid.classList.contains('moved')) {
grid.classList.add('moved');
if (gridrect.top < 20 && !grid.classList.contains("moved")) {
grid.classList.add("moved");
mantlebar.style.display = "inline";
mantletitle.style.visibility = "hidden";
} else if (gridrect.top > 21 && grid.classList.contains('moved')) {
grid.classList.remove('moved');
} else if (gridrect.top > 21 && grid.classList.contains("moved")) {
grid.classList.remove("moved");
mantletitle.style.visibility = "visible";
mantlebar.style.display = "none";
}
} else {
let rightcolumn = document.querySelector('.rightcolumn');
let mantletitle = document.querySelector('.mantletitle') || document.querySelector('.crusttitle') || false;
let rightcolumn = document.querySelector(".rightcolumn");
let mantletitle =
document.querySelector(".mantletitle") ||
document.querySelector(".crusttitle") ||
false;
if (!mantletitle) {
return
return;
}
let mantlebar = document.querySelector('.mantlebar')
let grid = document.querySelector('.grid')
let mantlebar = document.querySelector(".mantlebar");
let grid = document.querySelector(".grid");
let gridrect = mantletitle.getBoundingClientRect();
if (gridrect.top < 20 && !grid.classList.contains('moved')) {
grid.classList.add('moved');
if (gridrect.top < 20 && !grid.classList.contains("moved")) {
grid.classList.add("moved");
mantlebar.style.display = "inline";
mantletitle.style.visibility = "hidden";
} else if (gridrect.top > 21 && grid.classList.contains('moved')) {
grid.classList.remove('moved');
} else if (gridrect.top > 21 && grid.classList.contains("moved")) {
grid.classList.remove("moved");
mantletitle.style.visibility = "visible";
mantlebar.style.display = "none";
}
}
})
});
window.addEventListener('DOMContentLoaded', (e) => {
let par = document.querySelector("#TableOfContents > ol:first-child > li:first-child");
window.addEventListener("DOMContentLoaded", (e) => {
let preview = document.querySelector("#preview");
if (
location.pathname.split("/").includes("_preview") ||
location.hash.startsWith("#/_edit")
) {
preview.style.display = "flex";
}
let par = document.querySelector(
"#TableOfContents > ol:first-child > li:first-child"
);
let s = document.createElement("span");
s.appendChild(par.cloneNode(true))
par.remove()
document.querySelector("#TableOfContents > ol:first-child").insertBefore(s, document.querySelector("#TableOfContents > ol:first-child").firstChild)
s.appendChild(par.cloneNode(true));
par.remove();
document
.querySelector("#TableOfContents > ol:first-child")
.insertBefore(
s,
document.querySelector("#TableOfContents > ol:first-child").firstChild
);
if (document.querySelector(".soundcite")) {
let relPath = "../".repeat(relPathDepth - 1);
var popcorn = document.createElement('script');
var popcorn = document.createElement("script");
popcorn.src = `${relPath}js/popcorn.min.js`;
document.body.appendChild(popcorn);
var soundcite = document.createElement('script');
var soundcite = document.createElement("script");
soundcite.src = `${relPath}js/soundcite.min.js`;
document.body.appendChild(soundcite);
}
document.querySelectorAll('#TableOfContents a, .anchorz, .footnote-backref, .footnote-ref').forEach(i => {
i.addEventListener('click', e => {
document
.querySelectorAll(
"#TableOfContents a, .anchorz, .footnote-backref, .footnote-ref"
)
.forEach((i) => {
i.addEventListener("click", (e) => {
setTimeout(() => {
window.scrollBy({top: document.querySelector('.header').clientHeight * -1.25, behavior: 'smooth'})}, 50);
})
})
})
window.scrollBy({
top: document.querySelector(".header").clientHeight * -1.25,
behavior: "smooth",
});
}, 50);
});
});
});
toggleAllLinks = function () {
document.querySelectorAll('details').forEach(i => {
document.querySelectorAll("details").forEach((i) => {
if (i.open) {
i.removeAttribute('open');
i.removeAttribute("open");
} else {
i.setAttribute('open', true);
}
})
i.setAttribute("open", true);
}
});
};

View file

@ -1,6 +1,5 @@
{{ define "singlebody" }}
{{ $currentNode := . }}
{{ $currentDir := "" }}
{{ with .File }}

View file

@ -1,11 +1,6 @@
{{- define "singlebody" -}}
{{- partialCached "header.html" . .RelPermalink -}}
<h1>{{ .Title }}</h1>
{{- partialCached "singlebody.html" . .RelPermalink -}}
<div class="content">{{ .Content }}</div>
{{- end -}}

View file

@ -6,9 +6,11 @@
{{ if .Description }}
<meta name="description" content="{{ .Description }}" />
{{ end }}
{{ if .Keywords }}
<meta name="keywords" content="{{ delimit .Keywords "," }}" />
{{ end }}
{{ if .Params.Author }}
<meta name="author" content="{{ .Params.Author}}" />
{{ end }}

View file

@ -26,8 +26,8 @@
{{ $is_in_is_in = $is_in_is_in | append ($.GetPage .) }}
{{ end }}
{{ if eq hugo.Environment "preview" }}
<div class="headiter">
{{ if eq hugo.Environment "gitea" }}
<div class="headiter" id="preview">
<a class="edit-button" target="_blank" href="{{ $.Site.Params.sandpointsGiteaUrl }}/_edit/master/content/{{ .File }}">EDIT_THIS</a>
{{ with $scratch.core }}<a class="edit-button" target="_blank" href="{{ $.Site.Params.sandpointsGiteaUrl }}/_new/master/content/{{ index . 0 }}/">ADD_{{ index . 0 | upper }}</a>{{ end }}
{{ with $scratch.mantle }}<a class="edit-button" target="_blank" href="{{ $.Site.Params.sandpointsGiteaUrl }}/_new/master/content/{{ index . 0 }}/">ADD_{{ index . 0 | upper }}</a>{{ end }}

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{- else -}}en-us{{- end -}}">
<head>
{{- partialCached "head.html" . -}}
{{- partial "pagedjs.html" . -}}
</head>
<body>
<article>
{{- block "singlebody" . -}}{{- end -}}
</article>
</body>
</html>

View file

@ -0,0 +1,24 @@
{{- define "singlebody" -}}
{{ $s := partialCached "scratch.html" . }}
{{ $p := $.GetPage .Params.print }}
{{ $scratch := $s.Get (printf "/%s" $p.File) }}
{{ $currentDir := "" }}
{{ with .File }}
{{ $currentDir = .Dir }}
{{ end }}
<div class="print0">{{ partial "singlebody.html" $p }}</div>
<div class="content">{{ $p.Content }}
{{ range $printPage := $scratch.has_cildren }}
<div class="print1">{{ partial "singlebody.html" $printPage }}</div>
<div class="content">{{ $printPage.Content }}
{{ $printPageScratch := $s.Get (printf "/%s" $printPage.File) }}
{{ range $printPageKid := $printPageScratch.has_children }}
<div class="print2">{{ partial "singlebody.html" $printPageKid }}</div>
<div class="content">{{ $printPageKid.Content }}
{{ . }}
{{ end }}
</div>
{{ end }}
{{- end -}}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
# git.sandpoints.org/Drawwell/SandpointsTheme v0.0.0-20201214030348-c507484d5529
# git.sandpoints.org/Drawwell/SandpointsTheme v0.0.0-20201218222521-33a423ebe113