From 32c79a561fa82dbf6537b96e83ab3da2a848b211 Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 03 May 2022 16:21:44 +0000
Subject: [PATCH] Remove unnecessary 'url' argument in graph.html
---
assets/js/popover.js | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/assets/js/popover.js b/assets/js/popover.js
index 3d0d18b..460c245 100644
--- a/assets/js/popover.js
+++ b/assets/js/popover.js
@@ -1,5 +1,5 @@
function htmlToElement(html) {
- const template = document.createElement('template')
+ const template = document.createElement("template")
html = html.trim()
template.innerHTML = html
return template.content.firstChild
@@ -7,11 +7,12 @@
function initPopover(baseURL) {
const basePath = baseURL.replace(window.location.origin, "")
- document.addEventListener("DOMContentLoaded", () => {
- fetchData.then(({ content }) => {
- const links = [...document.getElementsByClassName("internal-link")]
- links.forEach(li => {
- const linkDest = content[li.dataset.src.replace(basePath, "")]
+ fetchData.then(({ content }) => {
+ const links = [...document.getElementsByClassName("internal-link")]
+ links
+ .filter((li) => li.dataset.src)
+ .forEach((li) => {
+ const linkDest = content[li.dataset.src.replace(/\/$/g, "").replace(basePath, "")]
if (linkDest) {
const popoverElement = `<div class="popover">
<h3>${linkDest.title}</h3>
@@ -28,6 +29,5 @@
})
}
})
- })
})
}
--
Gitblit v1.10.0