From 0b6711c2185abbde7e95125b672ee8b5d827cb8b Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 14 May 2022 16:47:50 -0400 Subject: [PATCH 01/27] fix: tag boxes overlapping for content with many tags (closes #130) --- assets/styles/base.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/styles/base.scss b/assets/styles/base.scss index 1b9b936e3..de866fdbb 100644 --- a/assets/styles/base.scss +++ b/assets/styles/base.scss @@ -186,6 +186,7 @@ article { & > li { display: inline-block; + margin: 0.4em 0; } & > li > a { border-radius: 8px; From 0439c163a03fc50487fbe1cbfc09dc38af7ed2f2 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 20 May 2022 16:50:56 -0400 Subject: [PATCH 02/27] fix: js not executing if spa disabled --- layouts/partials/head.html | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a5f23da30..a49800be5 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -61,13 +61,7 @@ links, content, })) - - {{if $.Site.Data.config.enableSPA}} - {{ $router := resources.Get "js/router.js" | resources.Fingerprint "md5" | - resources.Minify }} - + {{if $.Site.Data.config.enableSPA}} + {{ $router := resources.Get "js/router.js" | resources.Fingerprint "md5" | + resources.Minify }} + {{else}} - + {{end}} {{ template "_internal/google_analytics.html" . }} From 0293c122177bf8c595cda8b4dfb513d90b1e6b03 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Mon, 23 May 2022 22:25:13 -0700 Subject: [PATCH 03/27] feat: recent posts section/partial --- assets/styles/base.scss | 61 +++++++++++++++++---------------- data/config.yaml | 1 + layouts/index.html | 3 ++ layouts/partials/page-list.html | 6 ++++ layouts/partials/recent.html | 12 +++++++ 5 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 layouts/partials/recent.html diff --git a/assets/styles/base.scss b/assets/styles/base.scss index de866fdbb..1c353f338 100644 --- a/assets/styles/base.scss +++ b/assets/styles/base.scss @@ -171,35 +171,6 @@ article { opacity: 0.7; } - & > .tags { - list-style: none; - padding-left: 0; - - & .meta { - & > h1 { - margin: 0; - } - & > p { - margin: 0; - } - } - - & > li { - display: inline-block; - margin: 0.4em 0; - } - & > li > a { - border-radius: 8px; - border: var(--outlinegray) 1px solid; - padding: 0.2em 0.5em; - &::before { - content: "#"; - margin-right: 0.3em; - color: var(--outlinegray); - } - } - } - & a { font-family: Source Sans Pro; font-weight: 600; @@ -223,6 +194,36 @@ article { } } +.tags { + list-style: none; + padding-left: 0; + + & .meta { + & > h1 { + margin: 0; + } + & > p { + margin: 0; + } + } + + & > li { + display: inline-block; + margin: 0.4em 0; + } + + & > li > a { + border-radius: 8px; + border: var(--outlinegray) 1px solid; + padding: 0.2em 0.5em; + &::before { + content: "#"; + margin-right: 0.3em; + color: var(--outlinegray); + } + } +} + .backlinks a { font-weight: 600; font-size: 0.9rem; @@ -590,3 +591,5 @@ header { padding: 0 1em; } } + + diff --git a/data/config.yaml b/data/config.yaml index 2b606e74e..b79ad5721 100644 --- a/data/config.yaml +++ b/data/config.yaml @@ -5,6 +5,7 @@ enableLinkPreview: true enableLatex: true enableSPA: true enableContextualBacklinks: true +enableRecentNotes: false description: Host your second brain and digital garden for free. Quartz features extremely fast full-text search, Wikilink support, backlinks, local graph, tags, and link previews. diff --git a/layouts/index.html b/layouts/index.html index 224c99784..8d1ffbd4f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -15,6 +15,9 @@
{{partial "toc.html" .}} {{partial "textprocessing.html" . }} + {{if $.Site.Data.config.enableRecentNotes}} + {{partial "recent.html" . }} + {{end}}
{{partial "footer.html" .}} diff --git a/layouts/partials/page-list.html b/layouts/partials/page-list.html index 6c2249baf..e51c5ddab 100644 --- a/layouts/partials/page-list.html +++ b/layouts/partials/page-list.html @@ -4,11 +4,17 @@

{{- .Title -}}

+

{{- .Summary -}}{{if .Truncated}}...{{end}}

{{ .ReadingTime }} minute read. Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}

+
{{- end -}} diff --git a/layouts/partials/recent.html b/layouts/partials/recent.html new file mode 100644 index 000000000..e3926c243 --- /dev/null +++ b/layouts/partials/recent.html @@ -0,0 +1,12 @@ +
+

Recent Notes

+ + {{$notes := .Site.RegularPages}} + {{partial "page-list.html" (first 3 $notes)}} +
+ From bd316d8249f096c4d5616d682f142f49d4ca914f Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 08:39:44 -0700 Subject: [PATCH 04/27] Bump million to 1.9.2 --- assets/js/router.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/assets/js/router.js b/assets/js/router.js index 81c25ac1c..b70aac2d6 100644 --- a/assets/js/router.js +++ b/assets/js/router.js @@ -1,12 +1,16 @@ -import { router, navigate } from "https://unpkg.com/million@1.8.9-0/dist/router.mjs" +import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.2/dist/router.mjs" export const attachSPARouting = (draw) => { - // SPA navigation for access later - window.navigate = navigate - // We only mutate document.title and content within .singlePage element + // Attach SPA functions to the global Million namespace + window.Million = { + router, + navigate, + reload, + prefetch, + }; router(".singlePage") // We need on initial load, then subsequent redirs // requestAnimationFrame() delays graph draw until SPA routing is finished - window.addEventListener("million:navigate", () => requestAnimationFrame(draw)) + reload(draw) window.addEventListener("DOMContentLoaded", () => requestAnimationFrame(draw)) } From efb6c7845f0a2743dd07b81f1d03b03d058ede0d Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 08:40:00 -0700 Subject: [PATCH 05/27] Add prefetch to graph --- assets/js/graph.js | 205 +++++++++++++++---------------------- assets/js/search.js | 2 +- layouts/partials/head.html | 2 +- 3 files changed, 87 insertions(+), 122 deletions(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index f71e44d37..c7634cf3e 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -1,12 +1,5 @@ -async function drawGraph( - baseUrl, - pathColors, - depth, - enableDrag, - enableLegend, - enableZoom -) { - const container = document.getElementById('graph-container') +async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, enableZoom) { + const container = document.getElementById("graph-container") const { index, links, content } = await fetchData // Use .pathname to remove hashes / searchParams / text fragments @@ -23,22 +16,19 @@ async function drawGraph( const copyLinks = JSON.parse(JSON.stringify(links)) const neighbours = new Set() - const wl = [curPage || '/', '__SENTINEL'] + const wl = [curPage || "/", "__SENTINEL"] if (depth >= 0) { while (depth >= 0 && wl.length > 0) { // compute neighbours const cur = wl.shift() - if (cur === '__SENTINEL') { + if (cur === "__SENTINEL") { depth-- - wl.push('__SENTINEL') + wl.push("__SENTINEL") } else { neighbours.add(cur) const outgoing = index.links[cur] || [] const incoming = index.backlinks[cur] || [] - wl.push( - ...outgoing.map((l) => l.target), - ...incoming.map((l) => l.source) - ) + wl.push(...outgoing.map((l) => l.target), ...incoming.map((l) => l.source)) } } } else { @@ -47,14 +37,12 @@ async function drawGraph( const data = { nodes: [...neighbours].map((id) => ({ id })), - links: copyLinks.filter( - (l) => neighbours.has(l.source) && neighbours.has(l.target) - ), + links: copyLinks.filter((l) => neighbours.has(l.source) && neighbours.has(l.target)), } const color = (d) => { - if (d.id === curPage || (d.id === '/' && curPage === '')) { - return 'var(--g-node-active)' + if (d.id === curPage || (d.id === "/" && curPage === "")) { + return "var(--g-node-active)" } for (const pathColor of pathColors) { @@ -65,7 +53,7 @@ async function drawGraph( } } - return 'var(--g-node)' + return "var(--g-node)" } const drag = (simulation) => { @@ -86,12 +74,12 @@ async function drawGraph( d.fy = null } - const noop = () => { } + const noop = () => {} return d3 .drag() - .on('start', enableDrag ? dragstarted : noop) - .on('drag', enableDrag ? dragged : noop) - .on('end', enableDrag ? dragended : noop) + .on("start", enableDrag ? dragstarted : noop) + .on("drag", enableDrag ? dragged : noop) + .on("end", enableDrag ? dragended : noop) } const height = Math.max(container.offsetHeight, 250) @@ -99,67 +87,58 @@ async function drawGraph( const simulation = d3 .forceSimulation(data.nodes) - .force('charge', d3.forceManyBody().strength(-30)) + .force("charge", d3.forceManyBody().strength(-30)) .force( - 'link', + "link", d3 .forceLink(data.links) .id((d) => d.id) - .distance(40) + .distance(40), ) - .force('center', d3.forceCenter()) + .force("center", d3.forceCenter()) const svg = d3 - .select('#graph-container') - .append('svg') - .attr('width', width) - .attr('height', height) - .attr('viewBox', [-width / 2, -height / 2, width, height]) + .select("#graph-container") + .append("svg") + .attr("width", width) + .attr("height", height) + .attr("viewBox", [-width / 2, -height / 2, width, height]) if (enableLegend) { - const legend = [ - { Current: 'var(--g-node-active)' }, - { Note: 'var(--g-node)' }, - ...pathColors, - ] + const legend = [{ Current: "var(--g-node-active)" }, { Note: "var(--g-node)" }, ...pathColors] legend.forEach((legendEntry, i) => { const key = Object.keys(legendEntry)[0] const colour = legendEntry[key] svg - .append('circle') - .attr('cx', -width / 2 + 20) - .attr('cy', height / 2 - 30 * (i + 1)) - .attr('r', 6) - .style('fill', colour) + .append("circle") + .attr("cx", -width / 2 + 20) + .attr("cy", height / 2 - 30 * (i + 1)) + .attr("r", 6) + .style("fill", colour) svg - .append('text') - .attr('x', -width / 2 + 40) - .attr('y', height / 2 - 30 * (i + 1)) + .append("text") + .attr("x", -width / 2 + 40) + .attr("y", height / 2 - 30 * (i + 1)) .text(key) - .style('font-size', '15px') - .attr('alignment-baseline', 'middle') + .style("font-size", "15px") + .attr("alignment-baseline", "middle") }) } // draw links between nodes const link = svg - .append('g') - .selectAll('line') + .append("g") + .selectAll("line") .data(data.links) - .join('line') - .attr('class', 'link') - .attr('stroke', 'var(--g-link)') - .attr('stroke-width', 2) - .attr('data-source', (d) => d.source.id) - .attr('data-target', (d) => d.target.id) + .join("line") + .attr("class", "link") + .attr("stroke", "var(--g-link)") + .attr("stroke-width", 2) + .attr("data-source", (d) => d.source.id) + .attr("data-target", (d) => d.target.id) // svg groups - const graphNode = svg - .append('g') - .selectAll('g') - .data(data.nodes) - .enter() - .append('g') + const graphNode = svg.append("g").selectAll("g").data(data.nodes).enter().append("g") // calculate radius const nodeRadius = (d) => { @@ -170,82 +149,68 @@ async function drawGraph( // draw individual nodes const node = graphNode - .append('circle') - .attr('class', 'node') - .attr('id', (d) => d.id) - .attr('r', nodeRadius) - .attr('fill', color) - .style('cursor', 'pointer') - .on('click', (_, d) => { + .append("circle") + .attr("class", "node") + .attr("id", (d) => d.id) + .attr("r", nodeRadius) + .attr("fill", color) + .style("cursor", "pointer") + .on("click", (_, d) => { // SPA navigation - window.navigate( - new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, '-')}/`), - '.singlePage' - ) + window.Million.navigate(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`), ".singlePage") }) - .on('mouseover', function(_, d) { - d3.selectAll('.node') - .transition() - .duration(100) - .attr('fill', 'var(--g-node-inactive)') + .on("mouseover", function (_, d) { + d3.selectAll(".node").transition().duration(100).attr("fill", "var(--g-node-inactive)") const neighbours = parseIdsFromLinks([ ...(index.links[d.id] || []), ...(index.backlinks[d.id] || []), ]) - const neighbourNodes = d3 - .selectAll('.node') - .filter((d) => neighbours.includes(d.id)) + const neighbourNodes = d3.selectAll(".node").filter((d) => neighbours.includes(d.id)) const currentId = d.id + window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`)) const linkNodes = d3 - .selectAll('.link') + .selectAll(".link") .filter((d) => d.source.id === currentId || d.target.id === currentId) // highlight neighbour nodes - neighbourNodes.transition().duration(200).attr('fill', color) + neighbourNodes.transition().duration(200).attr("fill", color) // highlight links - linkNodes - .transition() - .duration(200) - .attr('stroke', 'var(--g-link-active)') + linkNodes.transition().duration(200).attr("stroke", "var(--g-link-active)") // show text for self d3.select(this.parentNode) .raise() - .select('text') + .select("text") .transition() .duration(200) - .style('opacity', 1) + .style("opacity", 1) }) - .on('mouseleave', function(_, d) { - d3.selectAll('.node').transition().duration(200).attr('fill', color) + .on("mouseleave", function (_, d) { + d3.selectAll(".node").transition().duration(200).attr("fill", color) const currentId = d.id const linkNodes = d3 - .selectAll('.link') + .selectAll(".link") .filter((d) => d.source.id === currentId || d.target.id === currentId) - linkNodes.transition().duration(200).attr('stroke', 'var(--g-link)') + linkNodes.transition().duration(200).attr("stroke", "var(--g-link)") - d3.select(this.parentNode) - .select('text') - .transition() - .duration(200) - .style('opacity', 0) + d3.select(this.parentNode).select("text").transition().duration(200).style("opacity", 0) }) .call(drag(simulation)) // draw labels const labels = graphNode - .append('text') - .attr('dx', 0) - .attr('dy', (d) => nodeRadius(d) + 8 + 'px') - .attr('text-anchor', 'middle') - .text((d) => content[d.id]?.title || d.id.replace('-', ' ')) - .style('opacity', 0) - .style('pointer-events', 'none') - .style('font-size', '0.4em') + .append("text") + .attr("dx", 0) + .attr("dy", (d) => nodeRadius(d) + 8 + "px") + .attr("text-anchor", "middle") + .text((d) => content[d.id]?.title || d.id.replace("-", " ")) + .style("opacity", 0) + .style("pointer-events", "none") + .style("font-size", "0.4em") .raise() .call(drag(simulation)) @@ -260,24 +225,24 @@ async function drawGraph( [width, height], ]) .scaleExtent([0.25, 4]) - .on('zoom', ({ transform }) => { - link.attr('transform', transform) - node.attr('transform', transform) + .on("zoom", ({ transform }) => { + link.attr("transform", transform) + node.attr("transform", transform) const scale = transform.k const scaledOpacity = Math.max((scale - 1) / 3.75, 0) - labels.attr('transform', transform).style('opacity', scaledOpacity) - }) + labels.attr("transform", transform).style("opacity", scaledOpacity) + }), ) } // progress the simulation - simulation.on('tick', () => { + simulation.on("tick", () => { link - .attr('x1', (d) => d.source.x) - .attr('y1', (d) => d.source.y) - .attr('x2', (d) => d.target.x) - .attr('y2', (d) => d.target.y) - node.attr('cx', (d) => d.x).attr('cy', (d) => d.y) - labels.attr('x', (d) => d.x).attr('y', (d) => d.y) + .attr("x1", (d) => d.source.x) + .attr("y1", (d) => d.source.y) + .attr("x2", (d) => d.target.x) + .attr("y2", (d) => d.target.y) + node.attr("cx", (d) => d.x).attr("cy", (d) => d.y) + labels.attr("x", (d) => d.x).attr("y", (d) => d.y) }) } diff --git a/assets/js/search.js b/assets/js/search.js index bb94cd30b..ee0064715 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -153,7 +153,7 @@ const highlight = (content, term) => { const redir = (id, term) => { // SPA navigation - window.navigate( + window.Million.navigate( new URL( `${BASE_URL.replace(/\/$/g, "")}${id}#:~:text=${encodeURIComponent(term)}/` ), diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a49800be5..b65bb8430 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -107,7 +107,7 @@ {{else}} {{end}} From bc32bbeaed10eac3094fcaa899ca626dc8e56771 Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 09:02:01 -0700 Subject: [PATCH 06/27] Bump milliomn to 1.9.3 --- assets/js/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/router.js b/assets/js/router.js index b70aac2d6..dff17413a 100644 --- a/assets/js/router.js +++ b/assets/js/router.js @@ -1,4 +1,4 @@ -import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.2/dist/router.mjs" +import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.3/dist/router.mjs" export const attachSPARouting = (draw) => { // Attach SPA functions to the global Million namespace From e0fd9570d746cb2aa270dbe64dae038fc02bdbac Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 09:49:28 -0700 Subject: [PATCH 07/27] Bump million to 1.9.4 --- assets/js/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/router.js b/assets/js/router.js index dff17413a..3cd335002 100644 --- a/assets/js/router.js +++ b/assets/js/router.js @@ -1,4 +1,4 @@ -import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.3/dist/router.mjs" +import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.4/dist/router.mjs" export const attachSPARouting = (draw) => { // Attach SPA functions to the global Million namespace From 683cb53cbd4d581a061b64a26da54285ef479e19 Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 13:19:19 -0700 Subject: [PATCH 08/27] Bump million to 1.9.5 --- assets/js/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/router.js b/assets/js/router.js index 3cd335002..278ed565c 100644 --- a/assets/js/router.js +++ b/assets/js/router.js @@ -1,4 +1,4 @@ -import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.4/dist/router.mjs" +import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.5/dist/router.mjs" export const attachSPARouting = (draw) => { // Attach SPA functions to the global Million namespace From 44984cdaf4dfca8c25e9b73066ee22c775ed6d2e Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 13:27:13 -0700 Subject: [PATCH 09/27] Add support for progress bar --- assets/styles/custom.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/styles/custom.scss b/assets/styles/custom.scss index 612b80a61..0a23ffca3 100644 --- a/assets/styles/custom.scss +++ b/assets/styles/custom.scss @@ -9,6 +9,7 @@ --gray: #4e4e4e; --lightgray: #f0f0f0; --outlinegray: #dadada; + --million-progress-bar-color: var(--secondary); } [saved-theme="dark"] { @@ -21,4 +22,5 @@ --gray: #d4d4d4 !important; --lightgray: #292633 !important; --outlinegray: #343434 !important; + --million-progress-bar-color: var(--secondary) !important; } \ No newline at end of file From 159deabfe160c7570679269873f18776cb586437 Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 16:14:17 -0700 Subject: [PATCH 10/27] Bump to 1.9.6 --- assets/js/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/router.js b/assets/js/router.js index 278ed565c..787cd7653 100644 --- a/assets/js/router.js +++ b/assets/js/router.js @@ -1,4 +1,4 @@ -import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.5/dist/router.mjs" +import { router, navigate, reload, prefetch } from "https://unpkg.com/million@1.9.6/dist/router.mjs" export const attachSPARouting = (draw) => { // Attach SPA functions to the global Million namespace From ae240ff82cd8de66c28b1608e72db6ed397cab13 Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 18:31:36 -0700 Subject: [PATCH 11/27] Remove redundant CSS rule --- assets/styles/custom.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/styles/custom.scss b/assets/styles/custom.scss index 0a23ffca3..54dbacef6 100644 --- a/assets/styles/custom.scss +++ b/assets/styles/custom.scss @@ -22,5 +22,4 @@ --gray: #d4d4d4 !important; --lightgray: #292633 !important; --outlinegray: #343434 !important; - --million-progress-bar-color: var(--secondary) !important; } \ No newline at end of file From 8aba612a0013e84f0b3f9d60863c02ad1b0bfd6e Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 18:42:01 -0700 Subject: [PATCH 12/27] Fix non-spa fallback --- layouts/partials/head.html | 58 +++++++++++++++----------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index b65bb8430..2da259d46 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -5,45 +5,31 @@ name="description" content="{{if .IsHome}}{{$.Site.Data.config.description}}{{else}}{{.Summary}}{{end}}" /> - - {{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{ - end }} - + {{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{ end }} - + - {{$sass := resources.Match "styles/[!_]*.scss" }} - {{$css := slice }} - {{range $sass}} - {{$scss := . | resources.ToCSS (dict "outputStyle" "compressed") }} - {{$css = $css | append $scss}} - {{end}} - {{$finalCss := $css | resources.Concat "styles.css" | resources.Fingerprint "md5" | resources.Minify }} + {{$sass := resources.Match "styles/[!_]*.scss" }} {{$css := slice }} {{range $sass}} {{$scss := . + | resources.ToCSS (dict "outputStyle" "compressed") }} {{$css = $css | append $scss}} {{end}} + {{$finalCss := $css | resources.Concat "styles.css" | resources.Fingerprint "md5" | + resources.Minify }} - {{ $darkMode := resources.Get "js/darkmode.js" | resources.Fingerprint "md5" | - resources.Minify }} + {{ $darkMode := resources.Get "js/darkmode.js" | resources.Fingerprint "md5" | resources.Minify }} - {{partial "katex.html" .}} - - {{ $popover := resources.Get "js/popover.js" | resources.Fingerprint "md5" | - resources.Minify }} + {{partial "katex.html" .}} {{ $popover := resources.Get "js/popover.js" | resources.Fingerprint + "md5" | resources.Minify }} - {{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint - "md5" | resources.Minify | }} {{$contentIndex := resources.Get - "indices/contentIndex.json" | resources.Fingerprint "md5" | resources.Minify - }} + {{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint "md5" | + resources.Minify | }} {{$contentIndex := resources.Get "indices/contentIndex.json" | + resources.Fingerprint "md5" | resources.Minify }} - {{if $.Site.Data.config.enableSPA}} - {{ $router := resources.Get "js/router.js" | resources.Fingerprint "md5" | - resources.Minify }} + {{if $.Site.Data.config.enableSPA}} {{ $router := resources.Get "js/router.js" | + resources.Fingerprint "md5" | resources.Minify }} {{else}} {{end}} From 006b74ec6feed2d01099754c888bac4a9474a6b1 Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Fri, 27 May 2022 18:45:42 -0700 Subject: [PATCH 13/27] Fix formatting --- layouts/partials/head.html | 40 +++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 2da259d46..25120d517 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -5,31 +5,44 @@ name="description" content="{{if .IsHome}}{{$.Site.Data.config.description}}{{else}}{{.Summary}}{{end}}" /> - {{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{ end }} + + {{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{ + end }} + - + - {{$sass := resources.Match "styles/[!_]*.scss" }} {{$css := slice }} {{range $sass}} {{$scss := . - | resources.ToCSS (dict "outputStyle" "compressed") }} {{$css = $css | append $scss}} {{end}} - {{$finalCss := $css | resources.Concat "styles.css" | resources.Fingerprint "md5" | - resources.Minify }} + {{$sass := resources.Match "styles/[!_]*.scss" }} + {{$css := slice }} + {{range $sass}} + {{$scss := . | resources.ToCSS (dict "outputStyle" "compressed") }} + {{$css = $css | append $scss}} + {{end}} + {{$finalCss := $css | resources.Concat "styles.css" | resources.Fingerprint "md5" | resources.Minify }} {{ $darkMode := resources.Get "js/darkmode.js" | resources.Fingerprint "md5" | resources.Minify }} - {{partial "katex.html" .}} {{ $popover := resources.Get "js/popover.js" | resources.Fingerprint - "md5" | resources.Minify }} + {{partial "katex.html" .}} + + {{ $popover := resources.Get "js/popover.js" | resources.Fingerprint "md5" | + resources.Minify }} - {{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint "md5" | - resources.Minify | }} {{$contentIndex := resources.Get "indices/contentIndex.json" | - resources.Fingerprint "md5" | resources.Minify }} + {{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint + "md5" | resources.Minify | }} {{$contentIndex := resources.Get + "indices/contentIndex.json" | resources.Fingerprint "md5" | resources.Minify + }} - {{if $.Site.Data.config.enableSPA}} {{ $router := resources.Get "js/router.js" | - resources.Fingerprint "md5" | resources.Minify }} + {{if $.Site.Data.config.enableSPA}} + {{ $router := resources.Get "js/router.js" | resources.Fingerprint "md5" | + resources.Minify }} {{else}} {{end}} From 5a1fbc937470b4f43b318dd0fa9af01b4a47b188 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Wed, 1 Jun 2022 13:49:27 +0100 Subject: [PATCH 16/27] Improve graph display, options and ability to have a global graph on the home page, local graphs on subpage. --- assets/js/graph.js | 43 +++++++++++++++++++++++------- data/graphConfig.yaml | 33 +++++++++++++++++++++-- layouts/index.html | 2 +- layouts/partials/footerIndex.html | 28 ++++++++++++++++++++ layouts/partials/head.html | 44 +++++++++++++++++++++++++------ 5 files changed, 129 insertions(+), 21 deletions(-) create mode 100644 layouts/partials/footerIndex.html diff --git a/assets/js/graph.js b/assets/js/graph.js index c7634cf3e..48248ecac 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -1,4 +1,16 @@ -async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, enableZoom) { +async function drawGraph( + baseUrl, + pathColors, + depth, + enableDrag, + enableLegend, + enableZoom, + isHome, + opacityScale, + scale, + repelForce, + fontSize +) { const container = document.getElementById("graph-container") const { index, links, content } = await fetchData @@ -82,12 +94,12 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e .on("end", enableDrag ? dragended : noop) } - const height = Math.max(container.offsetHeight, 250) + const height = Math.max(container.offsetHeight, isHome ? 500 : 250) const width = container.offsetWidth const simulation = d3 .forceSimulation(data.nodes) - .force("charge", d3.forceManyBody().strength(-30)) + .force("charge", d3.forceManyBody().strength(-100 * repelForce)) .force( "link", d3 @@ -102,7 +114,7 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e .append("svg") .attr("width", width) .attr("height", height) - .attr("viewBox", [-width / 2, -height / 2, width, height]) + .attr('viewBox', [-width / 2 * 1 / scale, -height / 2 * 1 / scale, width * 1 / scale, height * 1 / scale]) if (enableLegend) { const legend = [{ Current: "var(--g-node-active)" }, { Note: "var(--g-node)" }, ...pathColors] @@ -168,7 +180,7 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e ]) const neighbourNodes = d3.selectAll(".node").filter((d) => neighbours.includes(d.id)) const currentId = d.id - window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`)) + // window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`)) const linkNodes = d3 .selectAll(".link") .filter((d) => d.source.id === currentId || d.target.id === currentId) @@ -179,13 +191,18 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e // highlight links linkNodes.transition().duration(200).attr("stroke", "var(--g-link-active)") + const bigFont = fontSize+0.5 + // show text for self d3.select(this.parentNode) .raise() .select("text") .transition() .duration(200) - .style("opacity", 1) + .attr('opacityOld', d3.select(this.parentNode).select('text').style("opacity")) + .style('opacity', 1) + .style('font-size', bigFont+'em') + .attr('dy', d => nodeRadius(d) + 20 + 'px') // radius is in px }) .on("mouseleave", function (_, d) { d3.selectAll(".node").transition().duration(200).attr("fill", color) @@ -197,7 +214,13 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e linkNodes.transition().duration(200).attr("stroke", "var(--g-link)") - d3.select(this.parentNode).select("text").transition().duration(200).style("opacity", 0) + d3.select(this.parentNode) + .select("text") + .transition() + .duration(200) + .style('opacity', d3.select(this.parentNode).select('text').attr("opacityOld")) + .style('font-size', fontSize+'em') + .attr('dy', d => nodeRadius(d) + 8 + 'px') // radius is in px }) .call(drag(simulation)) @@ -208,9 +231,9 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e .attr("dy", (d) => nodeRadius(d) + 8 + "px") .attr("text-anchor", "middle") .text((d) => content[d.id]?.title || d.id.replace("-", " ")) - .style("opacity", 0) + .style('opacity', (opacityScale - 1) / 3.75) .style("pointer-events", "none") - .style("font-size", "0.4em") + .style('font-size', fontSize+'em') .raise() .call(drag(simulation)) @@ -228,7 +251,7 @@ async function drawGraph(baseUrl, pathColors, depth, enableDrag, enableLegend, e .on("zoom", ({ transform }) => { link.attr("transform", transform) node.attr("transform", transform) - const scale = transform.k + const scale = transform.k * opacityScale; const scaledOpacity = Math.max((scale - 1) / 3.75, 0) labels.attr("transform", transform).style("opacity", scaledOpacity) }), diff --git a/data/graphConfig.yaml b/data/graphConfig.yaml index 3f8d3fb6b..7f08130d8 100644 --- a/data/graphConfig.yaml +++ b/data/graphConfig.yaml @@ -1,6 +1,35 @@ +# if true, a Global Graph will be shown on home page with full width, no backlink. +# A different set of Local Graphs will be shown on sub pages. +# if false, Local Graph will be default on every page as usual +enableGlobalGraph: true + +### Local Graph ### + enableLegend: false enableDrag: true enableZoom: true -depth: -1 # set to -1 to show full graph +depth: 1 # set to -1 to show full graph +scale: 1 +repelForce: 2 +centerForce: 1 +linkDistance: 1 +fontSize: 0.6 +opacityScale: 3 + +### Global Graph ### + +enableLegendGG: false +enableDragGG: true +enableZoomGG: true +depthGG: -1 # set to -1 to show full graph +scaleGG: 1.2 +repelForceGG: 1 +centerForceGG: 1 +linkDistanceGG: 1 +fontSizeGG: 0.5 +opacityScaleGG: 3 + +### Graphs ### + paths: - - /moc: "#4388cc" \ No newline at end of file + - /moc: "#4388cc" diff --git a/layouts/index.html b/layouts/index.html index 8d1ffbd4f..505361420 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -19,7 +19,7 @@ {{partial "recent.html" . }} {{end}} - {{partial "footer.html" .}} + {{partial "footerIndex.html" .}} diff --git a/layouts/partials/footerIndex.html b/layouts/partials/footerIndex.html new file mode 100644 index 000000000..36c8a8ac1 --- /dev/null +++ b/layouts/partials/footerIndex.html @@ -0,0 +1,28 @@ + + +
+ +{{if $.Site.Data.config.enableFooter}} + {{if $.Site.Data.graphConfig.enableGlobalGraph}} +
+ +
+ {{partial "graph.html" .}} +
+ +
+ {{else}} +
+
+ +
+ {{partial "graph.html" .}} +
+ +
+ {{end}} +{{end}} + +{{partial "contact.html" .}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f10ce1453..01b8fe8ab 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -62,6 +62,12 @@ })) const draw = () => { + + const siteBaseURL = new URL({{$.Site.BaseURL}}); + const pathBase = siteBaseURL.pathname; + const pathWindow = window.location.pathname; + const isHome = pathBase == pathWindow ? true : false; + // NOTE: everything within this callback will be executed for every page navigation. This is a good place to put JavaScript that loads or modifies data on the page. {{if $.Site.Data.config.enableFooter}} const container = document.getElementById("graph-container") @@ -70,14 +76,36 @@ // clear the graph in case there is anything within it container.textContent = "" - drawGraph( - {{strings.TrimRight "/" .Site.BaseURL}}, - {{$.Site.Data.graphConfig.paths}}, - {{$.Site.Data.graphConfig.depth}}, - {{$.Site.Data.graphConfig.enableDrag}}, - {{$.Site.Data.graphConfig.enableLegend}}, - {{$.Site.Data.graphConfig.enableZoom}} - ); + if (isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}}) { + drawGraph( + {{strings.TrimRight "/" .Site.BaseURL}}, + {{$.Site.Data.graphConfig.paths}}, + {{$.Site.Data.graphConfig.depthGG}}, + {{$.Site.Data.graphConfig.enableDragGG}}, + {{$.Site.Data.graphConfig.enableLegendGG}}, + {{$.Site.Data.graphConfig.enableZoomGG}}, + true, + {{$.Site.Data.graphConfig.opacityScaleGG}}, + {{$.Site.Data.graphConfig.scaleGG}}, + {{$.Site.Data.graphConfig.repelForceGG}}, + {{$.Site.Data.graphConfig.fontSizeGG}} + ); + } else { + drawGraph( + {{strings.TrimRight "/" .Site.BaseURL}}, + {{$.Site.Data.graphConfig.paths}}, + {{$.Site.Data.graphConfig.depth}}, + {{$.Site.Data.graphConfig.enableDrag}}, + {{$.Site.Data.graphConfig.enableLegend}}, + {{$.Site.Data.graphConfig.enableZoom}}, + false, + {{$.Site.Data.graphConfig.opacityScale}}, + {{$.Site.Data.graphConfig.scale}}, + {{$.Site.Data.graphConfig.repelForce}}, + {{$.Site.Data.graphConfig.fontSize}} + ); + } + {{end}} {{if $.Site.Data.config.enableLinkPreview}} initPopover( From 1e237ef677f3b958597460175269eed4b0638112 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Wed, 1 Jun 2022 20:15:44 +0100 Subject: [PATCH 17/27] change baseURL --- config.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.toml b/config.toml index 5efa9f346..6a7838122 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://quartz.jzhao.xyz/" +baseURL = "https://dhammacharts.org/quartz/" languageCode = "en-us" googleAnalytics = "G-XYFD95KB4J" pygmentsUseClasses = true @@ -30,4 +30,4 @@ enableGitInfo = true tabWidth = 4 [frontmatter] lastmod = ["lastmod", ":git", "date", "publishDate"] - publishDate = ["publishDate", "date"] \ No newline at end of file + publishDate = ["publishDate", "date"] From 19606ba63d15edd1e4a98bf1ce5cd510a24880e0 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:19:03 +0100 Subject: [PATCH 18/27] add www. --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 6a7838122..65ffb1f21 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://dhammacharts.org/quartz/" +baseURL = "https://www.dhammacharts.org/quartz/" languageCode = "en-us" googleAnalytics = "G-XYFD95KB4J" pygmentsUseClasses = true From e809896338b51e65ca862809e79884469476f2de Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:22:31 +0100 Subject: [PATCH 19/27] increase scale --- data/graphConfig.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/graphConfig.yaml b/data/graphConfig.yaml index 7f08130d8..f8b9941dc 100644 --- a/data/graphConfig.yaml +++ b/data/graphConfig.yaml @@ -9,7 +9,7 @@ enableLegend: false enableDrag: true enableZoom: true depth: 1 # set to -1 to show full graph -scale: 1 +scale: 1.2 repelForce: 2 centerForce: 1 linkDistance: 1 @@ -22,7 +22,7 @@ enableLegendGG: false enableDragGG: true enableZoomGG: true depthGG: -1 # set to -1 to show full graph -scaleGG: 1.2 +scaleGG: 1.4 repelForceGG: 1 centerForceGG: 1 linkDistanceGG: 1 From ac0dd50c048d68884b0ada42e3ab0476fb29ef65 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:30:40 +0100 Subject: [PATCH 20/27] uncomment window.Million --- assets/js/graph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index 48248ecac..87d8d586e 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -180,7 +180,7 @@ async function drawGraph( ]) const neighbourNodes = d3.selectAll(".node").filter((d) => neighbours.includes(d.id)) const currentId = d.id - // window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`)) + window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`)) const linkNodes = d3 .selectAll(".link") .filter((d) => d.source.id === currentId || d.target.id === currentId) From c0800a874980ab0f24fc2e350d70792d9c7f2956 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Thu, 2 Jun 2022 07:45:44 +0100 Subject: [PATCH 21/27] change baseURL back to original --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 65ffb1f21..803ef1ecb 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://www.dhammacharts.org/quartz/" +baseURL = "https://quartz.jzhao.xyz/" languageCode = "en-us" googleAnalytics = "G-XYFD95KB4J" pygmentsUseClasses = true From d261655d96f9ed084a176ed113b0d11f1351c6de Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Thu, 2 Jun 2022 07:49:09 +0100 Subject: [PATCH 22/27] remove unnecessary ternary --- layouts/partials/head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 01b8fe8ab..b56c29136 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -66,7 +66,7 @@ const siteBaseURL = new URL({{$.Site.BaseURL}}); const pathBase = siteBaseURL.pathname; const pathWindow = window.location.pathname; - const isHome = pathBase == pathWindow ? true : false; + const isHome = pathBase == pathWindow; // NOTE: everything within this callback will be executed for every page navigation. This is a good place to put JavaScript that loads or modifies data on the page. {{if $.Site.Data.config.enableFooter}} From c88f31c3645bb0002171bf21850c7ca6d217c73f Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Thu, 2 Jun 2022 08:16:02 +0100 Subject: [PATCH 23/27] change to object destructuring for drawGraph() arguments --- assets/js/graph.js | 11 +++++----- data/graphConfig.yaml | 44 ++++++++++++++++++++------------------ layouts/partials/head.html | 22 ++++--------------- 3 files changed, 32 insertions(+), 45 deletions(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index 87d8d586e..9199bef89 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -1,16 +1,15 @@ -async function drawGraph( - baseUrl, - pathColors, +async function drawGraph(baseUrl,isHome,pathColors,graphConfig) { + + let { depth, enableDrag, enableLegend, enableZoom, - isHome, opacityScale, scale, repelForce, - fontSize -) { + fontSize} = graphConfig; + const container = document.getElementById("graph-container") const { index, links, content } = await fetchData diff --git a/data/graphConfig.yaml b/data/graphConfig.yaml index f8b9941dc..06ce2b08f 100644 --- a/data/graphConfig.yaml +++ b/data/graphConfig.yaml @@ -5,31 +5,33 @@ enableGlobalGraph: true ### Local Graph ### -enableLegend: false -enableDrag: true -enableZoom: true -depth: 1 # set to -1 to show full graph -scale: 1.2 -repelForce: 2 -centerForce: 1 -linkDistance: 1 -fontSize: 0.6 -opacityScale: 3 +localGraph: + enableLegend: false + enableDrag: true + enableZoom: true + depth: 1 # set to -1 to show full graph + scale: 1.2 + repelForce: 2 + centerForce: 1 + linkDistance: 1 + fontSize: 0.6 + opacityScale: 3 ### Global Graph ### -enableLegendGG: false -enableDragGG: true -enableZoomGG: true -depthGG: -1 # set to -1 to show full graph -scaleGG: 1.4 -repelForceGG: 1 -centerForceGG: 1 -linkDistanceGG: 1 -fontSizeGG: 0.5 -opacityScaleGG: 3 +globalGraph: + enableLegend: false + enableDrag: true + enableZoom: true + depth: -1 # set to -1 to show full graph + scale: 1.4 + repelForce: 1 + centerForce: 1 + linkDistance: 1 + fontSize: 0.5 + opacityScale: 3 -### Graphs ### +### For all graphs ### paths: - /moc: "#4388cc" diff --git a/layouts/partials/head.html b/layouts/partials/head.html index b56c29136..ba02260e4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -79,30 +79,16 @@ if (isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}}) { drawGraph( {{strings.TrimRight "/" .Site.BaseURL}}, - {{$.Site.Data.graphConfig.paths}}, - {{$.Site.Data.graphConfig.depthGG}}, - {{$.Site.Data.graphConfig.enableDragGG}}, - {{$.Site.Data.graphConfig.enableLegendGG}}, - {{$.Site.Data.graphConfig.enableZoomGG}}, true, - {{$.Site.Data.graphConfig.opacityScaleGG}}, - {{$.Site.Data.graphConfig.scaleGG}}, - {{$.Site.Data.graphConfig.repelForceGG}}, - {{$.Site.Data.graphConfig.fontSizeGG}} + {{$.Site.Data.graphConfig.paths}}, + {{$.Site.Data.graphConfig.globalGraph}} ); } else { drawGraph( {{strings.TrimRight "/" .Site.BaseURL}}, - {{$.Site.Data.graphConfig.paths}}, - {{$.Site.Data.graphConfig.depth}}, - {{$.Site.Data.graphConfig.enableDrag}}, - {{$.Site.Data.graphConfig.enableLegend}}, - {{$.Site.Data.graphConfig.enableZoom}}, false, - {{$.Site.Data.graphConfig.opacityScale}}, - {{$.Site.Data.graphConfig.scale}}, - {{$.Site.Data.graphConfig.repelForce}}, - {{$.Site.Data.graphConfig.fontSize}} + {{$.Site.Data.graphConfig.paths}}, + {{$.Site.Data.graphConfig.localGraph}} ); } From a275123be2b1d528dbde23beb9880933c4e22c3e Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Thu, 2 Jun 2022 08:35:28 +0100 Subject: [PATCH 24/27] better font behaviour --- assets/js/graph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index 9199bef89..f79cb3fa4 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -190,7 +190,7 @@ async function drawGraph(baseUrl,isHome,pathColors,graphConfig) { // highlight links linkNodes.transition().duration(200).attr("stroke", "var(--g-link-active)") - const bigFont = fontSize+0.5 + const bigFont = fontSize*1.5 // show text for self d3.select(this.parentNode) From ab809249c8f57c1980de2fa850eef66301619307 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:42:53 +0100 Subject: [PATCH 25/27] Update layouts/partials/head.html Co-authored-by: Jacky Zhao --- layouts/partials/head.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6eb8eaf36..b3ad28d8c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -72,21 +72,13 @@ // clear the graph in case there is anything within it container.textContent = "" - if (isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}}) { - drawGraph( + const drawGlobal = isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}}; + drawGraph( {{strings.TrimRight "/" .Site.BaseURL}}, - true, + drawGlobal, {{$.Site.Data.graphConfig.paths}}, - {{$.Site.Data.graphConfig.globalGraph}} + drawGlobal ? {{$.Site.Data.graphConfig.globalGraph}} : {{$.Site.Data.graphConfig.localGraph}} ); - } else { - drawGraph( - {{strings.TrimRight "/" .Site.BaseURL}}, - false, - {{$.Site.Data.graphConfig.paths}}, - {{$.Site.Data.graphConfig.localGraph}} - ); - } {{end}} From 69c74ca6b5854cbb3e7dd895dca0539f51f49720 Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:48:16 +0100 Subject: [PATCH 26/27] minor adjustment --- assets/js/graph.js | 2 +- layouts/partials/footerIndex.html | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index f79cb3fa4..174d4946d 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -1,4 +1,4 @@ -async function drawGraph(baseUrl,isHome,pathColors,graphConfig) { +async function drawGraph(baseUrl, isHome, pathColors, graphConfig) { let { depth, diff --git a/layouts/partials/footerIndex.html b/layouts/partials/footerIndex.html index 36c8a8ac1..5f190446a 100644 --- a/layouts/partials/footerIndex.html +++ b/layouts/partials/footerIndex.html @@ -1,7 +1,3 @@ - - -
- {{if $.Site.Data.config.enableFooter}} {{if $.Site.Data.graphConfig.enableGlobalGraph}}
From 52a185f73b18d8e5a564c2144401de750b0e025a Mon Sep 17 00:00:00 2001 From: DhammaCharts <100090806+DhammaCharts@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:49:01 +0100 Subject: [PATCH 27/27] change enableGlobalGraph to false --- data/graphConfig.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/graphConfig.yaml b/data/graphConfig.yaml index 06ce2b08f..a6f916acb 100644 --- a/data/graphConfig.yaml +++ b/data/graphConfig.yaml @@ -1,7 +1,7 @@ # if true, a Global Graph will be shown on home page with full width, no backlink. # A different set of Local Graphs will be shown on sub pages. # if false, Local Graph will be default on every page as usual -enableGlobalGraph: true +enableGlobalGraph: false ### Local Graph ###