Merge branch 'holy-grail' into svg-fix

This commit is contained in:
y1450 2022-07-12 10:28:45 +02:00 committed by GitHub
commit a361a1005e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 78 additions and 21988 deletions

View File

@ -1,101 +0,0 @@
async function drawTree(pathBase){
// async function drawTree(){
const { content } = await fetchData;
// COMMENT : add a uid for pages and folders id ? will avoid problems if duplicates in page name and folder name
// we want to build an array of objects, one for each page and folder (type)
const tree = [];
for (let path in content) {
const c = content[path];
const pageTitle = c.title;
const crumb = path.split("/");
// ['', 'folder1','folder2', ... , pageId ]
let pageId = crumb.pop();
if (pageId == '') pageId = '_ROOT_';
let parentFolderId = crumb.slice(-1)[0];
if (parentFolderId == '' && pageId == '_ROOT_') parentFolderId = 'SUPER-ROOT';
if (parentFolderId == '') parentFolderId = 'ROOT';
parentFolderId = '_' + parentFolderId + '_'; // added to distinguished from pageId
// we found a page
tree.push({
id: pageId,
parentId: parentFolderId,
name: pageTitle,
text: pageTitle,
type: 'page',
a_attr : {href : pathBase.slice(0, pathBase.length - 1) + path} ,
href: pathBase.slice(0, pathBase.length - 1) + path
})
// if the page is in one or more folders
crumb.forEach((folderId, level) => {
let parentId = crumb[level - 1];
if (parentId == '') {
parentId = '_ROOT_'
} else {
parentId = '_' + parentId + '_';
}
// we found a folder
const push = {
id: '_' + folderId + '_',
parentId: parentId,
name: folderId.replace(/-/g, ' '),
text: folderId.replace(/-/g, ' '),
type: 'folder',
// type : Tree.FOLDER,
level: level
}
// avoid duplicates of folders
if (folderId != '' && !tree.some(el => JSON.stringify(el) === JSON.stringify(push)))
tree.push(push);
});
}
// METHODE 1
// FYI https://www.jstree.com/docs/json/ doesn't need a hierarchial JSON
// it needs jQuery though. Not used for the moment
//METHODE 2
// build the hierarchial JSON
// from https://typeofnan.dev/an-easy-way-to-build-a-tree-with-object-references/
let root;
const idMapping = tree.reduce((acc, el, i) => {
acc[el.id] = i;
return acc;
}, {});
tree.forEach((el) => {
// Handle the root element
if (el.parentId == '_SUPER-ROOT_') {
root = el;
return;
}
// Use our mapping to locate the parent element in our data array
const parentEl = tree[idMapping[el.parentId]];
// Add our current el to its parent's `children` array
parentEl.children = [...(parentEl.children || []), el];
});
const structure = root.children;
$(function () {
$('#jstree')
.on('click', function (e) {
$('#jstree').jstree(true).toggle_node(e.target);
})
.jstree({
core : {
dblclick_toggle : false,
'data' : structure},
"plugins" : [ "wholerow" ]
});
});
}

10881
assets/js/jquery.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -165,7 +165,7 @@ td, th {
}
}
article {
article, .tree{
& > .meta {
margin: -1.5em 0 1em 0;
opacity: 0.7;
@ -313,6 +313,13 @@ hr {
// padding: 25px 5vw;
// }
}
.singlePage-oldLayout {
padding: 4em 30vw;
@media all and (max-width: 1200px) {
padding: 25px 5vw;
}
}
.page-end {
display: flex;

View File

@ -16,14 +16,30 @@ div.sticky {
}
.tree summary {
color: #6b879a;
position: relative;
left: -1em;
margin-top: 0.2em;
}
.tree details {
margin-bottom: 0.3em;
}
.tree a{
font-weight:unset;
color: black;
// font-weight:unset;
// color: black;
font-weight: 600;
// font-size: 0.9rem;
}
a.active{
color: #f28482;
// color: #f28482;
// margin: 0.5em 0;
padding: 0.2em 0.5em ;
// padding: 0.25em 1em;
position: relative;
left: -0.5em;
border: var(--outlinegray) 1px solid;
border-radius: 5px
}
/* The Modal (background) */
.modal {

View File

@ -22,4 +22,4 @@
--gray: #d4d4d4 !important;
--lightgray: #292633 !important;
--outlinegray: #343434 !important;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3
content/notes/_index.md Normal file
View File

@ -0,0 +1,3 @@
---
title: Notes
---

View File

@ -0,0 +1,3 @@
---
title: Nice Folder Title 1
---

View File

@ -1,4 +1,3 @@
---
title: Folder Title 2
title: Nice Folder Title 2
---
test

View File

@ -1,5 +1,5 @@
---
title: test_page_2
title: Test Page 1
---
test

View File

@ -1,5 +1,5 @@
---
title: test_page_20
title: Test Page 2
---
test

View File

@ -1,4 +1,4 @@
---
title: test_page_21
title: Test Page 3
---
test

View File

@ -1,4 +1,4 @@
---
title: test_page_22
title: Test Page 4
---
test

View File

@ -1,5 +1,5 @@
---
title: test_page_1
title: Test Page 01
---
test

View File

@ -1,4 +1,4 @@
---
title: test_page_10
title: Test Page 02
---
test

View File

@ -1,4 +1,4 @@
---
title: test_page_11
title: Test Page 03
---
test

View File

@ -9,7 +9,7 @@
<r-c join>
<main data-lg1-2 data-lg2 data-m2 data-sm1 data-xs1>
{{else}}
<main >
<main class="singlePage-oldLayout">
{{end}}
<!-- Begin actual content -->
@ -51,7 +51,7 @@
{{if $.Site.Data.config.enableColumnLayout}}
<aside data-sm1-2 data-md1-2 data-lg1-4 data-lg1 data-m1 data-sm2 data-xs3>
<div class="sticky page-end vertical">
<h3> Menu hugo</h3>
<h3> Menu</h3>
<div class="menu-toc">
<ol class="tree">
{{partial "menu-hugo.html" .}}

View File

@ -7,10 +7,10 @@
{{if $.Site.Data.config.enableColumnLayout}}
<r-c join>
<main data-lg1-2 data-lg2 data-m2 data-sm1 data-xs1 >
{{else}}
<main>
{{end}}
<main data-lg1-2 data-lg2 data-m2 data-sm1 data-xs1>
{{else}}
<main class="singlePage-oldLayout">
{{end}}
<!-- Begin actual content -->
<header>
@ -42,37 +42,37 @@
</main>
{{if $.Site.Data.config.enableColumnLayout}}
<aside data-sm1-2 data-md1-2 data-lg1-4 data-lg1 data-m1 data-sm2 data-xs3>
<div class="sticky page-end vertical">
<h3> Menu hugo</h3>
<div class="menu-toc">
<ol class="tree">
{{partial "menu-hugo.html" .}}
</ol>
</div>
<aside data-sm1-2 data-md1-2 data-lg1-4 data-lg1 data-m1 data-sm2 data-xs3>
<div class="sticky page-end vertical">
<h3> Menu</h3>
<div class="menu-toc">
<ol class="tree">
{{partial "menu-hugo.html" .}}
</ol>
</div>
</aside>
<aside data-sm1-2 data-md1-2 data-lg1-4 data-lg3 data-m3 data-sm3 data-xs2>
<div class="sticky">
<div class="page-end vertical">
<button id="myBtn">Open Modal</button>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<div id="graph-container-modal"></div>
</div>
</div>
</aside>
<aside data-sm1-2 data-md1-2 data-lg1-4 data-lg3 data-m3 data-sm3 data-xs2>
<div class="sticky">
<div class="page-end vertical">
<button id="myBtn">Open Modal</button>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<div id="graph-container-modal"></div>
</div>
</div>
{{partial "footer.html" .}}
</div>
</aside>
</r-c>
<footer data-r-c data-join>
<c1-1>
{{partial "contact.html" .}}
</c1-1>
</footer>
{{end}}
{{partial "footer.html" .}}
</div>
</aside>
</r-c>
<footer data-r-c data-join>
<c1-1>
{{partial "contact.html" .}}
</c1-1>
</footer>
{{end}}
</body>

View File

@ -59,18 +59,6 @@
<script src="{{$clipboard.Permalink}}"></script>
{{ end }}
<!-- columns layout scripts -->
{{ if $.Site.Data.config.enableColumnLayout }}
{{ $drawTree := resources.Get "js/drawTree.js" | resources.Fingerprint "md5" | resources.Minify }}
<script src="{{$drawTree.Permalink}}"></script>
{{ $jquery := resources.Get "js/jquery.js" | resources.Fingerprint "md5" | resources.Minify }}
<script src="{{$jquery.Permalink}}"></script>
{{ $jstree := resources.Get "js/jstree.js" | resources.Fingerprint "md5" | resources.Minify }}
<script src="{{$jstree.Permalink}}"></script>
{{ end }}
<!-- Preload page vars -->
{{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint
"md5" | resources.Minify | }} {{$contentIndex := resources.Get
@ -126,16 +114,13 @@
);
{{end}}
// draw graph in hidden // not working
{{if $.Site.Data.config.enableColumnLayout}}
const containerModal = document.getElementById("graph-container-modal")
// retry if the graph is not ready
if (!containerModal) return requestAnimationFrame(render)
// clear the graph in case there is anything within it
containerModal.textContent = ""
drawGraph(
{{strings.TrimRight "/" .Site.BaseURL}},
true,
@ -144,6 +129,7 @@
true
);
{{end}}
{{if $.Site.Data.config.enableLinkPreview}}
initPopover(
@ -182,11 +168,6 @@
{{end}}
{{if $.Site.Data.config.enableColumnLayout}}
const siteBaseURL = new URL(BASE_URL);
const pathBase = siteBaseURL.pathname;
drawTree(pathBase)
// Get the modal
var modal = document.getElementById("myModal");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB