Fixed image theme check

This commit is contained in:
saberzero1 2024-09-23 20:05:38 +02:00
parent 5a72e0a54a
commit 6867034ec9
No known key found for this signature in database
GPG Key ID: 41AEE99107640F10

View File

@ -24,8 +24,9 @@ export function renderThemedLinks(theme: "dark" | "light") {
const imageGroups = { theme: 1, extension: 2 }
Object.values(document.getElementsByTagName("img")).forEach((img) => {
if (img.src.match(imageExtensions)) {
const newImg = imageExtensions.exec(img.src)
img.src.replace(imageExtensions, `.${theme}.${newImg![imageGroups.extension]}`)
const imageSource = img.src
const newImg = imageExtensions.exec(imageSource)
img.src = imageSource.replace(imageExtensions, `.${theme}.${newImg![imageGroups.extension]}`)
}
})
}