feat: add util page

This commit is contained in:
Xyphyn committed 2023-09-17 15:55:54 -07:00
1 parent 5a892648fb
commit 39975008c8
10 files changed
+174 -12

No files matched your search

+5 -4
View File
@@ -5,10 +5,13 @@
export let source: string = ''
export let inline: boolean = false
function replaceURLs(node: HTMLElement) {
function replaceURLs(node: HTMLElement, source: string) {
if (!div) return
console.log('replacing source', source)
const links = node.querySelectorAll('a')
links.forEach((l) => {
console.log('replacing link', l.href)
const photonified = photonify(l.href)
if (photonified) l.href = photonified
})
@@ -16,9 +19,7 @@
let div: HTMLElement
$: if (source && div) {
replaceURLs(div)
}
$: replaceURLs(div, source)
</script>
<div