hiding local edits when not file://
This commit is contained in:
parent
4f1871b5ec
commit
6bdd8f1b8b
4 changed files with 21 additions and 12 deletions
|
@ -877,6 +877,7 @@ details {
|
|||
}
|
||||
|
||||
.svedit {
|
||||
display: none;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,12 @@ window.addEventListener("keyup", (e)=> {
|
|||
})
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (e) => {
|
||||
if (location.protocol == "file:") {
|
||||
document.querySelectorAll(".svedit").forEach((i) => {
|
||||
i.style.display = "inline";
|
||||
})
|
||||
}
|
||||
|
||||
document.querySelectorAll('.triadlink').forEach((i) => {
|
||||
console.log(i)
|
||||
i.addEventListener("click", (ev) => {
|
||||
|
@ -94,15 +100,17 @@ window.addEventListener("DOMContentLoaded", (e) => {
|
|||
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
|
||||
);
|
||||
if (par) {
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
if (document.querySelector(".soundcite")) {
|
||||
let relPath = "../".repeat(relPathDepth - 1);
|
||||
|
|
|
@ -33,6 +33,6 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
{{ range $noTriad }}
|
||||
<div class="sitemap {{ with .File }}{{ if eq $currentDir .Dir }} highline{{ end }}{{ end }}"><a href="{{- .RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title }} title="{{- . -}}"{{- end -}}><span class="sup">{{- substr .File.Dir 0 -1 -}}⁄</span>{{- .Title -}}</a>{{ if not (or (hasPrefix .Dir "edit") (hasPrefix .Dir "print")) }}<a class="svedit" href="{{- printf "%sindex.html#%s" $editFilePath .File.UniqueID -}}">[EDIT]</a>{{ end }}</div>
|
||||
<div class="sitemap {{ with .File }}{{ if eq $currentDir .Dir }} highline{{ end }}{{ end }}"><a href="{{- .RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title }} title="{{- . -}}"{{- end -}}><span class="sup">{{- substr .File.Dir 0 -1 -}}⁄</span>{{- .Title -}}</a>{{ if not (or (hasPrefix .File.Dir "edit") (hasPrefix .File.Dir "print")) }}<a class="svedit" href="{{- printf "%sindex.html#%s" $editFilePath .File.UniqueID -}}">[EDIT]</a>{{ end }}</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
<link rel='stylesheet' href='build/global.css'>
|
||||
<link rel='stylesheet' href='build/bundle.css'>
|
||||
<!-- <link rel='stylesheet' href='build/bundle.css'> -->
|
||||
<script defer src='build/bundle.js'></script>
|
||||
<title>{{- .Title }} - {{ .Site.Title -}}</title>
|
||||
<title>edit⁄{{- .Site.Title -}}</title>
|
||||
</head>
|
||||
<body>{{- block "main" . -}}{{- end -}}</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Reference in a new issue