feat: screenshot house

This commit is contained in:
Julien Calixte
2025-01-28 10:12:06 +01:00
parent 6e17e29167
commit 890cbde0a7
4 changed files with 31 additions and 1 deletions

17
main.ts
View File

@@ -1,3 +1,5 @@
import { domToPng } from 'modern-screenshot'
const params = new URL(document.location.href).searchParams
const display = params.get('display')
@@ -78,3 +80,18 @@ const colorParam = params.get('color')
if (colorParam) {
document.documentElement.style.setProperty('--color', `#${colorParam}`)
}
const screenshotHouseButton = document.querySelector('#screenshot-house')
if (screenshotHouseButton) {
screenshotHouseButton.addEventListener('click', async () => {
const house = document.querySelector('#thinking-people-system')
if (house) {
const png = await domToPng(house)
const a = document.createElement('a')
a.href = png
a.download = 'thinking-people-system.png'
a.click()
}
})
}