Compare commits

..

2 commits

Author SHA1 Message Date
5f904e7e1f Add Univerter to services 2024-08-22 08:34:26 -05:00
07d69cea8b only add URL if no parent is a 2024-08-22 08:34:14 -05:00
2 changed files with 7 additions and 4 deletions

View file

@ -92,7 +92,7 @@ function pathReplacer(html) {
return html return html
} }
function highlighter(json, full = true) { function highlighter(json, full = true, linkParent = false) {
for (var i = 0; i < json.length; i++) { for (var i = 0; i < json.length; i++) {
var element = json[i] var element = json[i]
if (element.type == "element") { if (element.type == "element") {
@ -113,7 +113,7 @@ function highlighter(json, full = true) {
} }
if (valid) { if (valid) {
element.children = highlighter(element.children, full) element.children = highlighter(element.children, full, linkParent || element.tagName == "a")
} }
} }
} else if (element.type == "text") { } else if (element.type == "text") {
@ -205,13 +205,15 @@ function highlighter(json, full = true) {
var stuff = (startContent + dict.words[x] + endContent).trim() var stuff = (startContent + dict.words[x] + endContent).trim()
if (!stuff.includes("span")) { if (!stuff.includes("span")) {
var replacement = `<span ${style} ${classes} ${link}>${stuff}</span>` var replacement = `<span ${style} ${classes}>${stuff}</span>`
if (link) { if (link && !linkParent) {
replacement = `<a href="${link}">${replacement}</a>` replacement = `<a href="${link}">${replacement}</a>`
// console.log(replacement)
} }
element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd) element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
} else { } else {
element.content = element.content.replace(termKey, dict.words[x]) element.content = element.content.replace(termKey, dict.words[x])
} }
} }

View file

@ -80,6 +80,7 @@
<!-- <a class="chip">Matrix: matrix.violets-purgatory.dev</a> --> <!-- <a class="chip">Matrix: matrix.violets-purgatory.dev</a> -->
<!-- <a href="https://element.violets-purgatory.dev" class="chip">Element: element.violets-purgatory.dev</a> --> <!-- <a href="https://element.violets-purgatory.dev" class="chip">Element: element.violets-purgatory.dev</a> -->
<a href="https://git.viois.gay" class="chip">Forgejo: <span class="noHighlight">git.viois.gay</span></a> <a href="https://git.viois.gay" class="chip">Forgejo: <span class="noHighlight">git.viois.gay</span></a>
<a href="https://univerter.dev" class="chip">Univerter: <span class="noHighlight">univerter.dev</span></a>
<a class="chip">Thumbor: <span class="noHighlight">thumbor.violets-purgatory.dev</span></a> <a class="chip">Thumbor: <span class="noHighlight">thumbor.violets-purgatory.dev</span></a>
<hr> <hr>
<h1>Socials</h1> <h1>Socials</h1>