From 9f137d70ef152eccceef5dd82f8a2bccb87a65ce Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Wed, 26 Jun 2024 20:07:02 -0500 Subject: [PATCH] Highlights can now have links --- constants.json | 3 ++- pageUpdater.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/constants.json b/constants.json index e781f54..3c1f708 100644 --- a/constants.json +++ b/constants.json @@ -21,7 +21,7 @@ "World's Worst Developer", "The worst git user to exist", "These birds are Pissing me off... I'm the original        Starwalker", - "Make sure to check out Univerter!", + "Make sure to check out Univerter!", "Check out Asahi's website! <3", "Check out Sylvie's website! <3" ], @@ -185,6 +185,7 @@ "color": "lightgray" }, "Univerter": { + "link": "https://univerter.dev/", "color": "rgb(200, 175, 255)" }, "Ko-fi": { diff --git a/pageUpdater.js b/pageUpdater.js index f06ae58..2952ead 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -127,6 +127,7 @@ function highlighter(json, full = true) { var style = termProps.style || "" var classes = termProps.classes || "" + var link = termProps.link || "" if (termProps.color) { style += `color: ${termProps.color};` @@ -155,7 +156,11 @@ function highlighter(json, full = true) { classes = `class="${classes}"` } - var replacement = `${startContent + highTable[index] + endContent}` + var replacement = `${startContent + highTable[index] + endContent}` + + if (link) { + replacement = `${replacement}` + } element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd) }