From 8e85e274f6e5913694b67319f1beb7a2ec5b5bed Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Wed, 16 Feb 2022 00:42:45 +0000
Subject: [PATCH] change output to static instead of data
---
layouts/partials/popover.html | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/layouts/partials/popover.html b/layouts/partials/popover.html
index 3a7de11..35f0738 100644
--- a/layouts/partials/popover.html
+++ b/layouts/partials/popover.html
@@ -1,5 +1,7 @@
{{if $.Site.Data.config.enableLinkPreview}}
<script>
+async function run() {
+ const {content} = await fetchData()
function htmlToElement(html) {
const template = document.createElement('template')
html = html.trim()
@@ -11,7 +13,6 @@
document.addEventListener("DOMContentLoaded", () => {
[...document.getElementsByClassName("internal-link")]
.forEach(li => {
- console.log(li.dataset.src.replace(pathRegex, ''))
const linkDest = content[li.dataset.src.replace(pathRegex, '')]
if (linkDest) {
const popoverElement = `<div class="popover">
@@ -29,5 +30,8 @@
}
})
})
+}
+
+run()
</script>
{{end}}
\ No newline at end of file
--
Gitblit v1.10.0