get outer location and pass in to the iframe

This commit is contained in:
Samuel Newman
2024-04-13 12:51:48 +01:00
parent 4c95ec2ec4
commit 66fe7f47a2
2 changed files with 15 additions and 1 deletions
+9 -1
View File
@@ -59,9 +59,17 @@ function scan(node = document) {
continue
}
const ref_url = encodeURIComponent(location.origin + location.pathname)
const searchParams = new URLSearchParams()
searchParams.set('id', id)
searchParams.set('ref_url', ref_url)
const iframe = document.createElement('iframe')
iframe.setAttribute('data-bluesky-id', id)
iframe.src = `${EMBED_URL}/embed/${aturi.slice('at://'.length)}?id=${id}`
iframe.src = `${EMBED_URL}/embed/${aturi.slice(
'at://'.length,
)}?${searchParams.toString()}`
iframe.width = '100%'
iframe.style.border = 'none'
iframe.style.display = 'block'